;; again, we can recompile saw_synth_note_c into something
;; else whenever we like
;; here's something more complex
(bind-func saw_synth_note_c
(let ((res .4)
(cof 8000.0))
(lambda (data:NoteInitData* nargs:i64 dargs:SAMPLE*)
(let ((sawl (saw_c 0.0))
(sawl2 (saw_c 0.0))
(modl (osc_c 0.0))
(lpfl (lpf_c))
(lpflmod (osc_c 0.0))
(sawr (saw_c 0.0))
(sawr2 (saw_c 0.0))
(modr (osc_c 0.0))
(lpfr (lpf_c))
(lpfrmod (osc_c 0.0)))
(lambda (time:i64 chan:i64 freq:SAMPLE amp:SAMPLE)
(cond ((= chan 0)
(lpfl (* amp (+ (sawl (* 1.0 amp) freq)
(sawl2 amp (+ freq (modl 100.0 0.2)))))
(+ cof (lpflmod 1000. 1.0))
res))
((= chan 1)
(lpfr (* amp (+ (sawr (* 1.0 amp) freq)
(sawr2 amp (+ freq (modr 50.0 0.5)))))
(+ cof (lpfrmod 1000.0 1.72))
res))
(else 0.0)))))))