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=
"824.41">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.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
}
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
; color: #000000; min-height: 12.0px}
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: #000000}
17 span
.s1
{color: #0000bf}
18 span
.Apple-tab-span
{white-space:pre
}
22 <p class=
"p1"><b>LinExp
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>convert a linear range to an exponential range
</b></p>
23 <p class=
"p2"><br></p>
24 <p class=
"p3"><b>LinExp.ar(in, srclo, srchi, dstlo, dsthi)
</b></p>
25 <p class=
"p3"><b>LinExp.kr(in, srclo, srchi, dstlo, dsthi)
</b></p>
26 <p class=
"p2"><br></p>
27 <p class=
"p3">Converts a linear range of values to an exponential range of values.
</p>
28 <p class=
"p3">The dstlo and dsthi arguments must be nonzero and have the same sign.
</p>
29 <p class=
"p3"><b>in
</b> - input to convert.
</p>
30 <p class=
"p3"><b>srclo
</b> - lower limit of input range.
</p>
31 <p class=
"p3"><b>srchi
</b> - upper limit of input range.
</p>
32 <p class=
"p3"><b>dstlo
</b> - lower limit of output range.
</p>
33 <p class=
"p3"><b>dsthi
</b> - upper limit of output range.
</p>
34 <p class=
"p4"><br></p>
35 <p class=
"p5"><br></p>
36 <p class=
"p6">// compare:
</p>
38 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
39 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">SinOsc
</span>.kr(
<span class=
"s1">Line
</span>.kr(
1,
10,
10));
</p>
40 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(mod *
400 +
500) *
0.1<span class=
"Apple-converted-space"> </span></p>
41 <p class=
"p7">}.play;
</p>
43 <p class=
"p5"><br></p>
45 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
46 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">SinOsc
</span>.kr(
<span class=
"s1">Line
</span>.kr(
1,
10,
10));
</p>
47 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(
<span class=
"s1">LinExp
</span>.kr(mod, -
1,
1,
100,
900)) *
0.1<span class=
"Apple-converted-space"> </span></p>
48 <p class=
"p7">}.play;
</p>
50 <p class=
"p5"><br></p>
51 <p class=
"p6">// modulating destination values.
</p>
53 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
54 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">LFNoise2
</span>.ar(
80);
</p>
55 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(
<span class=
"s1">LinExp
</span>.ar(mod, -
1,
1,
<span class=
"s1">MouseX
</span>.kr(
200,
8000,
1),
<span class=
"s1">MouseY
</span>.kr(
200,
8000,
1))) *
0.1<span class=
"Apple-converted-space"> </span></p>
56 <p class=
"p7">}.play;
</p>
58 <p class=
"p5"><br></p>
59 <p class=
"p5"><br></p>
60 <p class=
"p3"><b>linexp
</b> and
<b>exprange
</b> can be used to create a LinExp implicitly from a ugen, mapping its output values from linear range to an exponential one. The rate is derived from the ugen.
</p>
61 <p class=
"p5"><br></p>
62 <p class=
"p5"><br></p>
63 <p class=
"p6">// linexp
</p>
65 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
66 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">LFNoise2
</span>.ar(
80);
</p>
67 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(mod.linexp(-
1,
1,
<span class=
"s1">MouseX
</span>.kr(
200,
8000,
1),
<span class=
"s1">MouseY
</span>.kr(
200,
8000,
1))) *
0.1<span class=
"Apple-converted-space"> </span></p>
68 <p class=
"p7">}.play;
</p>
70 <p class=
"p5"><br></p>
71 <p class=
"p6">// exprange
</p>
73 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
74 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">LFNoise2
</span>.ar(
80).exprange(
<span class=
"s1">MouseX
</span>.kr(
200,
8000,
1),
<span class=
"s1">MouseY
</span>.kr(
200,
8000,
1));
</p>
75 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(mod) *
0.1<span class=
"Apple-converted-space"> </span></p>
76 <p class=
"p7">}.play;
</p>
78 <p class=
"p5"><br></p>
79 <p class=
"p5"><br></p>
80 <p class=
"p5"><br></p>
81 <p class=
"p5"><br></p>