music-transcription 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/examples/song1.yml CHANGED
@@ -7,354 +7,412 @@ start_meter: !ruby/object:Music::Transcription::Meter
7
7
  measure_duration: !ruby/object:Rational
8
8
  denominator: 1
9
9
  numerator: 1
10
+ check_methods:
11
+ - :check_beats_per_measure
12
+ - :check_beat_duration
10
13
  start_tempo: 120
11
14
  meter_changes: {}
12
15
  tempo_changes: {}
13
16
  parts:
14
17
  1: !ruby/object:Music::Transcription::Part
15
18
  notes:
16
- - !ruby/object:Music::Transcription::Note::DottedQuarter
17
- duration: !ruby/object:Rational
19
+ - !ruby/object:Music::Transcription::Note
20
+ duration: &4 !ruby/object:Rational
18
21
  denominator: 8
19
22
  numerator: 3
20
23
  pitches:
21
24
  - &3 !ruby/object:Music::Transcription::Pitch
22
25
  octave: 2
23
26
  semitone: 0
27
+ articulation: :normal
28
+ accented: false
24
29
  links: {}
25
- accent: &1 !ruby/class 'Music::Transcription::Accent::None'
26
- - !ruby/object:Music::Transcription::Note::Quarter
27
- duration: !ruby/object:Rational
30
+ check_methods:
31
+ - :ensure_positive_duration
32
+ - !ruby/object:Music::Transcription::Note
33
+ duration: &2 !ruby/object:Rational
28
34
  denominator: 4
29
35
  numerator: 1
30
36
  pitches:
31
- - &2 !ruby/object:Music::Transcription::Pitch
37
+ - &1 !ruby/object:Music::Transcription::Pitch
32
38
  octave: 2
33
39
  semitone: 3
40
+ articulation: :normal
41
+ accented: false
34
42
  links: {}
35
- accent: *1
43
+ check_methods:
44
+ - :ensure_positive_duration
36
45
  - !ruby/object:Music::Transcription::Note
37
46
  duration: !ruby/object:Rational
38
47
  denominator: 16
39
48
  numerator: 5
40
49
  pitches:
41
- - &4 !ruby/object:Music::Transcription::Pitch
50
+ - &5 !ruby/object:Music::Transcription::Pitch
42
51
  octave: 2
43
52
  semitone: 5
53
+ articulation: :normal
54
+ accented: false
44
55
  links: {}
45
- accent: *1
56
+ check_methods:
57
+ - :ensure_positive_duration
46
58
  - !ruby/object:Music::Transcription::Note
47
59
  duration: !ruby/object:Rational
48
60
  denominator: 16
49
61
  numerator: 1
50
62
  pitches:
51
- - *2
63
+ - *1
64
+ articulation: :normal
65
+ accented: false
52
66
  links: {}
53
- accent: *1
54
- - !ruby/object:Music::Transcription::Note::Eighth
55
- duration: !ruby/object:Rational
67
+ check_methods:
68
+ - :ensure_positive_duration
69
+ - !ruby/object:Music::Transcription::Note
70
+ duration: &6 !ruby/object:Rational
56
71
  denominator: 8
57
72
  numerator: 1
58
73
  pitches: []
74
+ articulation: :normal
75
+ accented: false
59
76
  links: {}
60
- accent: *1
61
- - !ruby/object:Music::Transcription::Note::Quarter
62
- duration: !ruby/object:Rational
63
- denominator: 4
64
- numerator: 1
77
+ check_methods:
78
+ - :ensure_positive_duration
79
+ - !ruby/object:Music::Transcription::Note
80
+ duration: *2
65
81
  pitches:
66
82
  - *3
83
+ articulation: :normal
84
+ accented: false
67
85
  links: {}
68
- accent: *1
69
- - !ruby/object:Music::Transcription::Note::Quarter
70
- duration: !ruby/object:Rational
71
- denominator: 4
72
- numerator: 1
86
+ check_methods:
87
+ - :ensure_positive_duration
88
+ - !ruby/object:Music::Transcription::Note
89
+ duration: *2
73
90
  pitches:
74
- - *2
91
+ - *1
92
+ articulation: :normal
93
+ accented: false
75
94
  links: {}
