1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000bf}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco
; min-height: 16.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #007300}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
18 span
.s1
{font: 18.0px Helvetica
}
19 span
.s2
{color: #000000}
20 span
.s3
{color: #0000bf}
21 span
.s4
{color: #0000bf}
22 span
.s5
{color: #0000bf}
23 span
.s6
{color: #0000bf}
24 span
.s7
{text-decoration: underline
; color: #0000bf}
25 span
.s8
{color: #0000bf}
26 span
.s9
{color: #007300}
27 span
.Apple-tab-span
{white-space:pre
}
31 <p class=
"p1"><span class=
"s1"><b>Lag2UD
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>exponential lag
</b></p>
32 <p class=
"p2"><br></p>
33 <p class=
"p3"><span class=
"s2"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><b>Object
</b></a></span><span class=
"s3"><b> :
</b><a href=
"../../Core/Kernel/AbstractFunction.html"><span class=
"s4"><b>AbstractFunction
</b></span></a><b> :
</b><a href=
"../UGen.html"><span class=
"s5"><b>UGen
</b></span></a></span><span class=
"s5"><b> :
</b><a href=
"../Filter.html"><span class=
"s6"><b>Filter
</b></span></a><b> :
</b><a href=
"Lag.html"><span class=
"s6"><b>Lag
</b></span></a></span></p>
34 <p class=
"p2"><br></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p1"><b>Lag2UD.ar(in, lagTimeU, lagTimeD, mul, add))
</b></p>
37 <p class=
"p1"><b>Lag2UD.kr(in, lagTimeU, lagTimeD, mul, add))
</b></p>
38 <p class=
"p2"><br></p>
39 <p class=
"p1">Lag2 is equivalent to Lag.kr(Lag.kr(in, time), time), thus resulting in a smoother transition. This saves on CPU as you only have to calculate the decay factor once instead of twice. See
<b>Lag
</b> for more details.
</p>
41 See also
<a href=
"Lag2.html"><span class=
"s7">Lag2
</span></a></p>
42 <p class=
"p1"><b>in
</b> - input signal
</p>
43 <p class=
"p1"><b>lagTimeU
</b> -
60 dB lag time in seconds for the upgoing signal.
</p>
44 <p class=
"p1"><b>lagTimeD
</b> -
60 dB lag time in seconds for the downgoing signal.
</p>
45 <p class=
"p4"><br></p>
47 <p class=
"p6">// used to lag pitch
</p>
48 <p class=
"p7"><span class=
"s2"><span class=
"Apple-converted-space"> </span></span><span class=
"s8">SynthDef
</span><span class=
"s2">(
</span>\lag2ud_help
<span class=
"s2">,
</span></p>
49 <p class=
"p8"><span class=
"Apple-converted-space"> </span></p>
50 <p class=
"p5"><span class=
"Apple-tab-span"> </span>{
<span class=
"s8">arg
</span> freq=
300,lagup=
1, lagdown=
5;
</p>
51 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">Out
</span>.ar(
0,
</p>
52 <p class=
"p6"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s8">SinOsc
</span><span class=
"s2">.ar(
</span>// sine wave
</p>
53 <p class=
"p6"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s8">Lag2UD
</span><span class=
"s2">.kr(
</span>// lag the frequency
</p>
54 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>freq,
</p>
55 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>lagup,
</p>
56 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>lagdown
</p>
57 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>),
</p>
58 <p class=
"p6"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
</span>// phase
</p>
59 <p class=
"p6"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.2 </span>// sine amplitude
</p>
60 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
61 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
62 <p class=
"p5"><span class=
"Apple-tab-span"> </span>}).send(s);
</p>
64 <p class=
"p8"><br></p>
65 <p class=
"p6"><span class=
"s2">x =
</span><span class=
"s8">Synth
</span><span class=
"s2">.new(
</span><span class=
"s9">\lag2ud_help
</span><span class=
"s2"> );
</span>// create the synth
</p>
66 <p class=
"p8"><span class=
"Apple-converted-space"> </span></p>
67 <p class=
"p6"><span class=
"s2">x.set(
</span><span class=
"s9">\freq
</span><span class=
"s2">,
500 );
</span>// set the frequency to a higher value (takes
1 second)
</p>
68 <p class=
"p6"><span class=
"s2">x.set(
</span><span class=
"s9">\freq
</span><span class=
"s2">,
100 );
</span>// set the frequency to a lower value (takes
5 seconds)
</p>
69 <p class=
"p5">x.free;
</p>