aboutsummaryrefslogtreecommitdiff
path: root/lib.scm
diff options
context:
space:
mode:
Diffstat (limited to 'lib.scm')
-rw-r--r--lib.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib.scm b/lib.scm
index f0f9c6a..0038c58 100644
--- a/lib.scm
+++ b/lib.scm
@@ -5,12 +5,18 @@
(- (* 4 m) 1)
(- 3 (* 4 m)))))
+; Square wave with a period of 1 second
+(define (square t)
+ (let ((m (floor-remainder t 1)))
+ (if (< m 0.5) 1 -1)))
+
; Creates a note
(define (note freq start len)
(lambda (t) (
if (or (< t start) (>= t (+ start len)))
0
- freq)))
+ (* 1/4 (tri (* 1.5 t freq))))))
+;
; Gets the frequency of a particular pitch
(define (getfreq octave pitch)