76
- accent: *1
77
- - !ruby/object:Music::Transcription::Note::DottedQuarter
78
- duration: !ruby/object:Rational
79
- denominator: 8
80
- numerator: 3
95
+ check_methods:
96
+ - :ensure_positive_duration
97
+ - !ruby/object:Music::Transcription::Note
98
+ duration: *4
81
99
  pitches: []
100
+ articulation: :normal
101
+ accented: false
82
102
  links: {}
83
- accent: *1
84
- - !ruby/object:Music::Transcription::Note::DottedQuarter
85
- duration: !ruby/object:Rational
86
- denominator: 8
87
- numerator: 3
103
+ check_methods:
104
+ - :ensure_positive_duration
105
+ - !ruby/object:Music::Transcription::Note
106
+ duration: *4
88
107
  pitches:
89
108
  - *3
109
+ articulation: :normal
110
+ accented: false
90
111
  links: {}
91
- accent: *1
92
- - !ruby/object:Music::Transcription::Note::Quarter
93
- duration: !ruby/object:Rational
94
- denominator: 4
95
- numerator: 1
112
+ check_methods:
113
+ - :ensure_positive_duration
114
+ - !ruby/object:Music::Transcription::Note
115
+ duration: *2
96
116
  pitches:
97
- - *2
117
+ - *1
118
+ articulation: :normal
119
+ accented: false
98
120
  links: {}
99
- accent: *1
121
+ check_methods:
122
+ - :ensure_positive_duration
100
123
  - !ruby/object:Music::Transcription::Note
101
124
  duration: !ruby/object:Rational
102
125
  denominator: 16
103
126
  numerator: 5
104
127
  pitches:
105
- - *4
128
+ - *5
129
+ articulation: :normal
130
+ accented: false
106
131
  links: {}
107
- accent: *1
132
+ check_methods:
133
+ - :ensure_positive_duration
108
134
  - !ruby/object:Music::Transcription::Note
109
135
  duration: !ruby/object:Rational
110
136
  denominator: 16
111
137
  numerator: 1
112
138
  pitches:
113
- - *2
139
+ - *1
140
+ articulation: :normal
141
+ accented: false
114
142
  links: {}
115
- accent: *1
116
- - !ruby/object:Music::Transcription::Note::Eighth
117
- duration: !ruby/object:Rational
118
- denominator: 8
119
- numerator: 1
143
+ check_methods:
144
+ - :ensure_positive_duration
145
+ - !ruby/object:Music::Transcription::Note
146
+ duration: *6
120
147
  pitches: []
148
+ articulation: :normal
149
+ accented: false
121
150
  links: {}
122
- accent: *1
123
- - !ruby/object:Music::Transcription::Note::Quarter
124
- duration: !ruby/object:Rational
125
- denominator: 4
126
- numerator: 1
151
+ check_methods:
152
+ - :ensure_positive_duration
153
+ - !ruby/object:Music::Transcription::Note
154
+ duration: *2
127
155
  pitches:
128
156
  - *3
157
+ articulation: :normal
158
+ accented: false
129
159
  links: {}
130
- accent: *1
131
- - !ruby/object:Music::Transcription::Note::Quarter
132
- duration: !ruby/object:Rational
133
- denominator: 4
134
- numerator: 1
160
+ check_methods:
161
+ - :ensure_positive_duration
162
+ - !ruby/object:Music::Transcription::Note
163
+ duration: *2
135
164
  pitches:
136
- - *2
165
+ - *1
166
+ articulation: :normal
167
+ accented: false
137
168
  links: {}
138
- accent: *1
139
- start_dynamic: &13 !ruby/object:Music::Transcription::Dynamic::MezzoForte {}
169
+ check_methods:
170
+ - :ensure_positive_duration
171
+ start_dynamic: 0.625
140
172
  dynamic_changes: {}
173
+ check_methods:
174
+ - :ensure_start_dynamic
175
+ - :ensure_dynamic_change_values_range
141
176
  2: !ruby/object:Music::Transcription::Part
142
177
  notes:
143
- - !ruby/object:Music::Transcription::Note::Eighth
144
- duration: !ruby/object:Rational
145
- denominator: 8
146
- numerator: 1
178
+ - !ruby/object:Music::Transcription::Note
179
+ duration: *6
147
180
  pitches: []
181
+ articulation: :normal
182
+ accented: false
148
183
  links: {}
