1 |
<html> |
2 |
<head> |
3 |
<meta name="author" content="Christian Schoenebeck"> |
4 |
<title>change_vol_time() function</title> |
5 |
<meta name="description" content="Changes the duration of volume changes."> |
6 |
</head> |
7 |
<body> |
8 |
<h1>change_vol_time()</h1> |
9 |
<p> |
10 |
This function can be used to override the internal fade time of volume |
11 |
changes upon calls to <code lang="nksp">change_vol()</code>. That |
12 |
fade time is not set globally, but rather on a per-note level. |
13 |
</p> |
14 |
<p> |
15 |
Additionally you might call <code>change_vol_curve()</code> to override |
16 |
the default fade curve shape type. |
17 |
</p> |
18 |
|
19 |
<h3>Function Prototype</h3> |
20 |
<p/> |
21 |
<code lang="nksp"> |
22 |
change_vol_time(??note??, ??duration-us??) |
23 |
</code> |
24 |
|
25 |
<h3>Arguments</h3> |
26 |
<table> |
27 |
<tr> |
28 |
<th>Argument Name</th> <th>Data Type</th> <th>Description</th> |
29 |
</tr> |
30 |
<tr> |
31 |
<td><code>??note??</code></td> |
32 |
<td>Note ID Number or Note ID Array</td> |
33 |
<td>All voices of this note will be modified.<br> |
34 |
[required]</td> |
35 |
</tr> |
36 |
<tr> |
37 |
<td><code>??duration-us??</code></td> |
38 |
<td>Integer Number</td> |
39 |
<td>Fade time in microseconds.<br> |
40 |
[required]</td> |
41 |
</tr> |
42 |
</table> |
43 |
|
44 |
<h3>Return Value</h3> |
45 |
<p>None.</p> |
46 |
|
47 |
<h3>Examples</h3> |
48 |
<p>The following example demonstrates a simple, custom volume envelope generator.</p> |
49 |
<code> |
50 |
on init |
51 |
declare const $time1US := 800000 { 0.8 seconds } |
52 |
declare const $time2US := 1600000 { 1.6 seconds } |
53 |
declare const $time3US := 3000000 { 3 seconds } |
54 |
end on |
55 |
|
56 |
on note |
57 |
{ Start the note with a (immediately) decreased volume |
58 |
of -30 dB. } |
59 |
change_vol($EVENT_ID, -30000) |
60 |
|
61 |
{ Fade the note's volume within 0.8s from -30 db up to |
62 |
its normal volume, that is to 0 dB. } |
63 |
change_vol_time($EVENT_ID, $time1US) |
64 |
change_vol($EVENT_ID, 0) |
65 |
|
66 |
{ Remain in this stage with 0 dB for 1.6 seconds. } |
67 |
wait($time1US + $time2US) |
68 |
|
69 |
{ Now fade the note's volume from 0 dB down to -12 dB |
70 |
within 3 seconds. } |
71 |
change_vol_time($EVENT_ID, $time3US) |
72 |
change_vol($EVENT_ID, -12000) |
73 |
end on |
74 |
</code> |
75 |
|
76 |
<h3>See also</h3> |
77 |
<p><code>change_vol()</code>, <code>change_vol_curve()</code>, <code>fade_in()</code>, <code>fade_out()</code><p> |
78 |
|
79 |
<h3>Availability</h3> |
80 |
<p>Since LinuxSampler 2.0.0.svn45.<p> |
81 |
|
82 |
<note> |
83 |
This function exists only with NKSP, it is not available with KSP. |
84 |
</note> |
85 |
|
86 |
</body> |
87 |
</html> |