Documents
Writing Docs Gigedit SFZ Instrument Scripts NKSP Language NKSP Reference

change_tune()

This function can be used to modify the tuning of active voices during their entire life time. So you may for example implement very sophisticated pitch envelopes by script by using this function. You need to pass the note ID of the voices you want to alter. This function will change the tuning of all active voices associated with the requested note. So if you are using a layered instrument patch, then it will change the tuning of all layers.

Internally the sampler always fades the tuning from its current value to the new tuning as requested, however that tuning fade by default is so fast that it sounds like its value jumps directly from its old to the new value. You may also override that automated fade time explicitly by calling change_tune_time() before calling the change_tune() function.

The tuning changes set by calling this function are always applied relatively to the tuning/pitch calculated by the synthesis model and sampler format. That means the various sources of tuning/pitch factors like MIDI pitch bend wheel, Pitch Envelopes, Pitch LFOs and other tuning factors that may be defined by the instrument patch, are always processed and calculated for the voices first, and the final pitch applied is always a relative combination of all those factors and the one set with this function call. This does also not change when you pass 1 for argument relative. Or in other words: you cannot replace the tuning/pitch 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 tuning of those release trigger voices will not be affected by this function at all. So if you need to control the tuning 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_tune(note, tuning, [relative])

Arguments

Argument Name Data Type Description
note Note ID Number or Note ID Array All voices of this note will be modified.
[required]
tuning Integer Number Tuning change in milli cents. A positive value increases the tuning, a negative value decreases the tuning.
[required]
relative Integer Number or
Real Number
Whether change_tune() calls should be relative to each other.
0: A call to change_tune() upon the same note will replace the tuning change value set by previous change_tune() calls upon the same note.
1: Successive calls to change_tune() upon the same note will be relatively applied against each other.
[optional, default: 0]

Return Value

None.

Remarks

This functions optionally accepts c for "Cents" as standard unit and finalness for its argument tuning.

Examples

None yet.

See also

change_tune_time()

Availability

Since LinuxSampler 2.0.0.svn11.

The third argument of this function relative is only optional with NKSP. If you want to keep compatibility with KSP, then you should always pass a value for that third argument of this function.

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