-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample2.cal
106 lines (84 loc) · 2.72 KB
/
Example2.cal
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{Example 2.}
{Global setings.}
{Sets the fundamental frequency to 110 Hz.}
scale cycles 110 in
{Sets the unit of time to 0.35 s.}
scale time 0.35 in
{Reduces the general volume.}
scale vertical 0.3 in
{Global definitions.}
{Define the seven degrees D0, ..., D6 of the Phrygian scale.}
let next = put ../Stdlib/Pitch12/Phrygian in
let D0 = %1 in
let D1 = D0[next] in
let D2 = D1[next] in
let D3 = D2[next] in
let D4 = D3[next] in
let D5 = D4[next] in
let D6 = D5[next] in
{A tool to create silences.}
let s = put ../Stdlib/Tool/Silence in
{A tool to create an empty phrase. This is useful to alter a phrase by deleting some of its
notes by compositions.}
let e = put ../Stdlib/Tool/Empty in
{A tool to repeat two times a sound.}
let r2 = put ../Stdlib/Tool/Repeat2 in
{A tool to superimpose two phrases without distortion.}
let c2 = put ../Stdlib/Tool/Chord2 in
{A synthesizer.}
let synth = put ../Stdlib/Synth/EveningFlight in
{Definitions of phrases.}
{This bounds the new name p1 to a sequence of notes. Some of these notes are composed with
%2 or with %3. By default, the notes with no compositions can be seen as composed with %1.
This allows us to have three sorts of notes (those composed with %1, %2, or %3) in order
to be able in the sequel to compose p1 with three arguments. The first argument will
replace the occurrences of %1, the second will replace the occurrences of %2, and the last
will replace the occurrences of %3. Each subexpression %N is called a beat.}
let p1 =
D0 * D0 * D3[%2]<
*
D0 * (D3[%2] * D3[%2])> * D4 * D5
*
(D6[%3] * D6[%3]),> * D0 * D6<
in
{This bounds the new name p2 to a sequence of notes.}
let p2 =
(D0 * D0),, * D0[%2],<
*
D3,, * (D3[%2], * D3[%2])> * D3,<
*
(D6[%3] * D6),,, * D6,,<
in
{This bounds the new name p3 to the superposition of the phrases p1 and p2.}
let p3 = c2[p1; p2] in
{Main phrase.}
{This is the main expression of the program. The keywords "begin" and "end" are understood
as parentheses. This phrases uses p1, p2, and p3 and composition involving them. For
instance, nine versions of p3 are used, obtained by considering p3 and various compositions
of the form p3[a1; a2; a3] where a1, a2, and a3 are some other expressions. The final
expression is composed with three synthesizer arguments in order to interpret each %1, %2,
and %3 of the resulting expression as the sound specified by synth.}
begin
(r2[p2] * (D0 * D0),, * D0,< * (D0 * D0)>)
*
p3[D0; e; e]<
*
r2[
p3[D0; e; e]
*
p3
*
p3[D1; %2; %3]
*
p3[%1; D3; %3]
*
p3[%1; %2; D0<]
*
p3[D6,; %2; %3]
*
p3[%1; %2; D0<]
]
*
p3[D0; e; e]
end
[synth; synth; synth]