Add an ADSR (and manipulate its settings) to an Instrument

Hi,

Is it possible to add an ADSR effect to an instrument, via the Tools API? Additionally, if it is possible to add the effect, is it possible to adjust its settings, such as attack time?

I’ve been poking around in in the Renoise.Song.API documentation but have either missed it or am not understanding something fundamental.

Thanks

renoise.song().instruments[].sample_modulation_sets[]:insert_device_at(device_path, index)
→ [returns new renoise.SampleModulationDevice object]

####################################################################

renoise.SampleAhdrsModulationDevice (inherits from renoise.SampleModulationDevice) ?

Properties

Attack duration.

renoise.song().instruments[].sample_modulation_sets[].devices[].attack
→ [renoise.DeviceParameter object, 0-1]

Hold duration.

renoise.song().instruments[].sample_modulation_sets[].devices[].hold
→ [renoise.DeviceParameter object, 0-1]

Duration.

renoise.song().instruments[].sample_modulation_sets[].devices[].duration
→ [renoise.DeviceParameter object, 0-1]

Sustain amount.

renoise.song().instruments[].sample_modulation_sets[].devices[].sustain
→ [renoise.DeviceParameter object, 0-1]

Release duration.

renoise.song().instruments[].sample_modulation_sets[].devices[].release
→ [renoise.DeviceParameter object, 0-1]

:face_with_raised_eyebrow:__

Thanks @Tall_TeQ . I deleted my comment above because I asked a question that you had already answered, I just needed to look harder.

Thanks again

1 Like

OK, so I’ve spent time trying to understand this… but still no joy. Can someone provide an example of how to add an SampleAhdrsModulationDevice to the current sample?

local function insert_modulation_device(idx,target_idx,device_idx)
  local mod_set=renoise.song().selected_sample_modulation_set
  if (mod_set) then
    oprint(mod_set.available_devices)  --Look at this!
    local device_path=mod_set.available_devices[idx]
    mod_set:insert_device_at(device_path,target_idx,device_idx)
end
insert_modulation_device(4,1,1)  -- 4--> AHDSR

I have written the code directly here, but it should work.

Note: for years, the API has not had the option of being able to select the target (Vol Pan Ptc …). But at least you can assign the modulation you want on the target through the value target_idx.

In short, you will be able to insert the modulation device inside a concrete target, but later you will not be able to select the target from the API. Hopefully @taktik fixes it! I am also using these things and it is very annoying…

Related documentation (R3.3.2)

-- Insert a new device at the given position. "device_path" must be one of
-- renoise.song().instruments[].sample_modulation_sets[].available_devices.
renoise.song().instruments[].sample_modulation_sets[]:insert_device_at(device_path, index) 
  -> [returns new renoise.SampleModulationDevice object]

The documentation has not been corrected yet! Maybe you had problems here?
The correct code is this:

renoise.song().instruments.sample_modulation_sets:insert_device_at(device_path,target_index,device_index)

target_index corresponds to the index of: Vol, Pan, Ptc, Cut, Res or Drv

This works. Thank you very much. This part of the API is a bit confusing and the docs don’t help me much.

For future travelers, a list of device numbers:

1 - Modulation/Operand
2 - Modulation/Key Tracking
3 - Modulation/Velocity Tracking
4 - Modulation/AHDSR
5 - Modulation/Envelope
6 - Modulation/Stepper
7 - Modulation/LFO
8 - Modulation/Fader

Certain! I had to investigate in the forums and on my own doing tests to clarify myself.

1 Like