aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-12-17 12:42:44 -0600
committerAnthony Wang2022-12-17 12:42:44 -0600
commit43ccd48ed91e9d8d8efea0f8cd597f9ffbe700e7 (patch)
tree67e16f75706e3b2de8a540864f6342104a6ad09c
parent92e83efd95250c8c61a6993c7a3c8e211b49d9a8 (diff)
Actually produced sound!
-rw-r--r--main.scm16
1 files changed, 10 insertions, 6 deletions
diff --git a/main.scm b/main.scm
index 348a2ba..0278148 100644
--- a/main.scm
+++ b/main.scm
@@ -1,19 +1,23 @@
+(use-modules (ice-9 binary-ports))
+
(define (note freq start len) (
lambda (t) (
- if (or (< t start) (> t (+ start len)))
+ if (or (< t start) (>= t (+ start len)))
0
freq
)
))
(define (music t) (
- (note 440 0 10) t
+ * t (logand 42 (ash t -10))
))
(define (play t) (
- if (< t 100)
- (cons (music t) (play (+ t 1)))
- (music t)
+ cons (modulo (music t) 256) (if (< t 100000)
+ (play (+ t 1))
+ '()
+ )
))
-(display (play 0))
+; (display (play 0))
+(map (lambda (c) (put-u8 (current-output-port) c)) (play 0))