Actually produced sound!
This commit is contained in:
parent
92e83efd95
commit
43ccd48ed9
16
main.scm
16
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))
|
||||
|
|
Loading…
Reference in a new issue