Make install.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / karplus32.dsp
1 declare name "karplus32";
2 declare version "1.0";
3 declare author "Grame";
4 declare license "BSD";
5 declare copyright "(c)GRAME 2006";
6
7
8 //-----------------------------------------------
9 // karplus-strong
10 // with 32 resonators in parallel
11 //-----------------------------------------------
12
13 import("music.lib");
14
15
16 // Excitator
17 //--------
18
19 upfront(x) = (x-x') > 0.0;
20 decay(n,x) = x - (x>0)/n;
21 release(n) = + ~ decay(n);
22 trigger(n) = upfront : release(n) : >(0.0) : +(leak);
23 leak = 1.0/65536.0;
24
25 size = hslider("excitation (samples)", 128, 2, 512, 1);
26
27
28
29
30 // Resonator
31 //-----------------
32
33 dur = hslider("duration (samples)", 128, 2, 512, 1);
34 att = hslider("attenuation", 0.1, 0, 1, 0.01);
35 average(x) = (x+x')/2;
36
37 resonator(d, a) = (+ : delay(4096, d-1.5)) ~ (average : *(1.0-a)) ;
38
39
40 // Polyphony
41 //-----------------
42
43 detune = hslider("detune", 32, 0, 512, 1);
44 polyphony = hslider("polyphony", 1, 0, 32, 1);
45
46
47
48 output = hslider("output volume", 0.5, 0, 1, 0.1);
49
50
51 process = vgroup("karplus32",
52 vgroup("noise generator", noise * hslider("level", 0.5, 0, 1, 0.1))
53 : vgroup("excitator", *(button("play"): trigger(size)))
54 <: vgroup("resonator x32", par(i,32, resonator(dur+i*detune, att) * (polyphony > i)))
55 :> *(output),*(output)
56 );