Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / pitch_shifter.dsp
1 declare name "pitch-shifter";
2 declare version "1.0";
3 declare author "Grame";
4 declare license "BSD";
5 declare copyright "(c)GRAME 2006";
6
7 //----------------------------
8 // very simple real time pitch shifter
9 //----------------------------
10
11 import("music.lib");
12
13 transpose (w, x, s, sig) =
14 fdelay1s(d,sig)*fmin(d/x,1) + fdelay1s(d+w,sig)*(1-fmin(d/x,1))
15 with {
16 i = 1 - pow(2, s/12);
17 d = i : (+ : +(w) : fmod(_,w)) ~ _;
18 };
19
20 pitchshifter = vgroup("Pitch Shifter", transpose(
21 hslider("window (samples)", 1000, 50, 10000, 1),
22 hslider("xfade (samples)", 10, 1, 10000, 1),
23 hslider("shift (semitones) ", 0, -12, +12, 0.1)
24 )
25 );
26
27
28 process = pitchshifter;