1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
class:: TwoTube
summary::physical modeling simulation; two tubes
related:: Classes/NTube
categories:: UGens>PhysicalModels
//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html
keyword:: SLUGens
Description::
Physical model; two tube sections with scattering junction inbetween; their relative areas determine k.
classmethods::
method::ar
argument::input
Excitation to inject into the system
argument::k
Scattering coefficient for junction of two tubes, usually -1<=k<=1
argument::loss
Amplitude loss factor in circulation
argument::d1length
Length in samples of first delay line
argument::d2length
Length in samples of second delay line (no interpolation implemented yet)
Examples::
code::
(
{
var delay1, delay2, source;
//k from -1 to 1
//in samples
delay1= 100;
delay2= 40;
source= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0],[(delay1+delay2)/SampleRate.ir,0.0]), Impulse.kr(MouseY.kr(1,4)));
TwoTube.ar(source,MouseX.kr(-1,1),0.99,delay1,delay2);
}.play
)
(
SynthDef(\twotube,{arg delay1=100, delay2=50, k=0.0, loss=0.999, dur=0.5, pan=0.0;
var source;
//k from -1 to 1
source= WhiteNoise.ar(0.5)*EnvGen.ar(Env([1,1,0,0],[(delay1+delay2)/SampleRate.ir,0.0,1.0]));
Out.ar(0,Pan2.ar(TwoTube.ar(source,k,loss,delay1,delay2)*EnvGen.ar(Env([0,1,1,0],[0.001]++((dur-0.001)*[0.4,0.6])),doneAction:2),pan));
}).send(s);
)
(
t.stop;
t={
inf.do{
Synth(\twotube,[\delay1, rrand(1,300),\delay2, rrand(1,300),\loss, rrand(0.9,0.999),\dur, rrand(0.1,5.0), \pan, rrand(-1,1.0), \k, rrand(-1,1.0)]);
0.5.wait;
};
}.fork;
)
::
|