149
- accent: *1
150
- - !ruby/object:Music::Transcription::Note::Eighth
151
- duration: !ruby/object:Rational
152
- denominator: 8
153
- numerator: 1
184
+ check_methods:
185
+ - :ensure_positive_duration
186
+ - !ruby/object:Music::Transcription::Note
187
+ duration: *6
154
188
  pitches:
155
- - &5 !ruby/object:Music::Transcription::Pitch
189
+ - &7 !ruby/object:Music::Transcription::Pitch
156
190
  octave: 3
157
191
  semitone: 10
192
+ articulation: :normal
193
+ accented: false
158
194
  links: {}
159
- accent: *1
160
- - !ruby/object:Music::Transcription::Note::Eighth
161
- duration: !ruby/object:Rational
162
- denominator: 8
163
- numerator: 1
195
+ check_methods:
196
+ - :ensure_positive_duration
197
+ - !ruby/object:Music::Transcription::Note
198
+ duration: *6
164
199
  pitches:
165
- - *5
200
+ - *7
201
+ articulation: :normal
202
+ accented: false
166
203
  links: {}
167
- accent: *1
168
- - !ruby/object:Music::Transcription::Note::Eighth
169
- duration: !ruby/object:Rational
170
- denominator: 8
171
- numerator: 1
204
+ check_methods:
205
+ - :ensure_positive_duration
206
+ - !ruby/object:Music::Transcription::Note
207
+ duration: *6
172
208
  pitches:
173
- - *5
209
+ - *7
210
+ articulation: :normal
211
+ accented: false
174
212
  links: {}
175
- accent: *1
176
- - !ruby/object:Music::Transcription::Note::Eighth
177
- duration: !ruby/object:Rational
178
- denominator: 8
179
- numerator: 1
213
+ check_methods:
214
+ - :ensure_positive_duration
215
+ - !ruby/object:Music::Transcription::Note
216
+ duration: *6
180
217
  pitches:
181
- - *5
218
+ - *7
219
+ articulation: :normal
220
+ accented: false
182
221
  links: {}
183
- accent: *1
184
- - !ruby/object:Music::Transcription::Note::Quarter
185
- duration: !ruby/object:Rational
186
- denominator: 4
187
- numerator: 1
222
+ check_methods:
223
+ - :ensure_positive_duration
224
+ - !ruby/object:Music::Transcription::Note
225
+ duration: *2
188
226
  pitches:
189
- - &9 !ruby/object:Music::Transcription::Pitch
227
+ - &10 !ruby/object:Music::Transcription::Pitch
190
228
  octave: 4
191
229
  semitone: 0
230
+ articulation: :normal
231
+ accented: false
192
232
  links: {}
193
- accent: *1
194
- - !ruby/object:Music::Transcription::Note::Quarter
195
- duration: !ruby/object:Rational
196
- denominator: 4
197
- numerator: 1
233
+ check_methods:
234
+ - :ensure_positive_duration
235
+ - !ruby/object:Music::Transcription::Note
236
+ duration: *2
198
237
  pitches:
199
- - &10 !ruby/object:Music::Transcription::Pitch
238
+ - &11 !ruby/object:Music::Transcription::Pitch
200
239
  octave: 3
201
240
  semitone: 9
241
+ articulation: :normal
242
+ accented: false
202
243
  links: {}
203
- accent: *1
204
- - !ruby/object:Music::Transcription::Note::Eighth
205
- duration: !ruby/object:Rational
206
- denominator: 8
207
- numerator: 1
244
+ check_methods:
245
+ - :ensure_positive_duration
246
+ - !ruby/object:Music::Transcription::Note
247
+ duration: *6
208
248
  pitches:
209
- - &6 !ruby/object:Music::Transcription::Pitch
249
+ - &8 !ruby/object:Music::Transcription::Pitch
210
250
  octave: 3
211
251
  semitone: 7
252
+ articulation: :normal
253
+ accented: false
212
254
  links: {}
213
- accent: *1
214
- - !ruby/object:Music::Transcription::Note::Eighth
215
- duration: !ruby/object:Rational
216
- denominator: 8
217
- numerator: 1
255
+ check_methods:
256
+ - :ensure_positive_duration
257
+ - !ruby/object:Music::Transcription::Note
258
+ duration: *6
218
259
  pitches:
219
- - &7 !ruby/object:Music::Transcription::Pitch
260
+ - &9 !ruby/object:Music::Transcription::Pitch
220
261
  octave: 3
221
262
  semitone: 5
263
+ articulation: :normal
264
+ accented: false
222
265
  links: {}
