annotate examples/sound/sampled/firfilter.scm @ 8:5e3cbbf173aa tip

Reorganise some more
author samer
date Fri, 05 Apr 2019 22:41:58 +0100
parents bf79fb79ee13
children
rev   line source
samer@0 1 ; Take audio from line in,
samer@0 2 ; apply FIR filter defined in the frequency domain,
samer@0 3 ; and send out
samer@0 4 (load "audio.scm")
samer@0 5 (load "synthesis.scm")
samer@0 6
samer@0 7 (put "regulated" #f)
samer@0 8 (put "map.symmetric" #t)
samer@0 9
samer@0 10 (tasks)
samer@0 11 (define fmt (mono 22050))
samer@0 12 (define N 512)
samer@0 13
samer@0 14
samer@0 15 ; update filter whenever spectrum changes
samer@0 16
samer@0 17 (lineout (linesnk fmt)
samer@0 18 (gen->vector N (filter-gen
samer@0 19 (fir-filter (spectral-fir 64 (VVector. "spectrum" 33)))
samer@0 20 (Wavetable. (linein (linesrc fmt) N N)))))
samer@0 21
samer@0 22 (expose)
samer@0 23 (set "editor.plotter.type" 4)
samer@0 24 (exec (viewable "coeffs") "plotter editor")
samer@0 25 (exec (viewable "spectrum") "plotter editor")
samer@0 26
samer@0 27 ;; the viewable "spectrum" is actually the vector created a few lines up
samer@0 28 ;; the plotter-editor allows the user to draw the desired frequency
samer@0 29 ;; response, which is then translated into the appropriate FIR filter.
samer@0 30