Mercurial > hg > jslab
diff examples/sound/sampled/firfilter.scm @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/sound/sampled/firfilter.scm Tue Jan 17 17:50:20 2012 +0000 @@ -0,0 +1,30 @@ +; Take audio from line in, +; apply FIR filter defined in the frequency domain, +; and send out +(load "audio.scm") +(load "synthesis.scm") + +(put "regulated" #f) +(put "map.symmetric" #t) + +(tasks) +(define fmt (mono 22050)) +(define N 512) + + +; update filter whenever spectrum changes + +(lineout (linesnk fmt) + (gen->vector N (filter-gen + (fir-filter (spectral-fir 64 (VVector. "spectrum" 33))) + (Wavetable. (linein (linesrc fmt) N N))))) + +(expose) +(set "editor.plotter.type" 4) +(exec (viewable "coeffs") "plotter editor") +(exec (viewable "spectrum") "plotter editor") + +;; the viewable "spectrum" is actually the vector created a few lines up +;; the plotter-editor allows the user to draw the desired frequency +;; response, which is then translated into the appropriate FIR filter. +