Documents
Writing Docs Gigedit SFZ Instrument Scripts NKSP Language NKSP Reference

change_sustain()

This function can be used to modify the amplitude sustain level of active voices of a particular note. In contrast to other synthesis parameter related functions, this function only allows to change the sustain level when the respective note is new, that is either i.e. at the beginning of a note event handler or right after calling play_note(). So you should perform the sustain level change as soon as possible, especially before calling any wait() function and before entering a loop which might take a long time to execute (which might cause your script to get forcely suspended by the script engine due to real-time constraints).

The sustain level changes set by calling this function are always applied relatively to the sustain level calculated by the synthesis model and sampler format. That means the various sources of sustain factors like MIDI CCs and other sustain parameter factors that may be defined by the instrument patch, are always processed and calculated for the voices first, and the final sustain level applied is always a relative combination of all those factors and the one set with this function call. Or in other words: you cannot replace the sustain set by other synthesis sources with this function.

Release Trigger Samples: In case the affected voices cause release trigger samples to be spawned later on, the sustain level of those release trigger voices will not be affected by this function at all. So if you need to control the sustain level of release trigger samples by script, then you might rather also trigger those release trigger samples by script with play_note() instead of using the sampler format's internal support for release trigger samples.

Function Prototype

change_sustain(note, level)

Arguments

Argument Name Data Type Description
note Note ID Number or Note ID Array All voices of this note will be modified.
[required]
level Integer Number or
Real Number
Sustain Level (abstract non-negative value, i.e. 0 for zero sustain level, 1000000 for neutral sustain factor, 2000000 for doubling the effective sustain level).
[required]

Return Value

None.

Remarks

This functions optionally accepts B (for "Bel") as standard unit and finalness for its argument level.

Examples

None yet.

Availability

Since LinuxSampler 2.0.0.svn72.

Document Updated:  2019-09-17  |  Author:  Christian Schoenebeck