223
- accent: *1
266
+ check_methods:
267
+ - :ensure_positive_duration
224
268
  - !ruby/object:Music::Transcription::Note
225
269
  duration: !ruby/object:Rational
226
270
  denominator: 16
227
271
  numerator: 5
228
272
  pitches:
229
- - *6
230
- links:
231
- *6: !ruby/object:Music::Transcription::Link::Slur
232
- target_pitch: *7
233
- accent: *1
273
+ - *8
274
+ articulation: :slur
275
+ accented: false
276
+ links: {}
277
+ check_methods:
278
+ - :ensure_positive_duration
234
279
  - !ruby/object:Music::Transcription::Note
235
280
  duration: !ruby/object:Rational
236
281
  denominator: 16
237
282
  numerator: 1
238
283
  pitches:
239
- - *7
240
- links:
241
- *7: !ruby/object:Music::Transcription::Link::Slur
242
- target_pitch: &8 !ruby/object:Music::Transcription::Pitch
243
- octave: 3
244
- semitone: 4
245
- accent: *1
246
- - !ruby/object:Music::Transcription::Note::Eighth
247
- duration: !ruby/object:Rational
248
- denominator: 8
249
- numerator: 1
284
+ - *9
285
+ articulation: :slur
286
+ accented: false
287
+ links: {}
288
+ check_methods:
289
+ - :ensure_positive_duration
290
+ - !ruby/object:Music::Transcription::Note
291
+ duration: *6
250
292
  pitches:
251
- - *8
293
+ - !ruby/object:Music::Transcription::Pitch
294
+ octave: 3
295
+ semitone: 4
296
+ articulation: :normal
297
+ accented: false
252
298
  links: {}
253
- accent: *1
254
- - !ruby/object:Music::Transcription::Note::Eighth
255
- duration: !ruby/object:Rational
256
- denominator: 8
257
- numerator: 1
299
+ check_methods:
300
+ - :ensure_positive_duration
301
+ - !ruby/object:Music::Transcription::Note
302
+ duration: *6
258
303
  pitches: []
304
+ articulation: :normal
305
+ accented: false
259
306
  links: {}
260
- accent: *1
261
- - !ruby/object:Music::Transcription::Note::Eighth
262
- duration: !ruby/object:Rational
263
- denominator: 8
264
- numerator: 1
307
+ check_methods:
308
+ - :ensure_positive_duration
309
+ - !ruby/object:Music::Transcription::Note
310
+ duration: *6
265
311
  pitches: []
312
+ articulation: :normal
313
+ accented: false
266
314
  links: {}
267
- accent: *1
268
- - !ruby/object:Music::Transcription::Note::Eighth
269
- duration: !ruby/object:Rational
270
- denominator: 8
271
- numerator: 1
315
+ check_methods:
316
+ - :ensure_positive_duration
317
+ - !ruby/object:Music::Transcription::Note
318
+ duration: *6
272
319
  pitches:
273
- - *5
320
+ - *7
321
+ articulation: :normal
322
+ accented: false
274
323
  links: {}
275
- accent: *1
276
- - !ruby/object:Music::Transcription::Note::Eighth
277
- duration: !ruby/object:Rational
278
- denominator: 8
279
- numerator: 1
324
+ check_methods:
325
+ - :ensure_positive_duration
326
+ - !ruby/object:Music::Transcription::Note
327
+ duration: *6
280
328
  pitches:
281
- - *5
329
+ - *7
330
+ articulation: :normal
331
+ accented: false
282
332
  links: {}
283
- accent: *1
284
- - !ruby/object:Music::Transcription::Note::Eighth
285
- duration: !ruby/object:Rational
286
- denominator: 8
287
- numerator: 1
333
+ check_methods:
334
+ - :ensure_positive_duration
335
+ - !ruby/object:Music::Transcription::Note
336
+ duration: *6
288
337
  pitches:
289
- - *5
338
+ - *7
339
+ articulation: :normal
340
+ accented: false
290
341
  links: {}
291
- accent: *1
292
- - !ruby/object:Music::Transcription::Note::Eighth
293
- duration: !ruby/object:Rational
294
- denominator: 8
295
- numerator: 1
342
+ check_methods:
343
+ - :ensure_positive_duration
344
+ - !ruby/object:Music::Transcription::Note
345
+ duration: *6
296
346
  pitches:
