diff options
author | Anthony Wang | 2022-12-17 14:13:14 -0600 |
---|---|---|
committer | Anthony Wang | 2022-12-17 14:13:14 -0600 |
commit | f11992a8fca36b7be77c7225a0007468bf6a29cb (patch) | |
tree | bc3ad4c24f351480765fb331bd309e09251606a1 | |
parent | 41b550eca27e073c6b0259b59872b6b6b90fbf77 (diff) |
Implement saw wave
-rw-r--r-- | main.scm | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2,11 +2,18 @@ (define bitrate 8000) +(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 - (sin (* 2 (acos -1) freq t)) + (saw (* freq t)) ) )) |