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.44">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #902a19}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0018f7}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #091fb1}
15 span
.s1
{color: #902a19}
16 span
.s2
{color: #0018f7}
17 span
.s3
{color: #000000}
18 span
.s4
{color: #456c20}
19 span
.s5
{color: #091fb1}
20 span
.Apple-tab-span
{white-space:pre
}
24 <p class=
"p1"><br></p>
25 <p class=
"p1"><br></p>
26 <p class=
"p2">// basic live coding techniques (
"object style")
</p>
27 <p class=
"p2">// without the use of JITLib
</p>
28 <p class=
"p1"><br></p>
29 <p class=
"p2">// more to come..
</p>
30 <p class=
"p1"><br></p>
31 <p class=
"p1"><br></p>
32 <p class=
"p2">// using a simple environment. this looks just like ProxySpace, but works differently.
</p>
33 <p class=
"p3"><span class=
"s1">// for the difference, see
<a href=
"jitlib_basic_concepts_01.html"><span class=
"s2">jitlib_basic_concepts_01
</span></a> and
<span class=
"Apple-converted-space"> </span><a href=
"jitlib_basic_concepts_02.html"><span class=
"s2">jitlib_basic_concepts_02
</span></a></span></p>
34 <p class=
"p1"><br></p>
35 <p class=
"p1"><br></p>
36 <p class=
"p1"><br></p>
37 <p class=
"p2"><span class=
"s3">d = ();
</span>// create a new environment
</p>
38 <p class=
"p2"><span class=
"s3">d.push;
</span>// push it to current
</p>
39 <p class=
"p1"><br></p>
40 <p class=
"p2">// this synthdef can be changed on the fly, but the synth will
</p>
41 <p class=
"p2">// not change from this. use expression [
1] for replacing a given synth
</p>
43 <p class=
"p5">SynthDef
<span class=
"s3">(
</span><span class=
"s4">\x
</span><span class=
"s3">, {
</span>|freq=
440|
</p>
44 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"s5">Out
</span>.ar(
0,
<span class=
"Apple-converted-space"> </span></p>
45 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">Ringz
</span>.ar(
<span class=
"s5">Dust
</span>.ar(
40), freq,
0.1)
</p>
46 <p class=
"p4"><span class=
"Apple-tab-span"> </span>)
</p>
47 <p class=
"p4">}).send(s);
</p>
49 <p class=
"p1"><br></p>
50 <p class=
"p2">// send a first synth:
</p>
51 <p class=
"p4">~s1 =
<span class=
"s5">Synth
</span>(
<span class=
"s4">\x
</span>);
</p>
52 <p class=
"p1"><br></p>
53 <p class=
"p2">// [
1]
</p>
54 <p class=
"p2">// now you can play around with these lines, as well as with the synth def above
</p>
55 <p class=
"p4">~s1 =
<span class=
"s5">Synth
</span>.replace(~s1,
<span class=
"s4">\x
</span>, [
<span class=
"s4">\freq
</span>,
3000]);
<span class=
"Apple-converted-space"> </span></p>
56 <p class=
"p4">~s1.set(
<span class=
"s4">\freq
</span>,
4000);
</p>
57 <p class=
"p1"><br></p>
58 <p class=
"p2">// add a bus:
</p>
59 <p class=
"p1"><br></p>
60 <p class=
"p4">~b1 =
<span class=
"s5">Bus
</span>.control(s);
</p>
61 <p class=
"p4">~b1.set(
350);
</p>
62 <p class=
"p4">~s1.map(
<span class=
"s4">\freq
</span>, ~b1);
</p>
63 <p class=
"p1"><br></p>
64 <p class=
"p2">// set the bus to different values:
</p>
65 <p class=
"p1"><br></p>
66 <p class=
"p4">~b1.set(
100);
</p>
67 <p class=
"p4">~b1.xline(
800,
5);
</p>
68 <p class=
"p1"><br></p>
69 <p class=
"p4">~s3 = {
<span class=
"s5">Out
</span>.kr(~b1,
<span class=
"s5">MouseX
</span>.kr(
300,
900,
1)) }; // add some mouse control on the fly
</p>
70 <p class=
"p2"><span class=
"s3">~s3.free;
</span>// remove it again.
</p>
71 <p class=
"p1"><br></p>
72 <p class=
"p1"><br></p>
73 <p class=
"p1"><br></p>
74 <p class=
"p2">// finish:
</p>
75 <p class=
"p1"><br></p>
76 <p class=
"p4">~b1.free;
</p>
77 <p class=
"p4">d.clear;
</p>
78 <p class=
"p4">d.pop;
</p>
79 <p class=
"p1"><br></p>
80 <p class=
"p1"><br></p>
81 <p class=
"p1"><br></p>
82 <p class=
"p1"><br></p>
83 <p class=
"p1"><br></p>
84 <p class=
"p1"><br></p>
85 <p class=
"p1"><br></p>
86 <p class=
"p1"><br></p>
87 <p class=
"p1"><br></p>