2 summary:: Bank of resonators.
3 related:: Classes/Klang, Classes/Klank
4 categories:: UGens>Generators>Deterministic, UGens>Filters>Linear
9 DynKlank is a bank of frequency resonators which can be used to simulate
10 the resonant modes of an object. Each mode is given a ring time, which is
11 the time for the mode to decay by 60 dB.
14 Unlike link::Classes/Klank:: , the frequencies in DynKlank can be
15 changed after it has been started.
22 argument::specificationsArrayRef
23 A Ref to an Array of three Arrays: code::[frequencies, amplitudes, ringtimes]::
26 ## frequencies: || An Array of filter frequencies.
27 ## amplitudes: || An Array of filter amplitudes, or nil. If nil, then amplitudes default to 1.0.
28 ## ring times: || An Array of 60 dB decay times for the filters.
30 All subarrays, if not nil, should have the same length.
33 The excitation input to the resonant filter bank.
36 A scale factor multiplied by all frequencies at initialization time.
39 An offset added to all frequencies at initialization time.
42 A scale factor multiplied by all ring times at initialization time.
49 { DynKlank.ar(`[[800, 1071, 1153, 1723], nil, [1, 1, 1, 1]], Impulse.ar(2, 0, 0.1)) }.play;
51 { DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], Dust.ar(8, 0.1)) }.play;
53 { DynKlank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)) }.play;
55 { DynKlank.ar(`[[200, 671, 1153, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar([0.007,0.007])) }.play;
59 // change freqs and ringtimes with mouse
60 { var freqs, ringtimes;
61 freqs = [800, 1071, 1153, 1723] * MouseX.kr(0.5, 2, 1);
62 ringtimes = [1, 1, 1, 1] * MouseY.kr(0.1, 10, 1);
63 DynKlank.ar(`[freqs, nil, ringtimes ], Impulse.ar(2, 0, 0.1))
68 // set them from outside later:
69 SynthDef('help-dynKlank', {
70 var freqs, ringtimes, signal;
71 freqs = Control.names([\freqs]).kr([800, 1071, 1153, 1723]);
72 ringtimes = Control.names([\ringtimes]).kr([1, 1, 1, 1]);
73 signal = DynKlank.ar(`[freqs, nil, ringtimes ], Impulse.ar(2, 0, 0.1));
78 a = Synth('help-dynKlank');
80 a.setn(\freqs, Array.rand(4, 500, 2000));
81 a.setn(\ringtimes, Array.rand(4, 0.2, 4) );
83 // create multichannel controls directly with literal arrays:
85 SynthDef('help-dynKlank', {|
86 freqs (#[100, 200, 300, 400]),
87 amps (#[1, 0.3, 0.2, 0.05]),
88 rings (#[1, 1, 1, 2])|
90 Out.ar(0, DynKlank.ar(`[freqs, amps, rings], WhiteNoise.ar * 0.001))
94 a = Synth('help-dynKlank');
96 a.setn(\freqs, Array.rand(4, 500, 2000));
97 a.setn(\amps, Array.exprand(4, 0.01, 1));
99 { Out.kr(102, MouseX.kr(1, 2) * Array.rand(4, 500, 2000)) }.play;
100 a.mapn(\freqs, 102, 4);