Rename "architecture" directory into "lib".
[Faustine.git] / examples / sinwave / sin.dsp
1 //sin = ffunction(float sin(float), <math.h>, "");
2 //floor = ffunction(float floor(float), <math.h>, "");
3 PI = 3.141592653589;
4
5 tablesize = 40000;
6 samplingfreq = 44100.;
7
8 time = (+(1)~_) - 1;
9 sinwavform = time * (2 * PI)/tablesize : sin;
10
11 decimal = _ <: -(floor);
12 phase(freq) = freq / samplingfreq : mem : ( + : decimal) ~ _ : * (tablesize) : int;
13 osc(freq) = phase(freq) : rdtable(tablesize, sinwavform);
14
15 vol = 1;
16 freq = 1000;
17
18 process = osc(freq) * vol;
19 //process = freq / samplingfreq : @(1): ( + : decimal) ~ _ : * (tablesize) : int ;