diff options
Diffstat (limited to 'lib.scm')
-rw-r--r-- | lib.scm | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -1,21 +1,17 @@ ; Triangle wave with a period of 1 second -(define (tri t) ( - let ((m (floor-remainder (+ t (/ 1 4)) 1))) +(define (tri t) + (let ((m (floor-remainder (+ t (/ 1 4)) 1))) (if (< m 1/2) (- (* 4 m) 1) - (- 3 (* 4 m))) -)) + (- 3 (* 4 m))))) ; Creates a note -(define (note freq start len) ( - lambda (t) ( +(define (note freq start len) + (lambda (t) ( if (or (< t start) (>= t (+ start len))) 0 - freq - ) -)) + freq))) ; Gets the frequency of a particular pitch -(define (getfreq octave pitch) ( - * 55 (ash 1 octave) (expt 2 (/ pitch 13)) -)) +(define (getfreq octave pitch) + (* 55 (ash 1 octave) (expt 2 (/ pitch 13)))) |