297
- - *5
347
+ - *7
348
+ articulation: :normal
349
+ accented: false
298
350
  links: {}
299
- accent: *1
300
- - !ruby/object:Music::Transcription::Note::Quarter
301
- duration: !ruby/object:Rational
302
- denominator: 4
303
- numerator: 1
351
+ check_methods:
352
+ - :ensure_positive_duration
353
+ - !ruby/object:Music::Transcription::Note
354
+ duration: *2
304
355
  pitches:
305
- - *9
356
+ - *10
357
+ articulation: :normal
358
+ accented: false
306
359
  links: {}
307
- accent: *1
308
- - !ruby/object:Music::Transcription::Note::Eighth
309
- duration: !ruby/object:Rational
310
- denominator: 8
311
- numerator: 1
360
+ check_methods:
361
+ - :ensure_positive_duration
362
+ - !ruby/object:Music::Transcription::Note
363
+ duration: *6
312
364
  pitches:
313
- - *10
365
+ - *11
366
+ articulation: :normal
367
+ accented: false
314
368
  links: {}
315
- accent: *1
316
- - !ruby/object:Music::Transcription::Note::Eighth
317
- duration: !ruby/object:Rational
318
- denominator: 8
319
- numerator: 1
369
+ check_methods:
370
+ - :ensure_positive_duration
371
+ - !ruby/object:Music::Transcription::Note
372
+ duration: *6
320
373
  pitches:
321
- - &11 !ruby/object:Music::Transcription::Pitch
374
+ - &12 !ruby/object:Music::Transcription::Pitch
322
375
  octave: 4
323
376
  semitone: 4
377
+ articulation: :normal
378
+ accented: false
324
379
  links: {}
325
- accent: *1
326
- - !ruby/object:Music::Transcription::Note::Eighth
327
- duration: !ruby/object:Rational
328
- denominator: 8
329
- numerator: 1
330
- pitches:
331
- - *11
332
- links:
333
- *11: !ruby/object:Music::Transcription::Link::Slur
334
- target_pitch: &12 !ruby/object:Music::Transcription::Pitch
335
- octave: 4
336
- semitone: 2
337
- accent: *1
338
- - !ruby/object:Music::Transcription::Note::Eighth
339
- duration: !ruby/object:Rational
340
- denominator: 8
341
- numerator: 1
380
+ check_methods:
381
+ - :ensure_positive_duration
382
+ - !ruby/object:Music::Transcription::Note
383
+ duration: *6
342
384
  pitches:
343
385
  - *12
344
- links:
345
- *12: !ruby/object:Music::Transcription::Link::Slur
346
- target_pitch: *9
347
- accent: *1
348
- - !ruby/object:Music::Transcription::Note::Eighth
349
- duration: !ruby/object:Rational
350
- denominator: 8
351
- numerator: 1
386
+ articulation: :slur
387
+ accented: false
388
+ links: {}
389
+ check_methods:
390
+ - :ensure_positive_duration
391
+ - !ruby/object:Music::Transcription::Note
392
+ duration: *6
352
393
  pitches:
353
- - *9
394
+ - !ruby/object:Music::Transcription::Pitch
395
+ octave: 4
396
+ semitone: 2
397
+ articulation: :slur
398
+ accented: false
399
+ links: {}
400
+ check_methods:
401
+ - :ensure_positive_duration
402
+ - !ruby/object:Music::Transcription::Note
403
+ duration: *6
404
+ pitches:
405
+ - *10
406
+ articulation: :normal
407
+ accented: false
354
408
  links: {}
355
- accent: *1
356
- start_dynamic: *13
409
+ check_methods:
410
+ - :ensure_positive_duration
411
+ start_dynamic: 0.625
357
412
  dynamic_changes: {}
413
+ check_methods:
414
+ - :ensure_start_dynamic
415
+ - :ensure_dynamic_change_values_range
358
416
  program: !ruby/object:Music::Transcription::Program
359
417
  segments:
360
418
  - !ruby/range
@@ -365,3 +423,10 @@ program: !ruby/object:Music::Transcription::Program
365
423
  begin: 0
366
424
  end: 4.0
367
425
  excl: true
426
+ check_methods:
427
+ - :ensure_increasing_segments
428
+ - :ensure_nonnegative_segments
429
+ check_methods:
430
+ - :check_start_tempo
431
+ - :check_tempo_changes
432
+ - :check_meter_changes