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: #bf0000}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0000bf}
19 span
.s1
{color: #0000bf}
20 span
.s2
{color: #000000}
21 span
.Apple-tab-span
{white-space:pre
}
25 <p class=
"p1"><b>LinLin
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>map a linear range to another linear range
</b></p>
26 <p class=
"p2"><br></p>
27 <p class=
"p3"><b>LinLin.ar(in, srclo, srchi, dstlo, dsthi)
</b></p>
28 <p class=
"p3"><b>LinLin.kr(in, srclo, srchi, dstlo, dsthi)
</b></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p3"><b>in
</b> - input to convert.
</p>
31 <p class=
"p3"><b>srclo
</b> - lower limit of input range.
</p>
32 <p class=
"p3"><b>srchi
</b> - upper limit of input range.
</p>
33 <p class=
"p3"><b>dstlo
</b> - lower limit of output range.
</p>
34 <p class=
"p3"><b>dsthi
</b> - upper limit of output range.
</p>
35 <p class=
"p4"><br></p>
36 <p class=
"p2"><br></p>
37 <p class=
"p5">// examples:
</p>
38 <p class=
"p6"><br></p>
40 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
41 <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>
42 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(
<span class=
"s1">LinLin
</span>.kr(mod, -
1,
1,
100,
900)) *
0.1<span class=
"Apple-converted-space"> </span></p>
43 <p class=
"p7">}.play;
</p>
45 <p class=
"p6"><br></p>
46 <p class=
"p5">// modulating destination values.
</p>
48 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
49 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">LFNoise2
</span>.ar(
80);
</p>
50 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(
<span class=
"s1">LinLin
</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>
51 <p class=
"p7">}.play;
</p>
53 <p class=
"p6"><br></p>
54 <p class=
"p5">// modulating source and destination values.
</p>
56 <p class=
"p8">{
<span class=
"Apple-converted-space"> </span></p>
57 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">LFNoise2
</span>.ar(
80);
</p>
58 <p class=
"p9"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>SinOsc
<span class=
"s2">.ar(
</span></p>
59 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">LinLin
</span>.ar(mod,
<span class=
"Apple-converted-space"> </span></p>
60 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.kr(
0.2),
<span class=
"s1">SinOsc
</span>.kr(
0.2543),
<span class=
"Apple-converted-space"> </span></p>
61 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">MouseX
</span>.kr(
200,
8000,
1),
<span class=
"s1">MouseY
</span>.kr(
200,
8000,
1)
</p>
62 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
63 <p class=
"p8"><span class=
"Apple-tab-span"> </span>) *
0.1<span class=
"Apple-converted-space"> </span></p>
64 <p class=
"p8">}.play;
</p>
66 <p class=
"p6"><br></p>
67 <p class=
"p6"><br></p>
68 <p class=
"p3"><b>linlin
</b> and
<b>range
</b> can be used to create a LinLin implicitly from a ugen, mapping its output values from linear range to an exponential one. The rate is derived from the ugen.
</p>
69 <p class=
"p6"><br></p>
70 <p class=
"p6"><br></p>
71 <p class=
"p5">// linlin
</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);
</p>
75 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">SinOsc
</span>.ar(mod.linlin(-
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>
76 <p class=
"p7">}.play;
</p>
78 <p class=
"p6"><br></p>
79 <p class=
"p5">// range
</p>
81 <p class=
"p7">{
<span class=
"Apple-converted-space"> </span></p>
82 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> mod =
<span class=
"s1">LFNoise2
</span>.ar(
80).range(
<span class=
"s1">MouseX
</span>.kr(
200,
8000,
1),
<span class=
"s1">MouseY
</span>.kr(
200,
8000,
1));
</p>
83 <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>
84 <p class=
"p7">}.play;
</p>
86 <p class=
"p6"><br></p>