diff options
Diffstat (limited to 'lib.scm')
-rw-r--r-- | lib.scm | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -0,0 +1,18 @@ +(define (saw t) ( + let ((m (floor-remainder (+ t (/ 1 4)) 1))) + (if (< m 1/2) + (- (* 4 m) 1) + (- 3 (* 4 m))) +)) + +(define (note freq start len) ( + lambda (t) ( + if (or (< t start) (>= t (+ start len))) + 0 + (saw (* freq t)) + ) +)) + +(define (getfreq octave pitch) ( + * 55 (ash 1 octave) (expt 2 (/ pitch 13)) +)) |