music-transcription 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/examples/hip.yml +516 -0
  3. data/examples/make_hip.rb +63 -0
  4. data/examples/make_missed_connection.rb +65 -0
  5. data/examples/make_song1.rb +71 -0
  6. data/examples/make_song2.rb +58 -0
  7. data/examples/missed_connection.yml +305 -0
  8. data/examples/song1.yml +367 -0
  9. data/examples/song2.yml +236 -0
  10. data/lib/music-transcription/accent.rb +4 -15
  11. data/lib/music-transcription/accents.rb +12 -0
  12. data/lib/music-transcription/dynamic.rb +6 -15
  13. data/lib/music-transcription/meter.rb +15 -0
  14. data/lib/music-transcription/note.rb +28 -91
  15. data/lib/music-transcription/part.rb +9 -65
  16. data/lib/music-transcription/score.rb +14 -43
  17. data/lib/music-transcription/version.rb +1 -1
  18. data/lib/music-transcription.rb +2 -0
  19. data/spec/meter_spec.rb +25 -0
  20. data/spec/note_spec.rb +20 -33
  21. data/spec/part_spec.rb +13 -82
  22. data/spec/score_spec.rb +28 -16
  23. data/spec/spec_helper.rb +7 -2
  24. metadata +14 -20
  25. data/samples/arrangements/glissando_test.yml +0 -71
  26. data/samples/arrangements/hip.yml +0 -952
  27. data/samples/arrangements/instrument_test.yml +0 -119
  28. data/samples/arrangements/legato_test.yml +0 -237
  29. data/samples/arrangements/make_glissando_test.rb +0 -27
  30. data/samples/arrangements/make_hip.rb +0 -75
  31. data/samples/arrangements/make_instrument_test.rb +0 -34
  32. data/samples/arrangements/make_legato_test.rb +0 -37
  33. data/samples/arrangements/make_missed_connection.rb +0 -72
  34. data/samples/arrangements/make_portamento_test.rb +0 -27
  35. data/samples/arrangements/make_slur_test.rb +0 -37
  36. data/samples/arrangements/make_song1.rb +0 -84
  37. data/samples/arrangements/make_song2.rb +0 -69
  38. data/samples/arrangements/missed_connection.yml +0 -481
  39. data/samples/arrangements/portamento_test.yml +0 -71
  40. data/samples/arrangements/slur_test.yml +0 -237
  41. data/samples/arrangements/song1.yml +0 -640
  42. data/samples/arrangements/song2.yml +0 -429
