;; but we can change the instrument on the fly by swapping in a new
;; 'note kernel' function: the dsp code that gets rendered for
;; each note (it must be a closure that returns a closure)
;;
;; lets try a simple sawwave synth note kernel
(bind-func saw_synth_note_c
(lambda (data:NoteInitData* nargs:i64 dargs:SAMPLE*)
(let ((sawl (saw_c 0.0))
(sawr (saw_c 0.0)))
(lambda (time:i64 chan:i64 freq:SAMPLE amp:SAMPLE)
(cond ((= chan 0)
(sawl amp freq))
((= chan 0)
(sawr amp freq))
(else 0.0))))))