view 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
line wrap: on
line source
; 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.