-
Notifications
You must be signed in to change notification settings - Fork 4
/
rt.scm
50 lines (40 loc) · 1 KB
/
rt.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(require 'midilisp)
;quote the next line to play in real time instead of writing to a midifile
; the real time stuff isn't portable
(begin
(set! midilisp:port '(file "test.mid"))
'(set! *scaler* 2))
(define (foo)
(parallel
(begin (note 60 1000) (note 64 1000) (note 67 1000) (note 72 3000))
(begin (parallel
(note 48 6000)
(note 52 6000)
(note 55 6000)))
(begin (sleep 3000) (note 36 3000)) ))
(define (riff1 k)
(note k 200)
(note (+ 2 k) 200)
(note (+ 4 k) 200))
(define (riff2 k)
(riff1 k)
(riff1 (+ k 2))
(riff1 (+ k 4)))
(define (bar)
;(print (now))
(parallel
(riff2 48)
(riff2 60)))
(run (bar))
'(begin
(define *serial-port* #f)
(define-syntax runxx
(syntax-rules ()
((run <exp1> <exp2> ...)
(begin
(set! *serial-port* (system:open-serial-output "COM2" 38400))
(reset-scheduler)
(begin <exp1> <exp2> ...)
(close-output-port *serial-port*)
(set! *serial-port* #f)
(print "...done") )))))