music-transcription 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/.document +3 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +1 -0
  4. data/.yardopts +1 -0
  5. data/ChangeLog.rdoc +4 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.rdoc +28 -0
  9. data/Rakefile +54 -0
  10. data/bin/transcribe +176 -0
  11. data/lib/music-transcription.rb +20 -0
  12. data/lib/music-transcription/arrangement.rb +31 -0
  13. data/lib/music-transcription/instrument_config.rb +38 -0
  14. data/lib/music-transcription/interval.rb +66 -0
  15. data/lib/music-transcription/link.rb +115 -0
  16. data/lib/music-transcription/note.rb +156 -0
  17. data/lib/music-transcription/part.rb +128 -0
  18. data/lib/music-transcription/pitch.rb +297 -0
  19. data/lib/music-transcription/pitch_constants.rb +204 -0
  20. data/lib/music-transcription/profile.rb +105 -0
  21. data/lib/music-transcription/program.rb +136 -0
  22. data/lib/music-transcription/score.rb +122 -0
  23. data/lib/music-transcription/tempo.rb +44 -0
  24. data/lib/music-transcription/transition.rb +71 -0
  25. data/lib/music-transcription/value_change.rb +85 -0
  26. data/lib/music-transcription/version.rb +7 -0
  27. data/music-transcription.gemspec +36 -0
  28. data/samples/arrangements/glissando_test.yml +71 -0
  29. data/samples/arrangements/hip.yml +952 -0
  30. data/samples/arrangements/instrument_test.yml +119 -0
  31. data/samples/arrangements/legato_test.yml +237 -0
  32. data/samples/arrangements/make_glissando_test.rb +27 -0
  33. data/samples/arrangements/make_hip.rb +75 -0
  34. data/samples/arrangements/make_instrument_test.rb +34 -0
  35. data/samples/arrangements/make_legato_test.rb +37 -0
  36. data/samples/arrangements/make_missed_connection.rb +72 -0
  37. data/samples/arrangements/make_portamento_test.rb +27 -0
  38. data/samples/arrangements/make_slur_test.rb +37 -0
  39. data/samples/arrangements/make_song1.rb +84 -0
  40. data/samples/arrangements/make_song2.rb +69 -0
  41. data/samples/arrangements/missed_connection.yml +481 -0
  42. data/samples/arrangements/portamento_test.yml +71 -0
  43. data/samples/arrangements/slur_test.yml +237 -0
  44. data/samples/arrangements/song1.yml +640 -0
  45. data/samples/arrangements/song2.yml +429 -0
  46. data/spec/instrument_config_spec.rb +47 -0
  47. data/spec/interval_spec.rb +38 -0
  48. data/spec/link_spec.rb +22 -0
  49. data/spec/musicality_spec.rb +7 -0
  50. data/spec/note_spec.rb +65 -0
  51. data/spec/part_spec.rb +87 -0
  52. data/spec/pitch_spec.rb +139 -0
  53. data/spec/profile_spec.rb +24 -0
  54. data/spec/program_spec.rb +55 -0
  55. data/spec/score_spec.rb +55 -0
  56. data/spec/spec_helper.rb +23 -0
  57. data/spec/transition_spec.rb +13 -0
  58. data/spec/value_change_spec.rb +19 -0
  59. metadata +239 -0
