changeVolume(noteID, gain, relative, immediateOrDuration)
Function to change the volume of a specific note. A gain factor greater than 1.0 amplifies the signal and a gain factor smaller than 1.0 attenuates the signal.
Available in: Processor.
|noteID||The ID of the note that you want to change.||number|
|gain||The absolute gain (relative = ||number|
|relative||The value is added to the current amount if this is set to ||boolean, optional|
|immediateOrDuration||Change the value immediately or in the specified duration. Set this to ||boolean or number, optional|
-- attenuate notes between C2 and C4 local lowKey = 48 -- C2 local highKey = 72 -- C4 local keyRange = highKey - lowKey function onNote(event) if event.note > lowKey then local gain = (event.note - lowKey)/keyRange local id = postEvent(event) changeVolume(id, gain, false, true) end end