-
Notifications
You must be signed in to change notification settings - Fork 2
/
ad-libitum.ss
73 lines (58 loc) · 1.73 KB
/
ad-libitum.ss
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
;; <add-library-directories>
(define (add-library-directory dir)
(library-directories
(cons dir (library-directories))))
(define (add-library-directories . dirs)
(unless (null? dirs)
(add-library-directory (car dirs))
(apply add-library-directories (cdr dirs))))
(add-library-directories
"./chez-soundio"
"./chez-portmidi"
"./chez-sockets")
;; </add-library-directories>
(import (ad-libitum common))
(voodoo)
(import (chezscheme)
(srfi s1 lists)
(srfi s26 cut)
(srfi s42 eager-comprehensions)
(ad-libitum signal)
(prefix (ad-libitum control) ctrl:)
(prefix (ad-libitum oscillator) osc:)
(prefix (ad-libitum envelope) env:)
(prefix (ad-libitum filter) filter:)
(prefix (ad-libitum scale) scale:)
(prefix (ad-libitum instrument) inst:)
(ad-libitum metro)
(prefix (ad-libitum noise) noise:)
(prefix (ad-libitum sound) sound:)
(prefix (ad-libitum scheduler) scheduler:)
(prefix (ad-libitum repl) repl:)
(prefix (ad-libitum midi) midi:)
)
;; <ad-libitum-init>
(alias now sound:now)
(alias schedule scheduler:*schedule*)
(alias callback schedule)
;; in case of emergency ☺
(alias hush! sound:hush!)
(alias h! hush!)
(alias play! sound:set-dsp!)
(sound:start)
(scheduler:init now)
(scheduler:start)
;; (repl:start-repl-server)
;; </ad-libitum-init>
;; <tuner-constants>
(define tuner-frequency 440.0)
(define tuner-period (/ tuner-frequency))
(define tuner-half-period (* 0.5 tuner-period))
;; </tuner-constants>
;; <test-tuner>
(define (tuner time channel)
(sin (* 2π time tuner-frequency)))
(define (quick-test signal)
(signal (random 1.0) (random *channels*)))
;; (sound:set-dsp! tuner)
;; </test-tuner>