Add rate_type in interpreter/types.ml.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / faust-stk / sitar.dsp
1 declare name "Sitar";
2 declare description "WaveGuide Sitar";
3 declare author "Romain Michon (rmichon@ccrma.stanford.edu)";
4 declare copyright "Romain Michon";
5 declare version "1.0";
6 declare licence "STK-4.3"; // Synthesis Tool Kit 4.3 (MIT style license);
7 declare description "This instrument implements a sitar plucked string physical model based on the Karplus-Strong algorithm using a randomly modulated delay line.";
8
9 import("music.lib");
10 import("instrument.lib");
11
12 //==================== GUI SPECIFICATION ================
13
14 freq = nentry("h:Basic_Parameters/freq [1][unit:Hz] [tooltip:Tone frequency]",440,20,20000,1);
15 gain = nentry("h:Basic_Parameters/gain [1][tooltip:Gain (value between 0 and 1)]",1,0,1,0.01);
16 gate = button("h:Basic_Parameters/gate [1][tooltip:noteOn = 1, noteOff = 0]");
17
18 resonance = hslider("v:Physical_Parameters/Resonance
19 [2][tooltip:A value between 0 and 1]",0.7,0,1,0.01)*0.1;
20
21 //==================== SIGNAL PROCESSING ================
22
23 //stereoizer is declared in instrument.lib and implement a stereo spacialisation in function of
24 //the frequency period in number of samples
25 stereo = stereoizer(SR/freq);
26
27 //excitation envelope (adsr)
28 envelope = adsr(0.001,0.04,0,0.5,gate);
29
30 //the delay length is randomly modulated
31 targetDelay = SR/freq;
32 delayLength = targetDelay*((1+(0.5*noise)) : smooth(0.9992));
33 delayLine = delay(4096,delayLength);
34
35 //the loop gain control the resonance duration
36 loopGain = 0.895 + resonance + (freq*0.0000005);
37 amGain = 0.1*gain;
38
39 //feedback filter is a one zero (declared in instrument.lib)
40 filter = oneZero1(b0,b1)
41 with{
42 zero = 0.01;
43 b0 = 1/(1 + zero);
44 b1 = -zero*b0;
45 };
46
47 process = (*(loopGain) : filter + (envelope*noise*amGain))~delayLine : *(8) :
48 stereo : instrReverb;