aboutsummaryrefslogtreecommitdiff
path: root/music.scm
diff options
context:
space:
mode:
authorAnthony Wang2022-12-17 23:00:16 -0600
committerAnthony Wang2022-12-17 23:00:16 -0600
commit55b6ce6d80f85f717c56573c051615499e1a03f3 (patch)
treed255db543ae6a958c28857d23f8440a747be4534 /music.scm
parent3da3a7f6c5ee83373ef4e6e3232cc5a371137e68 (diff)
Use apply and map for melody function
Diffstat (limited to 'music.scm')
-rw-r--r--music.scm25
1 files changed, 13 insertions, 12 deletions
diff --git a/music.scm b/music.scm
index a45111f..1098ab3 100644
--- a/music.scm
+++ b/music.scm
@@ -1,18 +1,19 @@
(include "lib.scm")
-(define (melody t) (+
- ((note (getfreq 3 4) 0 1/4) t)
- ((note (getfreq 3 8) 1/4 1/4) t)
- ((note (getfreq 3 4) 3/4 1/4) t)
- ((note (getfreq 3 11) 1 1/4) t)
- ((note (getfreq 3 4) 5/4 1/4) t)
- ((note (getfreq 3 2) 3/2 1/4) t)
- ((note (getfreq 3 8) 7/4 1/4) t)
- ((note (getfreq 3 4) 9/4 1/4) t)
- ((note (getfreq 3 11) 5/2 1/4) t)
- ((note (getfreq 3 4) 11/4 1/4) t)
+(define (melody t) (
+ apply + (map
+ (lambda (octave pitch start len) ((note (getfreq octave pitch) start len) t))
+ ;'(3)
+ ;(cons (* 3 (sin t)) '())
+ ;'(0)
+ ;'(6.28)
+ '(3 3 3 3 3 3 3 3 3 3)
+ '(4 8 4 11 4 2 8 4 11 4)
+ '(0 1/4 3/4 1 5/4 3/2 7/4 9/4 5/2 11/4)
+ '(1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4)
+ )
))
(define (music t) (
- melody (floor-remainder t 3)
+ melody (floor-remainder t 6.28)
))