106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
"sync_test": {
"body": {
"lead_instr": { # Instrument 'melody'
"score_line": "i1 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6",
"octave": 8,
"duration": 30,
"grammars": { # Notes for this instrument to use in this piece
"u": ["D/4 D/4 D/4 D/4 (v)"],
"v": ["C/4 C/4 C/4 C/4 (u)"],
},
},
"follow_instr": { # Instrument 'melody'
"score_line": "i2 %(time)f %(duration)f 7000 %(octave)d.%(note)s 1",
"sync": "lead_instr",
"octave": 8,
"duration": 30,
"grammars": { # Notes for this instrument to use in this piece
"u": ["D/4 D/4 D/4 D/4 (u)"],
"v": ["C/4 C/4 C/4 C/4 (v)"],
},
},
},
},
}
print '''f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08
|
|
|
>
|
|
|
|
|
>
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
"sync_test": {
"body": {
"lead_instr": { # Instrument 'melody'
"score_line": "i1 %(time)f %(duration)f 7000 %(octave)d.%(note)s %(octave)d.%(note)s 0 6",
"octave": 8,
"duration": 30,
"grammars": { # Notes for this instrument to use in this piece
"u": ["A/4, B/4, C/4 D/4 (u)", "D/4' D/4' D/4' D/4' (v)"],
"v": ["C/4 C/4 C/4 C/4 (w)"],
"w": ["E/4 F/4 E/4 F/4 (u)"],
},
},
"follow_instr": { # Instrument 'melody'
"score_line": "i3 %(time)f %(duration)f 7000 %(octave)d.%(note)s",
# "sync": "lead_instr",
"octave": 2,
"duration": 30,
"grammars": { # Notes for this instrument to use in this piece
"u": ["E F G E (u)"],
"v": ["G A A A (e)"],
"e": ["B' A' G' A' (v)"],
},
},
},
},
}
print '''f1 0 512 10 1
f2 0 8192 10 .24 .64 .88 .76 .06 .5 .34 .08
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
except KeyError:
pass
def render_instr(instr, syncs, max_time):
for g in instr["grammars"]:
for i in range(len(instr["grammars"][g])):
instr["grammars"][g][i] = parse.parse(instr["grammars"][g][i])
score= []
try:
score, syncs = choose_phrase(instr, syncs, 0, max_time, None)
while True:
score_index_to_replace = None
|
|
|
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
except KeyError:
pass
def render_instr(instr, syncs, max_time):
for g in instr["grammars"]:
for i in range(len(instr["grammars"][g])):
instr["grammars"][g][i] = parse.parse(instr["grammars"][g][i], default_octave=instr["octave"])
score= []
try:
score, syncs = choose_phrase(instr, syncs, 0, max_time, None)
while True:
score_index_to_replace = None
|