@@ -0,0 +1,71 @@
1
+ require 'music-transcription'
2
+ require 'yaml'
3
+
4
+ include Music::Transcription
5
+ include Pitches
6
+
7
+ score = Score.new(
8
+ Meter.new(4,"1/4".to_r),
9
+ 120,
10
+ program: Program.new([ 0...4.0, 0...4.0 ]),
11
+ parts: {
12
+ 1 => Part.new(
13
+ Dynamics::MF,
14
+ notes: [
15
+ Note::DottedQuarter.new([C2]),
16
+ Note::Quarter.new([Eb2]),
17
+ Note.new("5/16".to_r,[F2]),
18
+ Note.new("1/16".to_r, [Eb2]),
19
+ # 1.0
20
+ Note::Eighth.new,
21
+ Note::Quarter.new([C2]),
22
+ Note::Quarter.new([Eb2]),
23
+ Note::DottedQuarter.new,
24
+ # 2.0
25
+ Note::DottedQuarter.new([C2]),
26
+ Note::Quarter.new([Eb2]),
27
+ Note.new("5/16".to_r,[F2]),
28
+ Note.new("1/16".to_r, [Eb2]),
29
+ # 3.0
30
+ Note::Eighth.new,
31
+ Note::Quarter.new([C2]),
32
+ Note::Quarter.new([Eb2]),
33
+ ]
34
+ ),
35
+ 2 => Part.new(
36
+ Dynamics::MF,
37
+ notes: [
38
+ # 0.0
39
+ Note::Eighth.new,
40
+ Note::Eighth.new([Bb3]),
41
+ Note::Eighth.new([Bb3]),
42
+ Note::Eighth.new([Bb3]),
43
+ Note::Eighth.new([Bb3]),
44
+ Note::Quarter.new([C4]),
45
+ Note::Quarter.new([A3]),
46
+ Note::Eighth.new([G3]),
47
+ Note::Eighth.new([F3]),
48
+ Note.new("5/16".to_r, [G3], links: { G3 => Link::Slur.new(F3) }),
49
+ Note.new("1/16".to_r, [F3], links: { F3 => Link::Slur.new(E3) }),
50
+ Note::Eighth.new([E3]),
51
+ Note::Eighth.new,
52
+ # 2.0
53
+ Note::Eighth.new,
54
+ Note::Eighth.new([Bb3]),
55
+ Note::Eighth.new([Bb3]),
56
+ Note::Eighth.new([Bb3]),
57
+ Note::Eighth.new([Bb3]),
58
+ Note::Quarter.new([C4]),
59
+ Note::Eighth.new([A3]),
60
+ Note::Eighth.new([E4]),
61
+ Note::Eighth.new([E4], links: { E4 => Link::Slur.new(D4) }),
62
+ Note::Eighth.new([D4], links: { D4 => Link::Slur.new(C4) }),
63
+ Note::Eighth.new([C4]),
64
+ ]
65
+ )
66
+ }
67
+ )
68
+
69
+ File.open("song1.yml", "w") do |file|
70
+ file.write score.to_yaml
71
+ end
@@ -0,0 +1,58 @@
1
+ require 'music-transcription'
2
+ require 'yaml'
3
+
4
+ include Music::Transcription
5
+ include Pitches
6
+
7
+ score = Score.new(
8
+ Meter.new(4,"1/4".to_r),
9
+ 120,
10
+ :program => Program.new(
11
+ :segments => [0...4.0, 0...4.0 ]
12
+ ),
13
+ :parts => {
14
+ 1 => Part.new(
15
+ Dynamics::MF,
16
+ notes: [
17
+ Note::Whole.new([C4]),
18
+ Note::Whole.new([Bb3]),
19
+ Note::Whole.new([Ab3]),
20
+ Note::Half.new([G3]),
21
+ Note::Half.new([Bb3]),
22
+ ]
23
+ ),
24
+ 2 => Part.new(
25
+ Dynamics::MF,
26
+ notes: [
27
+ Note::DottedQuarter.new([E5]),
28
+ Note::Whole.new([D5]),
29
+ Note::Whole.new([C5]),
30
+ Note::new("5/8".to_r, [C5]),
31
+ Note::Half.new([C5]),
32
+ Note::Half.new([D5]),
33
+ ]
34
+ ),
35
+ 3 => Part.new(
36
+ Dynamics::MF,
37
+ notes: [
38
+ Note::Eighth.new,
39
+ Note::Quarter.new([G5]),
40
+ Note::Half.new([F5]),
41
+ Note::Quarter.new,
42
+ Note::Quarter.new([F5]),
43
+ Note::Half.new([Eb5]),
44
+ Note::Quarter.new,
45
+ Note::Quarter.new([Eb5]),
46
+ Note::Half.new([Eb5]),
47
+ Note::Eighth.new,
48
+ Note::Half.new([Eb5]),
49
+ Note::Half.new([F5]),
50
+ ]
51
+ )
52
+ }
53
+ )
54
+
55
+ File.open("song2.yml", "w") do |file|
56
+ file.write score.to_yaml
57
+ end
58
+
@@ -0,0 +1,305 @@
1
+ --- !ruby/object:Music::Transcription::Score
2
+ start_meter: !ruby/object:Music::Transcription::Meter
3
+ beats_per_measure: 4
4
+ beat_duration: !ruby/object:Rational
5
+ denominator: 4
6
+ numerator: 1
7
+ measure_duration: !ruby/object:Rational
8
+ denominator: 1
9
+ numerator: 1
10
+ start_tempo: 120
11
+ meter_changes: {}
12
+ tempo_changes: {}
13
+ parts:
14
+ bass: !ruby/object:Music::Transcription::Part
15
+ notes:
16
+ - !ruby/object:Music::Transcription::Note::Quarter
17
+ duration: !ruby/object:Rational
18
+ denominator: 4
19
+ numerator: 1
20
+ pitches:
21
+ - &2 !ruby/object:Music::Transcription::Pitch
22
+ octave: 2
23
+ semitone: 3
24
+ links: {}
25
+ accent: &1 !ruby/class 'Music::Transcription::Accent::None'
26
+ - !ruby/object:Music::Transcription::Note::Quarter
27
+ duration: !ruby/object:Rational
28
+ denominator: 4
29
+ numerator: 1
30
+ pitches: []
31
+ links: {}
32
+ accent: *1
33
+ - !ruby/object:Music::Transcription::Note::Quarter
34
+ duration: !ruby/object:Rational
35
+ denominator: 4
36
+ numerator: 1
37
+ pitches:
38
+ - &3 !ruby/object:Music::Transcription::Pitch
39
+ octave: 2
40
+ semitone: 10
41
+ links: {}
42
+ accent: *1
43
+ - !ruby/object:Music::Transcription::Note::Quarter
44
+ duration: !ruby/object:Rational
45
+ denominator: 4
46
+ numerator: 1
47
+ pitches: []
48
+ links: {}
49
+ accent: *1
50
+ - !ruby/object:Music::Transcription::Note::Quarter
51
+ duration: !ruby/object:Rational
52
+ denominator: 4
53
+ numerator: 1
54
+ pitches:
55
+ - *2
56
+ links: {}
57
+ accent: *1
58
+ - !ruby/object:Music::Transcription::Note::Eighth
59
+ duration: !ruby/object:Rational
60
+ denominator: 8
61
+ numerator: 1
62
+ pitches: []
63
+ links: {}
64
+ accent: *1
65
+ - !ruby/object:Music::Transcription::Note::Eighth
66
+ duration: !ruby/object:Rational
67
+ denominator: 8
68
+ numerator: 1
69
+ pitches:
70
+ - &4 !ruby/object:Music::Transcription::Pitch
71
+ octave: 2
72
+ semitone: 11
73
+ links: {}
74
+ accent: *1
75
+ - !ruby/object:Music::Transcription::Note::Quarter
76
+ duration: !ruby/object:Rational
77
+ denominator: 4
78
+ numerator: 1
79
+ pitches:
80
+ - *3
81
+ links: {}
82
+ accent: *1
83
+ - !ruby/object:Music::Transcription::Note::Quarter
84
+ duration: !ruby/object:Rational
85
+ denominator: 4
86
+ numerator: 1
87
+ pitches:
88
+ - &5 !ruby/object:Music::Transcription::Pitch
89
+ octave: 2
90
+ semitone: 8
91
+ links: {}
92
+ accent: *1
93
+ - !ruby/object:Music::Transcription::Note::Quarter
94
+ duration: !ruby/object:Rational
95
+ denominator: 4
96
+ numerator: 1
97
+ pitches:
98
+ - *2
99
+ links: {}
100
+ accent: *1
101
+ - !ruby/object:Music::Transcription::Note::Quarter
102
+ duration: !ruby/object:Rational
103
+ denominator: 4
104
+ numerator: 1
105
+ pitches: []
106
+ links: {}
107
+ accent: *1
108
+ - !ruby/object:Music::Transcription::Note::Quarter
109
+ duration: !ruby/object:Rational
110
+ denominator: 4
111
+ numerator: 1
112
+ pitches:
113
+ - *3
114
+ links: {}
115
+ accent: *1
116
+ - !ruby/object:Music::Transcription::Note::Quarter
117
+ duration: !ruby/object:Rational
118
+ denominator: 4
119
+ numerator: 1
120
+ pitches: []
121
+ links: {}
122
+ accent: *1
123
+ - !ruby/object:Music::Transcription::Note::Quarter
124
+ duration: !ruby/object:Rational
125
+ denominator: 4
126
+ numerator: 1
127
+ pitches:
128
+ - *2
129
+ links: {}
130
+ accent: *1
131
+ - !ruby/object:Music::Transcription::Note::Eighth
132
+ duration: !ruby/object:Rational
133
+ denominator: 8
134
+ numerator: 1
135
+ pitches: []
136
+ links: {}
137
+ accent: *1
138
+ - !ruby/object:Music::Transcription::Note::Eighth
139
+ duration: !ruby/object:Rational
140
+ denominator: 8
141
+ numerator: 1
142
+ pitches:
143
+ - *4
144
+ links: {}
145
+ accent: *1
146
+ - !ruby/object:Music::Transcription::Note::Quarter
147
+ duration: !ruby/object:Rational
148
+ denominator: 4
149
+ numerator: 1
150
+ pitches:
151
+ - *3
152
+ links: {}
153
+ accent: *1
154
+ - !ruby/object:Music::Transcription::Note::Quarter
155
+ duration: !ruby/object:Rational
156
+ denominator: 4
157
+ numerator: 1
158
+ pitches:
159
+ - *5
160
+ links: {}
161
+ accent: *1
162
+ - !ruby/object:Music::Transcription::Note::Quarter
163
+ duration: !ruby/object:Rational
164
+ denominator: 4
165
+ numerator: 1
166
+ pitches:
167
+ - *3
168
+ links: {}
169
+ accent: *1
170
+ - !ruby/object:Music::Transcription::Note::Eighth
171
+ duration: !ruby/object:Rational
172
+ denominator: 8
173
+ numerator: 1
174
+ pitches: []
175
+ links: {}
176
+ accent: *1
177
+ - !ruby/object:Music::Transcription::Note::Eighth
178
+ duration: !ruby/object:Rational
179
+ denominator: 8
180
+ numerator: 1
181
+ pitches:
182
+ - &6 !ruby/object:Music::Transcription::Pitch
183
+ octave: 3
184
+ semitone: 5
185
+ links:
186
+ *6: !ruby/object:Music::Transcription::Link::Slur
187
+ target_pitch: *6
188
+ accent: *1
189
+ - !ruby/object:Music::Transcription::Note::Half
190
+ duration: !ruby/object:Rational
191
+ denominator: 2
192
+ numerator: 1
193
+ pitches:
194
+ - *6
195
+ links: {}
196
+ accent: *1
197
+ - !ruby/object:Music::Transcription::Note::Quarter
198
+ duration: !ruby/object:Rational
199
+ denominator: 4
200
+ numerator: 1
201
+ pitches:
202
+ - *3
203
+ links: {}
204
+ accent: *1
205
+ - !ruby/object:Music::Transcription::Note::Eighth
206
+ duration: !ruby/object:Rational
207
+ denominator: 8
208
+ numerator: 1
209
+ pitches: []
210
+ links: {}
211
+ accent: *1
212
+ - !ruby/object:Music::Transcription::Note::Eighth
213
+ duration: !ruby/object:Rational
214
+ denominator: 8
215
+ numerator: 1
216
+ pitches:
217
+ - *6
218
+ links:
219
+ *6: !ruby/object:Music::Transcription::Link::Slur
220
+ target_pitch: *6
221
+ accent: *1
222
+ - !ruby/object:Music::Transcription::Note::Half
223
+ duration: !ruby/object:Rational
224
+ denominator: 2
225
+ numerator: 1
226
+ pitches:
227
+ - *6
228
+ links: {}
229
+ accent: *1
230
+ - !ruby/object:Music::Transcription::Note::Quarter
231
+ duration: !ruby/object:Rational
232
+ denominator: 4
233
+ numerator: 1
234
+ pitches:
235
+ - *4
236
+ links: {}
237
+ accent: *1
238
+ - !ruby/object:Music::Transcription::Note::Eighth
239
+ duration: !ruby/object:Rational
240
+ denominator: 8
241
+ numerator: 1
242
+ pitches: []
243
+ links: {}
244
+ accent: *1
245
+ - !ruby/object:Music::Transcription::Note::Eighth
246
+ duration: !ruby/object:Rational
247
+ denominator: 8
248
+ numerator: 1
249
+ pitches:
250
+ - &7 !ruby/object:Music::Transcription::Pitch
251
+ octave: 3
252
+ semitone: 6
253
+ links:
254
+ *7: !ruby/object:Music::Transcription::Link::Slur
255
+ target_pitch: *7
256
+ accent: *1
257
+ - !ruby/object:Music::Transcription::Note::Half
258
+ duration: !ruby/object:Rational
259
+ denominator: 2
260
+ numerator: 1
261
+ pitches:
262
+ - *7
263
+ links: {}
264
+ accent: *1
265
+ - !ruby/object:Music::Transcription::Note::Quarter
266
+ duration: !ruby/object:Rational
267
+ denominator: 4
268
+ numerator: 1
269
+ pitches:
270
+ - *4
271
+ links: {}
272
+ accent: *1
273
+ - !ruby/object:Music::Transcription::Note::Eighth
274
+ duration: !ruby/object:Rational
275
+ denominator: 8
276
+ numerator: 1
277
+ pitches: []
278
+ links: {}
279
+ accent: *1
280
+ - !ruby/object:Music::Transcription::Note::Eighth
281
+ duration: !ruby/object:Rational
282
+ denominator: 8
283
+ numerator: 1
284
+ pitches:
285
+ - *7
286
+ links:
287
+ *7: !ruby/object:Music::Transcription::Link::Slur
288
+ target_pitch: *7
289
+ accent: *1
290
+ - !ruby/object:Music::Transcription::Note::Half
291
+ duration: !ruby/object:Rational
292
+ denominator: 2
293
+ numerator: 1
294
+ pitches:
295
+ - *7
296
+ links: {}
297
+ accent: *1
298
+ start_dynamic: !ruby/object:Music::Transcription::Dynamic::MezzoForte {}
299
+ dynamic_changes: {}
300
+ program: !ruby/object:Music::Transcription::Program
301
+ segments:
302
+ - !ruby/range
303
+ begin: 0
304
+ end: 8.0
305
+ excl: true