X-Git-Url: https://scm.cri.minesparis.psl.eu/git/Faustine.git/blobdiff_plain/d1e05f17aa7a1169e3e8ea4ccef8817d7dffb0da..cc8ed2bd6bd5a60156d63040b2d352ad5b1a3095:/examples/sinwave/sin.dsp diff --git a/examples/sinwave/sin.dsp b/examples/sinwave/sin.dsp new file mode 100644 index 0000000..b1650f2 --- /dev/null +++ b/examples/sinwave/sin.dsp @@ -0,0 +1,19 @@ +//sin = ffunction(float sin(float), , ""); +//floor = ffunction(float floor(float), , ""); +PI = 3.141592653589; + +tablesize = 40000; +samplingfreq = 44100.; + +time = (+(1)~_) - 1; +sinwavform = time * (2 * PI)/tablesize : sin; + +decimal = _ <: -(floor); +phase(freq) = freq / samplingfreq : mem : ( + : decimal) ~ _ : * (tablesize) : int; +osc(freq) = phase(freq) : rdtable(tablesize, sinwavform); + +vol = 1; +freq = 1000; + +process = osc(freq) * vol; +//process = freq / samplingfreq : @(1): ( + : decimal) ~ _ : * (tablesize) : int ;