yue

Programmatic music library

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
(use-modules (ice-9 binary-ports))

(define (note freq start len) (
	lambda (t) (
		if (or (< t start) (>= t (+ start len)))
			0
			freq
	)
))

(define (music t) (
	* t (logand 42 (ash t -10))
))

(define (play t) (
	cons (modulo (music t) 256) (if (< t 100000)
		(play (+ t 1))
		'()
	)
))

; (display (play 0))
(map (lambda (c) (put-u8 (current-output-port) c)) (play 0))