Adding new source file faustio.ml, including class waveio and class csvio.
[Faustine.git] / interpretor / faust-0.9.47mr3 / benchmark / 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 // karplus-strong
9 // with 32 resonators in parallel
10 //-----------------------------------------------
11
12 import("music.lib");
13
14
15 // Excitator
16 //--------
17
18 upfront(x) = (x-x') > 0.0;
19 decay(n,x) = x - (x>0)/n;
20 release(n) = + ~ decay(n);
21 trigger(n) = upfront : release(n) : >(0.0) : +(leak);
22 leak = 1.0/65536.0;
23
24 size = hslider("excitation (samples)", 128, 2, 512, 1);
25
26
27
28
29 // Resonator
30 //-----------------
31
32 dur = hslider("duration (samples)", 128, 2, 512, 1);
33 att = hslider("attenuation", 0.1, 0, 1, 0.01);
34 average(x) = (x+x')/2;
35
36 resonator(d, a) = (+ : delay(4096, d-1.5)) ~ (average : *(1.0-a)) ;
37
38
39 // Polyphony
40 //-----------------
41
42 detune = hslider("detune", 32, 0, 512, 1);
43 polyphony = hslider("polyphony", 1, 0, 32, 1);
44
45
46
47 output = hslider("output volume", 0.5, 0, 1, 0.1);
48
49
50 process = vgroup("karplus32",
51 vgroup("noise generator", noise * hslider("level", 0.5, 0, 1, 0.1))
52 : vgroup("excitator", *(button("play"): trigger(size)))
53 <: vgroup("resonator x32", par(i,32, resonator(dur+i*detune, att) * (polyphony > i)))
54 :> *(output),*(output)
55 );