1
2/* A simple chorus effect. */
3
4declare name "chorus -- a simple chorus effect";
5declare author "Albert Graef";
6declare version "1.0";
7
8import("music.lib");
9
10level	= hslider("level", 0.5, 0, 1, 0.01);
11freq	= hslider("freq", 2, 0, 10, 0.01);
12dtime	= hslider("delay", 0.025, 0, 0.2, 0.001);
13depth	= hslider("depth", 0.02, 0, 1, 0.001);
14
15tblosc(n,f,freq,mod)	= (1-d)*rdtable(n,wave,i&(n-1)) +
16			  d*rdtable(n,wave,(i+1)&(n-1))
17with {
18	wave	 	= time*(2.0*PI)/n : f;
19	phase		= freq/SR : (+ : decimal) ~ _;
20	modphase	= decimal(phase+mod/(2*PI))*n;
21	i		= int(floor(modphase));
22	d		= decimal(modphase);
23};
24
25chorus(d,freq,depth)	= fdelay(1<<16, t)
26with {	t		= SR*d/2*(1+depth*tblosc(1<<16, sin, freq, 0)); };
27
28process			= vgroup("chorus", (c, c))
29with { c(x) = x+level*chorus(dtime,freq,depth,x); };
30