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=
"1038.35">
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: 9.0px Monaco
; min-height: 12.0px}
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: #ad140d}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #2c7014}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #001bb9}
17 span
.s1
{font: 18.0px Helvetica
}
18 span
.s2
{color: #001bb9}
19 span
.s3
{color: #000000}
20 span
.s4
{color: #2c7014}
21 span
.Apple-tab-span
{white-space:pre
}
25 <p class=
"p1"><span class=
"s1"><b>DynKlank
<span class=
"Apple-tab-span"> </span></b></span><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>dynamic bank of resonators
</b></p>
26 <p class=
"p2"><br></p>
27 <p class=
"p1"><b>DynKlank.ar(specificationsArrayRef, input, freqscale, freqoffset, decayscale)
</b></p>
28 <p class=
"p1"><b>DynKlank.kr(specificationsArrayRef, input, freqscale, freqoffset, decayscale)
</b></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p1">DynKlank is a bank of resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by
60 dB.
</p>
31 <p class=
"p2"><br></p>
32 <p class=
"p1">Unlike
<a href=
"Klank.html"><span class=
"s2">Klank
</span></a>, the parameters in
<b>specificationsArrayRef
</b> can be changed after it has been started.
</p>
33 <p class=
"p2"><br></p>
34 <p class=
"p1"><b>specificationsArrayRef
</b> - a Ref to an Array of three Arrays :
</p>
35 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>frequencies
</b> - an Array of filter frequencies.
</p>
36 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>amplitudes
</b> - an Array of filter amplitudes, or nil. If nil, then amplitudes default to
1.0</p>
37 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>ring
</b> <b>times
</b> - an Array of
60 dB decay times for the filters.
</p>
38 <p class=
"p1">All subarrays, if not nil, should have the same length.
</p>
39 <p class=
"p1"><b>input
</b> - the excitation input to the resonant filter bank.
</p>
40 <p class=
"p1"><b>freqscale
</b> - a scale factor multiplied by all frequencies at initialization time.
</p>
41 <p class=
"p1"><b>freqoffset
</b> - an offset added to all frequencies at initialization time.
</p>
42 <p class=
"p1"><b>decayscale
</b> - a scale factor multiplied by all ring times at initialization time.
</p>
43 <p class=
"p3"><br></p>
44 <p class=
"p4">s.boot;
</p>
45 <p class=
"p3"><br></p>
46 <p class=
"p4">{
<span class=
"s2">DynKlank
</span>.ar(`[[
800,
1071,
1153,
1723],
<span class=
"s2">nil
</span>, [
1,
1,
1,
1]],
<span class=
"s2">Impulse
</span>.ar(
2,
0,
0.1)) }.play;
</p>
47 <p class=
"p3"><br></p>
48 <p class=
"p4">{
<span class=
"s2">DynKlank
</span>.ar(`[[
800,
1071,
1353,
1723],
<span class=
"s2">nil
</span>, [
1,
1,
1,
1]],
<span class=
"s2">Dust
</span>.ar(
8,
0.1)) }.play;
</p>
49 <p class=
"p3"><br></p>
50 <p class=
"p4">{
<span class=
"s2">DynKlank
</span>.ar(`[[
800,
1071,
1353,
1723],
<span class=
"s2">nil
</span>, [
1,
1,
1,
1]],
<span class=
"s2">PinkNoise
</span>.ar(
0.007)) }.play;
</p>
51 <p class=
"p3"><br></p>
52 <p class=
"p4">{
<span class=
"s2">DynKlank
</span>.ar(`[[
200,
671,
1153,
1723],
<span class=
"s2">nil
</span>, [
1,
1,
1,
1]],
<span class=
"s2">PinkNoise
</span>.ar([
0.007,
0.007])) }.play;
</p>
53 <p class=
"p3"><br></p>
54 <p class=
"p3"><br></p>
56 <p class=
"p5">// change freqs and ringtimes with mouse
</p>
57 <p class=
"p4">{
<span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> freqs, ringtimes;
</p>
58 <p class=
"p4"><span class=
"Apple-tab-span"> </span>freqs = [
800,
1071,
1153,
1723] *
<span class=
"s2">MouseX
</span>.kr(
0.5,
2,
1);
</p>
59 <p class=
"p4"><span class=
"Apple-tab-span"> </span>ringtimes = [
1,
1,
1,
1] *
<span class=
"s2">MouseY
</span>.kr(
0.1,
10,
1);
</p>
60 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"s2">DynKlank
</span>.ar(`[freqs,
<span class=
"s2">nil
</span>, ringtimes ],
<span class=
"s2">Impulse
</span>.ar(
2,
0,
0.1))
</p>
61 <p class=
"p4">}.play;
</p>
63 <p class=
"p3"><br></p>
65 <p class=
"p5">// set them from outside later:
</p>
66 <p class=
"p6"><span class=
"s2">SynthDef
</span><span class=
"s3">(
</span>'help-dynKlank'
<span class=
"s3">, {
</span></p>
67 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> freqs, ringtimes, signal;
</p>
68 <p class=
"p4"><span class=
"Apple-tab-span"> </span>freqs =
<span class=
"s2">Control
</span>.names([
<span class=
"s4">\freqs
</span>]).kr([
800,
1071,
1153,
1723]);
</p>
69 <p class=
"p4"><span class=
"Apple-tab-span"> </span>ringtimes =
<span class=
"s2">Control
</span>.names([
<span class=
"s4">\ringtimes
</span>]).kr([
1,
1,
1,
1]);
</p>
70 <p class=
"p4"><span class=
"Apple-tab-span"> </span>signal =
<span class=
"s2">DynKlank
</span>.ar(`[freqs,
<span class=
"s2">nil
</span>, ringtimes ],
<span class=
"s2">Impulse
</span>.ar(
2,
0,
0.1));
</p>
71 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"s2">Out
</span>.ar(
0, signal);
</p>
72 <p class=
"p4">}).add;
</p>
74 <p class=
"p3"><br></p>
75 <p class=
"p6"><span class=
"s3">a =
</span><span class=
"s2">Synth
</span><span class=
"s3">(
</span>'help-dynKlank'
<span class=
"s3">);
</span></p>
76 <p class=
"p3"><br></p>
77 <p class=
"p4">a.setn(
<span class=
"s4">\freqs
</span>,
<span class=
"s2">Array
</span>.rand(
4,
500,
2000));
</p>
78 <p class=
"p4">a.setn(
<span class=
"s4">\ringtimes
</span>,
<span class=
"s2">Array
</span>.rand(
4,
0.2,
4) );
</p>
79 <p class=
"p3"><br></p>
80 <p class=
"p5">// create multichannel controls directly with literal arrays:
</p>
82 <p class=
"p6"><span class=
"s2">SynthDef
</span><span class=
"s3">(
</span>'help-dynKlank'
<span class=
"s3">, {
</span><span class=
"s2">|
<span class=
"Apple-converted-space"> </span></span></p>
83 <p class=
"p7"><span class=
"Apple-tab-span"> </span>freqs (#[
100,
200,
300,
400]),
<span class=
"Apple-converted-space"> </span></p>
84 <p class=
"p7"><span class=
"Apple-tab-span"> </span>amps (#[
1,
0.3,
0.2,
0.05]),
<span class=
"Apple-converted-space"> </span></p>
85 <p class=
"p7"><span class=
"Apple-tab-span"> </span>rings (#[
1,
1,
1,
2])|
</p>
86 <p class=
"p3"><br></p>
87 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"s2">Out
</span>.ar(
0,
<span class=
"s2">DynKlank
</span>.ar(`[freqs, amps, rings],
<span class=
"s2">WhiteNoise
</span>.ar *
0.001))
</p>
88 <p class=
"p4">}).add
</p>
90 <p class=
"p3"><br></p>
91 <p class=
"p6"><span class=
"s3">a =
</span><span class=
"s2">Synth
</span><span class=
"s3">(
</span>'help-dynKlank'
<span class=
"s3">);
</span></p>
92 <p class=
"p3"><br></p>
93 <p class=
"p4">a.setn(
<span class=
"s4">\freqs
</span>,
<span class=
"s2">Array
</span>.rand(
4,
500,
2000));
</p>
94 <p class=
"p4">a.setn(
<span class=
"s4">\amps
</span>,
<span class=
"s2">Array
</span>.exprand(
4,
0.01,
1));
</p>
95 <p class=
"p3"><br></p>
96 <p class=
"p4">{
<span class=
"s2">Out
</span>.kr(
102,
<span class=
"s2">MouseX
</span>.kr(
1,
2) *
<span class=
"s2">Array
</span>.rand(
4,
500,
2000)) }.play;
</p>
97 <p class=
"p4">a.mapn(
<span class=
"s4">\freqs
</span>,
102,
4);
</p>