@@ -0,0 +1,429 @@
1
+ --- !ruby/object:Music::Transcription::Arrangement
2
+ score: !ruby/object:Music::Transcription::TempoScore
3
+ tempo_profile: !ruby/object:Music::Transcription::Profile
4
+ start_value: !ruby/object:Music::Transcription::Tempo
5
+ beats_per_minute: 120
6
+ beat_duration: !ruby/object:Rational
7
+ denominator: 4
8
+ numerator: 1
9
+ value_changes: {}
10
+ parts:
11
+ 1: !ruby/object:Music::Transcription::Part
12
+ offset: 0
13
+ loudness_profile: !ruby/object:Music::Transcription::Profile
14
+ start_value: 0.5
15
+ value_changes: {}
16
+ notes:
17
+ - !ruby/object:Music::Transcription::Note
18
+ duration: 1.0
19
+ intervals:
20
+ - !ruby/object:Music::Transcription::Interval
21
+ pitch: !ruby/object:Music::Transcription::Pitch
22
+ cents_per_octave: 1200
23
+ octave: 4
24
+ semitone: 0
25
+ cent: 0
26
+ base_freq: 16.351597831287414
27
+ link: !ruby/object:Music::Transcription::Link
28
+ target_pitch: !ruby/object:Music::Transcription::Pitch
29
+ cents_per_octave: 1200
30
+ octave: 0
31
+ semitone: 0
32
+ cent: 0
33
+ base_freq: 16.351597831287414
34
+ relationship: :none
35
+ sustain: 0.5
36
+ attack: 0.5
37
+ separation: 0.5
38
+ - !ruby/object:Music::Transcription::Note
39
+ duration: 1.0
40
+ intervals:
41
+ - !ruby/object:Music::Transcription::Interval
42
+ pitch: &17452560 !ruby/object:Music::Transcription::Pitch
43
+ cents_per_octave: 1200
44
+ octave: 3
45
+ semitone: 10
46
+ cent: 0
47
+ base_freq: 16.351597831287414
48
+ link: !ruby/object:Music::Transcription::Link
49
+ target_pitch: !ruby/object:Music::Transcription::Pitch
50
+ cents_per_octave: 1200
51
+ octave: 0
52
+ semitone: 0
53
+ cent: 0
54
+ base_freq: 16.351597831287414
55
+ relationship: :none
56
+ sustain: 0.5
57
+ attack: 0.5
58
+ separation: 0.5
59
+ - !ruby/object:Music::Transcription::Note
60
+ duration: 1.0
61
+ intervals:
62
+ - !ruby/object:Music::Transcription::Interval
63
+ pitch: !ruby/object:Music::Transcription::Pitch
64
+ cents_per_octave: 1200
65
+ octave: 3
66
+ semitone: 8
67
+ cent: 0
68
+ base_freq: 16.351597831287414
69
+ link: !ruby/object:Music::Transcription::Link
70
+ target_pitch: !ruby/object:Music::Transcription::Pitch
71
+ cents_per_octave: 1200
72
+ octave: 0
73
+ semitone: 0
74
+ cent: 0
75
+ base_freq: 16.351597831287414
76
+ relationship: :none
77
+ sustain: 0.5
78
+ attack: 0.5
79
+ separation: 0.5
80
+ - !ruby/object:Music::Transcription::Note
81
+ duration: 0.5
82
+ intervals:
83
+ - !ruby/object:Music::Transcription::Interval
84
+ pitch: !ruby/object:Music::Transcription::Pitch
85
+ cents_per_octave: 1200
86
+ octave: 3
87
+ semitone: 7
88
+ cent: 0
89
+ base_freq: 16.351597831287414
90
+ link: !ruby/object:Music::Transcription::Link
91
+ target_pitch: !ruby/object:Music::Transcription::Pitch
92
+ cents_per_octave: 1200
93
+ octave: 0
94
+ semitone: 0
95
+ cent: 0
96
+ base_freq: 16.351597831287414
97
+ relationship: :none
98
+ sustain: 0.5
99
+ attack: 0.5
100
+ separation: 0.5
101
+ - !ruby/object:Music::Transcription::Note
102
+ duration: 0.5
103
+ intervals:
104
+ - !ruby/object:Music::Transcription::Interval
105
+ pitch: *17452560
106
+ link: !ruby/object:Music::Transcription::Link
107
+ target_pitch: !ruby/object:Music::Transcription::Pitch
108
+ cents_per_octave: 1200
109
+ octave: 0
110
+ semitone: 0
111
+ cent: 0
112
+ base_freq: 16.351597831287414
113
+ relationship: :none
114
+ sustain: 0.5
115
+ attack: 0.5
116
+ separation: 0.5
117
+ 2: !ruby/object:Music::Transcription::Part
118
+ offset: 0
119
+ loudness_profile: !ruby/object:Music::Transcription::Profile
120
+ start_value: 0.5
121
+ value_changes: {}
122
+ notes:
123
+ - !ruby/object:Music::Transcription::Note
124
+ duration: 0.375
125
+ intervals:
126
+ - !ruby/object:Music::Transcription::Interval
127
+ pitch: !ruby/object:Music::Transcription::Pitch
128
+ cents_per_octave: 1200
129
+ octave: 5
130
+ semitone: 4
131
+ cent: 0
132
+ base_freq: 16.351597831287414
133
+ link: !ruby/object:Music::Transcription::Link
134
+ target_pitch: !ruby/object:Music::Transcription::Pitch
135
+ cents_per_octave: 1200
136
+ octave: 0
137
+ semitone: 0
138
+ cent: 0
139
+ base_freq: 16.351597831287414
140
+ relationship: :none
141
+ sustain: 0.5
142
+ attack: 0.5
143
+ separation: 0.5
144
+ - !ruby/object:Music::Transcription::Note
145
+ duration: 1.0
146
+ intervals:
147
+ - !ruby/object:Music::Transcription::Interval
148
+ pitch: &17443640 !ruby/object:Music::Transcription::Pitch
149
+ cents_per_octave: 1200
150
+ octave: 5
151
+ semitone: 2
152
+ cent: 0
153
+ base_freq: 16.351597831287414
154
+ link: !ruby/object:Music::Transcription::Link
155
+ target_pitch: !ruby/object:Music::Transcription::Pitch
156
+ cents_per_octave: 1200
157
+ octave: 0
158
+ semitone: 0
159
+ cent: 0
160
+ base_freq: 16.351597831287414
161
+ relationship: :none
162
+ sustain: 0.5
163
+ attack: 0.5
164
+ separation: 0.5
165
+ - !ruby/object:Music::Transcription::Note
166
+ duration: 1.0
167
+ intervals:
168
+ - !ruby/object:Music::Transcription::Interval
169
+ pitch: &17444700 !ruby/object:Music::Transcription::Pitch
170
+ cents_per_octave: 1200
171
+ octave: 5
172
+ semitone: 0
173
+ cent: 0
174
+ base_freq: 16.351597831287414
175
+ link: !ruby/object:Music::Transcription::Link
176
+ target_pitch: !ruby/object:Music::Transcription::Pitch
177
+ cents_per_octave: 1200
178
+ octave: 0
179
+ semitone: 0
180
+ cent: 0
181
+ base_freq: 16.351597831287414
182
+ relationship: :none
183
+ sustain: 0.5
184
+ attack: 0.5
185
+ separation: 0.5
186
+ - !ruby/object:Music::Transcription::Note
187
+ duration: 0.625
188
+ intervals:
189
+ - !ruby/object:Music::Transcription::Interval
190
+ pitch: *17444700
191
+ link: !ruby/object:Music::Transcription::Link
192
+ target_pitch: !ruby/object:Music::Transcription::Pitch
193
+ cents_per_octave: 1200
194
+ octave: 0
195
+ semitone: 0
196
+ cent: 0
197
+ base_freq: 16.351597831287414
198
+ relationship: :none
199
+ sustain: 0.5
200
+ attack: 0.5
201
+ separation: 0.5
202
+ - !ruby/object:Music::Transcription::Note
203
+ duration: 0.5
204
+ intervals:
205
+ - !ruby/object:Music::Transcription::Interval
206
+ pitch: *17444700
207
+ link: !ruby/object:Music::Transcription::Link
208
+ target_pitch: !ruby/object:Music::Transcription::Pitch
209
+ cents_per_octave: 1200
210
+ octave: 0
211
+ semitone: 0
212
+ cent: 0
213
+ base_freq: 16.351597831287414
214
+ relationship: :none
215
+ sustain: 0.5
216
+ attack: 0.5
217
+ separation: 0.5
218
+ - !ruby/object:Music::Transcription::Note
219
+ duration: 0.5
220
+ intervals:
221
+ - !ruby/object:Music::Transcription::Interval
222
+ pitch: *17443640
223
+ link: !ruby/object:Music::Transcription::Link
224
+ target_pitch: !ruby/object:Music::Transcription::Pitch
225
+ cents_per_octave: 1200
226
+ octave: 0
227
+ semitone: 0
228
+ cent: 0
229
+ base_freq: 16.351597831287414
230
+ relationship: :none
231
+ sustain: 0.5
232
+ attack: 0.5
233
+ separation: 0.5
234
+ 3: !ruby/object:Music::Transcription::Part
235
+ offset: 0
236
+ loudness_profile: !ruby/object:Music::Transcription::Profile
237
+ start_value: 0.5
238
+ value_changes: {}
239
+ notes:
240
+ - !ruby/object:Music::Transcription::Note
241
+ duration: 0.125
242
+ intervals: []
243
+ sustain: 0.5
244
+ attack: 0.5
245
+ separation: 0.5
246
+ - !ruby/object:Music::Transcription::Note
247
+ duration: 0.25
248
+ intervals:
249
+ - !ruby/object:Music::Transcription::Interval
250
+ pitch: !ruby/object:Music::Transcription::Pitch
251
+ cents_per_octave: 1200
252
+ octave: 5
253
+ semitone: 7
254
+ cent: 0
255
+ base_freq: 16.351597831287414
256
+ link: !ruby/object:Music::Transcription::Link
257
+ target_pitch: !ruby/object:Music::Transcription::Pitch
258
+ cents_per_octave: 1200
259
+ octave: 0
260
+ semitone: 0
261
+ cent: 0
262
+ base_freq: 16.351597831287414
263
+ relationship: :none
264
+ sustain: 0.5
265
+ attack: 0.5
266
+ separation: 0.5
267
+ - !ruby/object:Music::Transcription::Note
268
+ duration: 0.5
269
+ intervals:
270
+ - !ruby/object:Music::Transcription::Interval
271
+ pitch: &17441680 !ruby/object:Music::Transcription::Pitch
272
+ cents_per_octave: 1200
273
+ octave: 5
274
+ semitone: 5
275
+ cent: 0
276
+ base_freq: 16.351597831287414
277
+ link: !ruby/object:Music::Transcription::Link
278
+ target_pitch: !ruby/object:Music::Transcription::Pitch
279
+ cents_per_octave: 1200
280
+ octave: 0
281
+ semitone: 0
282
+ cent: 0
283
+ base_freq: 16.351597831287414
284
+ relationship: :none
285
+ sustain: 0.5
286
+ attack: 0.5
287
+ separation: 0.5
288
+ - !ruby/object:Music::Transcription::Note
289
+ duration: 0.25
290
+ intervals: []
291
+ sustain: 0.5
292
+ attack: 0.5
293
+ separation: 0.5
294
+ - !ruby/object:Music::Transcription::Note
295
+ duration: 0.25
296
+ intervals:
297
+ - !ruby/object:Music::Transcription::Interval
298
+ pitch: *17441680
299
+ link: !ruby/object:Music::Transcription::Link
300
+ target_pitch: !ruby/object:Music::Transcription::Pitch
301
+ cents_per_octave: 1200
302
+ octave: 0
303
+ semitone: 0
304
+ cent: 0
305
+ base_freq: 16.351597831287414
306
+ relationship: :none
307
+ sustain: 0.5
308
+ attack: 0.5
309
+ separation: 0.5
310
+ - !ruby/object:Music::Transcription::Note
311
+ duration: 0.5
312
+ intervals:
313
+ - !ruby/object:Music::Transcription::Interval
314
+ pitch: &17442940 !ruby/object:Music::Transcription::Pitch
315
+ cents_per_octave: 1200
316
+ octave: 5
317
+ semitone: 3
318
+ cent: 0
319
+ base_freq: 16.351597831287414
320
+ link: !ruby/object:Music::Transcription::Link
321
+ target_pitch: !ruby/object:Music::Transcription::Pitch
322
+ cents_per_octave: 1200
323
+ octave: 0
324
+ semitone: 0
325
+ cent: 0
326
+ base_freq: 16.351597831287414
327
+ relationship: :none
328
+ sustain: 0.5
329
+ attack: 0.5
330
+ separation: 0.5
331
+ - !ruby/object:Music::Transcription::Note
332
+ duration: 0.25
333
+ intervals: []
334
+ sustain: 0.5
335
+ attack: 0.5
336
+ separation: 0.5
337
+ - !ruby/object:Music::Transcription::Note
338
+ duration: 0.25
339
+ intervals:
340
+ - !ruby/object:Music::Transcription::Interval
341
+ pitch: *17442940
342
+ link: !ruby/object:Music::Transcription::Link
343
+ target_pitch: !ruby/object:Music::Transcription::Pitch
344
+ cents_per_octave: 1200
345
+ octave: 0
346
+ semitone: 0
347
+ cent: 0
348
+ base_freq: 16.351597831287414
349
+ relationship: :none
350
+ sustain: 0.5
351
+ attack: 0.5
352
+ separation: 0.5
353
+ - !ruby/object:Music::Transcription::Note
354
+ duration: 0.5
355
+ intervals:
356
+ - !ruby/object:Music::Transcription::Interval
357
+ pitch: *17442940
358
+ link: !ruby/object:Music::Transcription::Link
359
+ target_pitch: !ruby/object:Music::Transcription::Pitch
360
+ cents_per_octave: 1200
361
+ octave: 0
362
+ semitone: 0
363
+ cent: 0
364
+ base_freq: 16.351597831287414
365
+ relationship: :none
366
+ sustain: 0.5
367
+ attack: 0.5
368
+ separation: 0.5
369
+ - !ruby/object:Music::Transcription::Note
370
+ duration: 0.125
371
+ intervals: []
372
+ sustain: 0.5
373
+ attack: 0.5
374
+ separation: 0.5
375
+ - !ruby/object:Music::Transcription::Note
376
+ duration: 0.5
377
+ intervals:
378
+ - !ruby/object:Music::Transcription::Interval
379
+ pitch: *17442940
380
+ link: !ruby/object:Music::Transcription::Link
381
+ target_pitch: !ruby/object:Music::Transcription::Pitch
382
+ cents_per_octave: 1200
383
+ octave: 0
384
+ semitone: 0
385
+ cent: 0
386
+ base_freq: 16.351597831287414
387
+ relationship: :none
388
+ sustain: 0.5
389
+ attack: 0.5
390
+ separation: 0.5
391
+ - !ruby/object:Music::Transcription::Note
392
+ duration: 0.5
393
+ intervals:
394
+ - !ruby/object:Music::Transcription::Interval
395
+ pitch: *17441680
396
+ link: !ruby/object:Music::Transcription::Link
397
+ target_pitch: !ruby/object:Music::Transcription::Pitch
398
+ cents_per_octave: 1200
399
+ octave: 0
400
+ semitone: 0
401
+ cent: 0
402
+ base_freq: 16.351597831287414
403
+ relationship: :none
404
+ sustain: 0.5
405
+ attack: 0.5
406
+ separation: 0.5
407
+ program: !ruby/object:Music::Transcription::Program
408
+ segments:
409
+ - !ruby/range
410
+ begin: 0
411
+ end: 4.0
412
+ excl: true
413
+ - !ruby/range
414
+ begin: 0
415
+ end: 4.0
416
+ excl: true
417
+ instrument_configs:
418
+ 1: !ruby/object:Music::Transcription::InstrumentConfig
419
+ plugin_name: synth_instr_3
420
+ initial_settings: blend
421
+ setting_changes: {}
422
+ 2: !ruby/object:Music::Transcription::InstrumentConfig
423
+ plugin_name: synth_instr_3
424
+ initial_settings: blend
425
+ setting_changes: {}
426
+ 3: !ruby/object:Music::Transcription::InstrumentConfig
427
+ plugin_name: synth_instr_3
428
+ initial_settings: blend
429
+ setting_changes: {}
@@ -0,0 +1,47 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe InstrumentConfig do
4
+
5
+ it "should assign the given name" do
6
+ cfg = InstrumentConfig.new :plugin_name => "MyPluginName"
7
+ cfg.plugin_name.should eq("MyPluginName")
8
+ end
9
+
10
+ it "should assign the given initial settings" do
11
+ settings = {
12
+ :volume => 0.5,
13
+ :gain => 0.75,
14
+ }
15
+ cfg = InstrumentConfig.new :plugin_name => "MyPluginName", :initial_settings => settings
16
+ cfg.initial_settings.should eq(settings)
17
+ end
18
+
19
+ it "should allow a String to be given as initial settings" do
20
+ settings = "preset A"
21
+ cfg = InstrumentConfig.new :plugin_name => "MyPluginName", :initial_settings => settings
22
+ cfg.initial_settings.should eq(settings)
23
+ end
24
+
25
+ it "should allow an Array to be given as initial settings" do
26
+ settings = ["preset A","preset B"]
27
+ cfg = InstrumentConfig.new :plugin_name => "MyPluginName", :initial_settings => settings
28
+ cfg.initial_settings.should eq(settings)
29
+ end
30
+
31
+ it "should assign each of the given setting changes" do
32
+ setting_changes = {
33
+ 1.0 => {
34
+ :volume => ValueChange.new(:value => 0.5),
35
+ :gain => ValueChange.new(:value => 0.75),
36
+ },
37
+ 4.0 => {
38
+ :volume => ValueChange.new(:value => 0.1),
39
+ :gain => ValueChange.new(:value => 0.1),
40
+ }
41
+ }
42
+
43
+ cfg = InstrumentConfig.new :plugin_name => "MyPluginName", :setting_changes => setting_changes
44
+ cfg.setting_changes.should eq(setting_changes)
45
+ end
46
+
47
+ end