Using notifiers to always toggle autofade = ON after recording?

Hi, how would I go about making it so that every time that I record, when the recording is complete, the autofade=true is triggered after sample has been written to the Instrument Box?

I’m no good with notifiers, so could use some halp :o

Hi, how would I go about making it so that every time that I record, when the recording is complete, the autofade=true is triggered after sample has been written to the Instrument Box?

I’m no good with notifiers, so could use some halp :o

Related documentation:

-- Selected in the instrument's sample list. Only nil when no samples 
-- are present in the selected instrument., _observable
  -> [read-only, renoise.Sample object or nil]

-- Has sample data?[].samples[].sample_buffer.has_sample_data
  -> [read-only, boolean][].samples[].autofade, _observable
  -> [boolean]

-- Invoked periodically in the background, more often when the work load
-- is low, less often when Renoise's work load is high.
-- The exact interval is undefined and can not be relied on, but will be
-- around 10 times per sec.
-- You can do stuff in the background without blocking the application here.
-- Be gentle and don't do CPU heavy stuff please!
  -> [renoise.Document.Observable object]

I have built a solution that checks the status of the autofade after recording the sample, using an idle_obserbable notifier and a checkbox to activate it. Make sure you add this checkbox (CHECKBOX_AUTOFADE) in your GUI and activate it manually when you need it.Personally, I do not like having an idle_notifier working all the time. I think it’s better to have control with a checkbox.

vb = renoise.ViewBuilder()
vws = vb.views
rna =
rnt = renoise.tool()

--automatic autofade function
function enable_autofade()
  local song =
  --check if the Sample Recorder dialog is visible 
  if ( rna.window.sample_record_dialog_is_visible == false ) then
    --check if the selected instrument has at least one sample slot available
    if ( song.selected_sample == nil ) then
      --check if the selected sample has a buffer
      if ( song.selected_sample.sample_buffer.has_sample_data == false ) then
        --check if the selected sample has the autofade false
        if ( song.selected_sample.autofade == true ) then
          --enable autofade
          song.selected_sample.autofade = true
        --here you can change other properties of the sample

--checkbox function with idle_obserbable for enable_autofade()
function checkbox_autofade()
  if ( CHECKBOX_AUTOFADE.value == false ) then
    if ( rnt.app_idle_observable:has_notifier(enable_autofade) ) then
    if not ( rnt.app_idle_observable:has_notifier(enable_autofade) ) then

--checkbox for automatic autofade function
CHECKBOX_AUTOFADE = vb:checkbox {
  value = false,
  notifier = function() checkbox_autofade() end,
  tooltip = "Enable/disable automatic autofade with Sample Recorder"

Maybe there is a more elegant and direct way to solve it, with a specific observable, that you check only once after recording the sample. This would avoid the idle_observable.

Is there an observable to indicate that the sample recording is over?

Edit :This could also be done with a slower timer, about 500ms or something like that. So not so many checks.

Edit2 :Keep in mind that it will also activate the autofade when you insert any new sample, even when you activate the checkbox(CHECKBOX_AUTOFADE) when there is a selected sample, as long as the Sample Recorder dialog is active…Be careful with this.

1 Like

Hmm. Thanks Raul, however, I’d prefer to not have to have a GUI open to tick a box to enable it.

I’m trying to figure out how to enable it at startup. Running into heaps of trouble with that one.

Here’s what I’ve tried

-- Start of Startup notifier
function sample_loaded_change_to_sample_editor_v2()
local = renoise.ApplicationWindow.MIDDLE_FRAME_INSTRUMENT_SAMPLE_EDITOR
--[].samples[].autofade=true[].samples[].interpolation_mode=4"Transport to waveform successful")
  print ("sample_loaded_change_to_sample_editor_v2 was shot")

function startup_notifier()
  if == nil then"Notifier: No samples found") return else
  "Notifier: sample_loaded_change_to_sample_Editor_v2 added")

---------- Load startup_notifier
if not renoise.tool().app_new_document_observable:has_notifier(startup_notifier) 
   then renoise.tool().app_new_document_observable:add_notifier(startup_notifier)"Notifier: startup_notifier has been added")
   else renoise.tool().app_new_document_observable:remove_notifier(startup_notifier)

yet it seems to only work once. like this:

  1. I need to have a sample loaded into an instrument slot.
  2. Then I need to press “Reload all tools”
  3. Then I load a new sample in
    -> It has autofade.

If I go to any other slot, and load a sample in, it doesn’t have autofade.

What am I missing here? I tried removing the remove_notifier’s but that did not seem to help either.

I think the thing that is the problem here is that this binds a notifier to a specific, just a specific, selected sample. whichever sample happens to 1) be there 2) have selected.