OOP initial commit with new traces.
[Faustine.git] / interpretor / faust-0.9.47mr3 / tools / faust2pd / examples / synth / organ.syn
1
2 declare name "organ -- a simple additive synth";
3 declare author "Albert Graef";
4 declare version "1.0";
5
6 import("music.lib");
7
8 // control variables
9
10 vol = hslider("vol", 0.3, 0, 10, 0.01); // %
11 pan = hslider("pan", 0.5, 0, 1, 0.01); // %
12 attack = hslider("attack", 0.01, 0, 1, 0.001); // sec
13 decay = hslider("decay", 0.3, 0, 1, 0.001); // sec
14 sustain = hslider("sustain", 0.5, 0, 1, 0.01); // %
15 release = hslider("release", 0.2, 0, 1, 0.001); // sec
16 freq = nentry("freq", 440, 20, 20000, 1); // Hz
17 gain = nentry("gain", 0.3, 0, 10, 0.01); // %
18 gate = button("gate"); // 0/1
19
20 // relative amplitudes of the different partials
21
22 amp(1) = hslider("amp1", 1.0, 0, 3, 0.01);
23 amp(2) = hslider("amp2", 0.5, 0, 3, 0.01);
24 amp(3) = hslider("amp3", 0.25, 0, 3, 0.01);
25
26 // additive synth: 3 sine oscillators with adsr envelop
27
28 partial(i) = amp(i+1)*osc((i+1)*freq);
29
30 process = sum(i, 3, partial(i))
31 * (gate : vgroup("1-adsr", adsr(attack, decay, sustain, release)))
32 * gain : vgroup("2-master", *(vol) : panner(pan));