1 |
<html> |
2 |
<head> |
3 |
<meta name="author" content="Christian Schoenebeck"> |
4 |
<title>change_tune() function</title> |
5 |
<meta name="description" content="Modifies the tuning of voices of a particular note."> |
6 |
</head> |
7 |
<body> |
8 |
<h1>change_tune()</h1> |
9 |
<p> |
10 |
This function can be used to modify the tuning of active voices during |
11 |
their entire life time. So you may for example implement very sophisticated |
12 |
pitch envelopes by script by using this function. You need to pass the |
13 |
note ID of the voices you want to alter. This function will change the |
14 |
tuning of all active voices associated with the requested note. So if you |
15 |
are using a layered instrument patch, then it will change the tuning of |
16 |
all layers. |
17 |
</p> |
18 |
<p> |
19 |
Internally the sampler always fades the tuning from its current value to |
20 |
the new tuning as requested, however that tuning fade by default is so fast |
21 |
that it sounds like its value jumps directly from its old to the new value. |
22 |
You may also override that automated fade time explicitly by calling |
23 |
<code lang="nksp">change_tune_time()</code> before calling the |
24 |
<code lang="nksp">change_tune()</code> function. |
25 |
</p> |
26 |
<p> |
27 |
The tuning changes set by calling this function are always applied relatively to |
28 |
the tuning/pitch calculated by the synthesis model and sampler format. That means |
29 |
the various sources of tuning/pitch factors like MIDI pitch bend wheel, Pitch Envelopes, |
30 |
Pitch LFOs and other tuning factors that may be defined by the |
31 |
instrument patch, are always processed and calculated for the voices first, |
32 |
and the final pitch applied is always a relative combination of all those |
33 |
factors and the one set with this function call. This does also not change |
34 |
when you pass <code>1</code> for argument <code>??relative??</code>. |
35 |
Or in other words: you cannot replace the tuning/pitch set by other synthesis |
36 |
sources with this function. |
37 |
</p> |
38 |
|
39 |
<note class="important"> |
40 |
Release Trigger Samples: In case the affected voices cause release trigger |
41 |
samples to be spawned later on, the tuning of those release trigger voices |
42 |
will not be affected by this function at all. So if you need to control the |
43 |
tuning of release trigger samples by script, then you might rather also trigger |
44 |
those release trigger samples by script with <code lang="nksp">play_note()</code> |
45 |
instead of using the sampler format's internal support for release trigger samples. |
46 |
</note> |
47 |
|
48 |
<h3>Function Prototype</h3> |
49 |
<p/> |
50 |
<code lang="nksp"> |
51 |
change_tune(??note??, ??tuning??, [??relative??]) |
52 |
</code> |
53 |
|
54 |
<h3>Arguments</h3> |
55 |
<table> |
56 |
<tr> |
57 |
<th>Argument Name</th> <th>Data Type</th> <th>Description</th> |
58 |
</tr> |
59 |
<tr> |
60 |
<td><code>??note??</code></td> |
61 |
<td>Note ID Number or Note ID Array</td> |
62 |
<td>All voices of this note will be modified.<br> |
63 |
[required]</td> |
64 |
</tr> |
65 |
<tr> |
66 |
<td><code>??tuning??</code></td> |
67 |
<td>Integer Number</td> |
68 |
<td>Tuning change in milli cents. |
69 |
A positive value increases the tuning, |
70 |
a negative value decreases the tuning.<br> |
71 |
[required]</td> |
72 |
</tr> |
73 |
<tr> |
74 |
<td><code>??relative??</code></td> |
75 |
<td>Integer Number</td> |
76 |
<td>Whether change_tune() calls should be relative to each other.<br> |
77 |
0: A call to <code>change_tune()</code> upon the same note will |
78 |
replace the tuning change value set by previous |
79 |
<code>change_tune()</code> calls upon the same note.<br> |
80 |
1: Successive calls to <code>change_tune()</code> upon the same |
81 |
note will be relatively applied against each other.<br> |
82 |
[optional, default: 0]</td> |
83 |
</tr> |
84 |
</table> |
85 |
|
86 |
<h3>Return Value</h3> |
87 |
<p>None.</p> |
88 |
|
89 |
<h3>Examples</h3> |
90 |
<p>None yet.<p> |
91 |
|
92 |
<h3>See also</h3> |
93 |
<p><code>change_tune_time()</code><p> |
94 |
|
95 |
<h3>Availabilty</h3> |
96 |
<p>Since LinuxSampler 2.0.0.svn11.<p> |
97 |
|
98 |
<note> |
99 |
The third argument of this function <code>??relative??</code> is only |
100 |
optional with NKSP. If you want to keep compatibility with KSP, then you |
101 |
should always pass a value for that third argument of this function. |
102 |
</note> |
103 |
|
104 |
</body> |
105 |
</html> |