diff options
Diffstat (limited to 'lambeat.scm')
-rw-r--r-- | lambeat.scm | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lambeat.scm b/lambeat.scm index 10b08b5..c6b506b 100644 --- a/lambeat.scm +++ b/lambeat.scm @@ -2,18 +2,16 @@ (include "music.scm") ; Bitrate is the number time to sample the music function each second -(define bitrate 8000) +(define bitrate 44100) ; Get the music as a list sampled at the bitrate (define (play t end) - (cons (music t) + (cons ((lambda (a) + (let ((b (modulo (inexact->exact (round (* (+ a 2) 32768))) 65536))) cons + (put-u8 (current-output-port) (modulo b 256)) + (put-u8 (current-output-port) (quotient b 256)))) (music t)) (if (< t end) (play (+ t (/ 1 bitrate)) end) '()))) -; Output the list in the s16 raw audio format -(for-each (lambda (a) - (let ((b (modulo (inexact->exact (round (* (+ a 2) 32768))) 65536))) cons - (put-u8 (current-output-port) (modulo b 256)) - (put-u8 (current-output-port) (quotient b 256)))) - (play 0 16)) +(play 0 100) |