beats 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. data/LICENSE +1 -1
  2. data/README.markdown +28 -10
  3. data/bin/beats +9 -7
  4. data/lib/audioengine.rb +172 -0
  5. data/lib/audioutils.rb +73 -0
  6. data/lib/beats.rb +14 -15
  7. data/lib/beatswavefile.rb +17 -37
  8. data/lib/kit.rb +148 -71
  9. data/lib/pattern.rb +20 -117
  10. data/lib/patternexpander.rb +111 -0
  11. data/lib/song.rb +78 -132
  12. data/lib/songoptimizer.rb +29 -33
  13. data/lib/songparser.rb +70 -45
  14. data/lib/track.rb +11 -82
  15. data/test/audioengine_test.rb +261 -0
  16. data/test/audioutils_test.rb +45 -0
  17. data/test/fixtures/expected_output/example_split_mono_16-hh_closed.wav +0 -0
  18. data/test/{examples/split-agogo_high.wav → fixtures/expected_output/example_split_mono_16-hh_closed2.wav} +0 -0
  19. data/test/fixtures/expected_output/example_split_mono_8-hh_closed.wav +0 -0
  20. data/test/{examples/split-tom4.wav → fixtures/expected_output/example_split_mono_8-hh_closed2.wav} +0 -0
  21. data/test/fixtures/expected_output/example_split_stereo_16-hh_closed.wav +0 -0
  22. data/test/fixtures/expected_output/example_split_stereo_16-hh_closed2.wav +0 -0
  23. data/test/fixtures/expected_output/example_split_stereo_8-hh_closed.wav +0 -0
  24. data/test/fixtures/expected_output/example_split_stereo_8-hh_closed2.wav +0 -0
  25. data/test/fixtures/invalid/{bad_structure.txt → bad_flow.txt} +2 -2
  26. data/test/fixtures/invalid/bad_repeat_count.txt +1 -1
  27. data/test/fixtures/invalid/bad_rhythm.txt +1 -1
  28. data/test/fixtures/invalid/bad_tempo.txt +1 -1
  29. data/test/fixtures/invalid/{no_structure.txt → no_flow.txt} +1 -1
  30. data/test/fixtures/invalid/pattern_with_no_tracks.txt +1 -1
  31. data/test/fixtures/invalid/sound_in_kit_not_found.txt +1 -1
  32. data/test/fixtures/invalid/sound_in_kit_wrong_format.txt +10 -0
  33. data/test/fixtures/invalid/sound_in_track_not_found.txt +1 -1
  34. data/test/fixtures/invalid/sound_in_track_wrong_format.txt +8 -0
  35. data/test/fixtures/invalid/template.txt +1 -1
  36. data/test/fixtures/valid/example_mono_16.txt +5 -3
  37. data/test/fixtures/valid/example_mono_8.txt +5 -3
  38. data/test/fixtures/valid/example_no_kit.txt +1 -1
  39. data/test/fixtures/valid/example_stereo_16.txt +7 -4
  40. data/test/fixtures/valid/example_stereo_8.txt +5 -3
  41. data/test/fixtures/valid/example_with_empty_track.txt +1 -1
  42. data/test/fixtures/valid/example_with_kit.txt +1 -1
  43. data/test/fixtures/valid/multiple_tracks_same_sound.txt +33 -0
  44. data/test/fixtures/valid/no_tempo.txt +1 -1
  45. data/test/fixtures/valid/optimize_pattern_collision.txt +28 -0
  46. data/test/fixtures/valid/pattern_with_overflow.txt +1 -1
  47. data/test/fixtures/valid/repeats_not_specified.txt +2 -2
  48. data/test/fixtures/valid/with_structure.txt +10 -0
  49. data/test/fixtures/yaml/song_yaml.txt +5 -5
  50. data/test/includes.rb +4 -2
  51. data/test/integration.rb +3 -3
  52. data/test/kit_test.rb +136 -109
  53. data/test/pattern_test.rb +31 -131
  54. data/test/patternexpander_test.rb +142 -0
  55. data/test/song_test.rb +104 -102
  56. data/test/songoptimizer_test.rb +52 -38
  57. data/test/songparser_test.rb +79 -46
  58. data/test/sounds/composite_snare_mono_8_tom3_mono_16_mono_16.wav +0 -0
  59. data/test/sounds/composite_snare_mono_8_tom3_mono_8_mono_16.wav +0 -0
  60. data/test/sounds/composite_snare_stereo_16_tom3_mono_16_stereo_16.wav +0 -0
  61. data/test/sounds/composite_snare_stereo_8_tom3_mono_16_stereo_16.wav +0 -0
  62. data/test/track_test.rb +30 -185
  63. metadata +56 -24
  64. data/lib/songsplitter.rb +0 -38
  65. data/test/examples/combined.wav +0 -0
  66. data/test/examples/split-bass.wav +0 -0
  67. data/test/examples/split-hh_closed.wav +0 -0
  68. data/test/examples/split-snare.wav +0 -0
  69. data/test/examples/split-tom2.wav +0 -0
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 1
10
+ version: 1.2.1
5
11
  platform: ruby
6
12
  authors:
7
13
  - Joel Strait
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-07-13 00:00:00 -04:00
18
+ date: 2011-03-06 00:00:00 -05:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -24,24 +30,21 @@ extra_rdoc_files: []
24
30
  files:
25
31
  - LICENSE
26
32
  - README.markdown
33
+ - lib/audioengine.rb
34
+ - lib/audioutils.rb
27
35
  - lib/beats.rb
28
36
  - lib/beatswavefile.rb
29
37
  - lib/kit.rb
30
38
  - lib/pattern.rb
39
+ - lib/patternexpander.rb
31
40
  - lib/song.rb
32
41
  - lib/songoptimizer.rb
33
42
  - lib/songparser.rb
34
- - lib/songsplitter.rb
35
43
  - lib/track.rb
36
44
  - lib/wavefile.rb
37
45
  - bin/beats
38
- - test/examples/combined.wav
39
- - test/examples/split-agogo_high.wav
40
- - test/examples/split-bass.wav
41
- - test/examples/split-hh_closed.wav
42
- - test/examples/split-snare.wav
43
- - test/examples/split-tom2.wav
44
- - test/examples/split-tom4.wav
46
+ - test/audioengine_test.rb
47
+ - test/audioutils_test.rb
45
48
  - test/fixtures/expected_output/example_combined_mono_16.wav
46
49
  - test/fixtures/expected_output/example_combined_mono_8.wav
47
50
  - test/fixtures/expected_output/example_combined_stereo_16.wav
@@ -49,36 +52,42 @@ files:
49
52
  - test/fixtures/expected_output/example_split_mono_16-agogo.wav
50
53
  - test/fixtures/expected_output/example_split_mono_16-bass.wav
51
54
  - test/fixtures/expected_output/example_split_mono_16-hh_closed.wav
55
+ - test/fixtures/expected_output/example_split_mono_16-hh_closed2.wav
52
56
  - test/fixtures/expected_output/example_split_mono_16-snare.wav
53
57
  - test/fixtures/expected_output/example_split_mono_16-tom2_mono_16.wav
54
58
  - test/fixtures/expected_output/example_split_mono_16-tom4_mono_16.wav
55
59
  - test/fixtures/expected_output/example_split_mono_8-agogo.wav
56
60
  - test/fixtures/expected_output/example_split_mono_8-bass.wav
57
61
  - test/fixtures/expected_output/example_split_mono_8-hh_closed.wav
62
+ - test/fixtures/expected_output/example_split_mono_8-hh_closed2.wav
58
63
  - test/fixtures/expected_output/example_split_mono_8-snare.wav
59
64
  - test/fixtures/expected_output/example_split_mono_8-tom2_mono_8.wav
60
65
  - test/fixtures/expected_output/example_split_mono_8-tom4_mono_8.wav
61
66
  - test/fixtures/expected_output/example_split_stereo_16-agogo.wav
62
67
  - test/fixtures/expected_output/example_split_stereo_16-bass.wav
63
68
  - test/fixtures/expected_output/example_split_stereo_16-hh_closed.wav
69
+ - test/fixtures/expected_output/example_split_stereo_16-hh_closed2.wav
64
70
  - test/fixtures/expected_output/example_split_stereo_16-snare.wav
65
71
  - test/fixtures/expected_output/example_split_stereo_16-tom2_stereo_16.wav
66
72
  - test/fixtures/expected_output/example_split_stereo_16-tom4_stereo_16.wav
67
73
  - test/fixtures/expected_output/example_split_stereo_8-agogo.wav
68
74
  - test/fixtures/expected_output/example_split_stereo_8-bass.wav
69
75
  - test/fixtures/expected_output/example_split_stereo_8-hh_closed.wav
76
+ - test/fixtures/expected_output/example_split_stereo_8-hh_closed2.wav
70
77
  - test/fixtures/expected_output/example_split_stereo_8-snare.wav
71
78
  - test/fixtures/expected_output/example_split_stereo_8-tom2_stereo_8.wav
72
79
  - test/fixtures/expected_output/example_split_stereo_8-tom4_stereo_8.wav
80
+ - test/fixtures/invalid/bad_flow.txt
73
81
  - test/fixtures/invalid/bad_repeat_count.txt
74
82
  - test/fixtures/invalid/bad_rhythm.txt
75
- - test/fixtures/invalid/bad_structure.txt
76
83
  - test/fixtures/invalid/bad_tempo.txt
84
+ - test/fixtures/invalid/no_flow.txt
77
85
  - test/fixtures/invalid/no_header.txt
78
- - test/fixtures/invalid/no_structure.txt
79
86
  - test/fixtures/invalid/pattern_with_no_tracks.txt
80
87
  - test/fixtures/invalid/sound_in_kit_not_found.txt
88
+ - test/fixtures/invalid/sound_in_kit_wrong_format.txt
81
89
  - test/fixtures/invalid/sound_in_track_not_found.txt
90
+ - test/fixtures/invalid/sound_in_track_wrong_format.txt
82
91
  - test/fixtures/invalid/template.txt
83
92
  - test/fixtures/valid/example_mono_16.txt
84
93
  - test/fixtures/valid/example_mono_8.txt
@@ -87,14 +96,18 @@ files:
87
96
  - test/fixtures/valid/example_stereo_8.txt
88
97
  - test/fixtures/valid/example_with_empty_track.txt
89
98
  - test/fixtures/valid/example_with_kit.txt
99
+ - test/fixtures/valid/multiple_tracks_same_sound.txt
90
100
  - test/fixtures/valid/no_tempo.txt
101
+ - test/fixtures/valid/optimize_pattern_collision.txt
91
102
  - test/fixtures/valid/pattern_with_overflow.txt
92
103
  - test/fixtures/valid/repeats_not_specified.txt
104
+ - test/fixtures/valid/with_structure.txt
93
105
  - test/fixtures/yaml/song_yaml.txt
94
106
  - test/includes.rb
95
107
  - test/integration.rb
96
108
  - test/kit_test.rb
97
109
  - test/pattern_test.rb
110
+ - test/patternexpander_test.rb
98
111
  - test/song_test.rb
99
112
  - test/songoptimizer_test.rb
100
113
  - test/songparser_test.rb
@@ -122,6 +135,10 @@ files:
122
135
  - test/sounds/clave_low_mono_8.wav
123
136
  - test/sounds/clave_low_stereo_16.wav
124
137
  - test/sounds/clave_low_stereo_8.wav
138
+ - test/sounds/composite_snare_mono_8_tom3_mono_16_mono_16.wav
139
+ - test/sounds/composite_snare_mono_8_tom3_mono_8_mono_16.wav
140
+ - test/sounds/composite_snare_stereo_16_tom3_mono_16_stereo_16.wav
141
+ - test/sounds/composite_snare_stereo_8_tom3_mono_16_stereo_16.wav
125
142
  - test/sounds/conga_high_mono_16.wav
126
143
  - test/sounds/conga_high_mono_8.wav
127
144
  - test/sounds/conga_high_stereo_16.wav
@@ -191,32 +208,33 @@ rdoc_options: []
191
208
  require_paths:
192
209
  - lib
193
210
  required_ruby_version: !ruby/object:Gem::Requirement
211
+ none: false
194
212
  requirements:
195
213
  - - ">="
196
214
  - !ruby/object:Gem::Version
215
+ hash: 3
216
+ segments:
217
+ - 0
197
218
  version: "0"
198
- version:
199
219
  required_rubygems_version: !ruby/object:Gem::Requirement
220
+ none: false
200
221
  requirements:
201
222
  - - ">="
202
223
  - !ruby/object:Gem::Version
224
+ hash: 3
225
+ segments:
226
+ - 0
203
227
  version: "0"
204
- version:
205
228
  requirements: []
206
229
 
207
230
  rubyforge_project:
208
- rubygems_version: 1.3.5
231
+ rubygems_version: 1.6.1
209
232
  signing_key:
210
233
  specification_version: 3
211
234
  summary: A command-line drum machine. Feed it a song notated in YAML, and it will produce a precision-milled Wave file of impeccable timing and feel.
212
235
  test_files:
213
- - test/examples/combined.wav
214
- - test/examples/split-agogo_high.wav
215
- - test/examples/split-bass.wav
216
- - test/examples/split-hh_closed.wav
217
- - test/examples/split-snare.wav
218
- - test/examples/split-tom2.wav
219
- - test/examples/split-tom4.wav
236
+ - test/audioengine_test.rb
237
+ - test/audioutils_test.rb
220
238
  - test/fixtures/expected_output/example_combined_mono_16.wav
221
239
  - test/fixtures/expected_output/example_combined_mono_8.wav
222
240
  - test/fixtures/expected_output/example_combined_stereo_16.wav
@@ -224,36 +242,42 @@ test_files:
224
242
  - test/fixtures/expected_output/example_split_mono_16-agogo.wav
225
243
  - test/fixtures/expected_output/example_split_mono_16-bass.wav
226
244
  - test/fixtures/expected_output/example_split_mono_16-hh_closed.wav
245
+ - test/fixtures/expected_output/example_split_mono_16-hh_closed2.wav
227
246
  - test/fixtures/expected_output/example_split_mono_16-snare.wav
228
247
  - test/fixtures/expected_output/example_split_mono_16-tom2_mono_16.wav
229
248
  - test/fixtures/expected_output/example_split_mono_16-tom4_mono_16.wav
230
249
  - test/fixtures/expected_output/example_split_mono_8-agogo.wav
231
250
  - test/fixtures/expected_output/example_split_mono_8-bass.wav
232
251
  - test/fixtures/expected_output/example_split_mono_8-hh_closed.wav
252
+ - test/fixtures/expected_output/example_split_mono_8-hh_closed2.wav
233
253
  - test/fixtures/expected_output/example_split_mono_8-snare.wav
234
254
  - test/fixtures/expected_output/example_split_mono_8-tom2_mono_8.wav
235
255
  - test/fixtures/expected_output/example_split_mono_8-tom4_mono_8.wav
236
256
  - test/fixtures/expected_output/example_split_stereo_16-agogo.wav
237
257
  - test/fixtures/expected_output/example_split_stereo_16-bass.wav
238
258
  - test/fixtures/expected_output/example_split_stereo_16-hh_closed.wav
259
+ - test/fixtures/expected_output/example_split_stereo_16-hh_closed2.wav
239
260
  - test/fixtures/expected_output/example_split_stereo_16-snare.wav
240
261
  - test/fixtures/expected_output/example_split_stereo_16-tom2_stereo_16.wav
241
262
  - test/fixtures/expected_output/example_split_stereo_16-tom4_stereo_16.wav
242
263
  - test/fixtures/expected_output/example_split_stereo_8-agogo.wav
243
264
  - test/fixtures/expected_output/example_split_stereo_8-bass.wav
244
265
  - test/fixtures/expected_output/example_split_stereo_8-hh_closed.wav
266
+ - test/fixtures/expected_output/example_split_stereo_8-hh_closed2.wav
245
267
  - test/fixtures/expected_output/example_split_stereo_8-snare.wav
246
268
  - test/fixtures/expected_output/example_split_stereo_8-tom2_stereo_8.wav
247
269
  - test/fixtures/expected_output/example_split_stereo_8-tom4_stereo_8.wav
270
+ - test/fixtures/invalid/bad_flow.txt
248
271
  - test/fixtures/invalid/bad_repeat_count.txt
249
272
  - test/fixtures/invalid/bad_rhythm.txt
250
- - test/fixtures/invalid/bad_structure.txt
251
273
  - test/fixtures/invalid/bad_tempo.txt
274
+ - test/fixtures/invalid/no_flow.txt
252
275
  - test/fixtures/invalid/no_header.txt
253
- - test/fixtures/invalid/no_structure.txt
254
276
  - test/fixtures/invalid/pattern_with_no_tracks.txt
255
277
  - test/fixtures/invalid/sound_in_kit_not_found.txt
278
+ - test/fixtures/invalid/sound_in_kit_wrong_format.txt
256
279
  - test/fixtures/invalid/sound_in_track_not_found.txt
280
+ - test/fixtures/invalid/sound_in_track_wrong_format.txt
257
281
  - test/fixtures/invalid/template.txt
258
282
  - test/fixtures/valid/example_mono_16.txt
259
283
  - test/fixtures/valid/example_mono_8.txt
@@ -262,14 +286,18 @@ test_files:
262
286
  - test/fixtures/valid/example_stereo_8.txt
263
287
  - test/fixtures/valid/example_with_empty_track.txt
264
288
  - test/fixtures/valid/example_with_kit.txt
289
+ - test/fixtures/valid/multiple_tracks_same_sound.txt
265
290
  - test/fixtures/valid/no_tempo.txt
291
+ - test/fixtures/valid/optimize_pattern_collision.txt
266
292
  - test/fixtures/valid/pattern_with_overflow.txt
267
293
  - test/fixtures/valid/repeats_not_specified.txt
294
+ - test/fixtures/valid/with_structure.txt
268
295
  - test/fixtures/yaml/song_yaml.txt
269
296
  - test/includes.rb
270
297
  - test/integration.rb
271
298
  - test/kit_test.rb
272
299
  - test/pattern_test.rb
300
+ - test/patternexpander_test.rb
273
301
  - test/song_test.rb
274
302
  - test/songoptimizer_test.rb
275
303
  - test/songparser_test.rb
@@ -297,6 +325,10 @@ test_files:
297
325
  - test/sounds/clave_low_mono_8.wav
298
326
  - test/sounds/clave_low_stereo_16.wav
299
327
  - test/sounds/clave_low_stereo_8.wav
328
+ - test/sounds/composite_snare_mono_8_tom3_mono_16_mono_16.wav
329
+ - test/sounds/composite_snare_mono_8_tom3_mono_8_mono_16.wav
330
+ - test/sounds/composite_snare_stereo_16_tom3_mono_16_stereo_16.wav
331
+ - test/sounds/composite_snare_stereo_8_tom3_mono_16_stereo_16.wav
300
332
  - test/sounds/conga_high_mono_16.wav
301
333
  - test/sounds/conga_high_mono_8.wav
302
334
  - test/sounds/conga_high_stereo_16.wav
@@ -1,38 +0,0 @@
1
- # Used to split a Song object into multiple Song objects, where each resulting
2
- # object only has 1 track. For example, if a Song has 5 tracks, this will return
3
- # a hash of 5 songs, each with one of the original song's tracks.
4
- class SongSplitter
5
- def initialize()
6
- end
7
-
8
- def split(original_song)
9
- track_names = original_song.track_names()
10
-
11
- split_songs = {}
12
- track_names.each do |track_name|
13
- new_song = original_song.copy_ignoring_patterns_and_structure()
14
-
15
- if track_name == "placeholder"
16
- track_sample_data = []
17
- else
18
- track_sample_data = new_song.kit.get_sample_data(track_name)
19
- end
20
-
21
- original_song.patterns.each do |name, original_pattern|
22
- new_pattern = new_song.pattern name
23
-
24
- if original_pattern.tracks.has_key?(track_name)
25
- new_pattern.track track_name, track_sample_data, original_pattern.tracks[track_name].rhythm
26
- else
27
- new_pattern.track track_name, track_sample_data, "." * original_pattern.tick_count()
28
- end
29
- end
30
-
31
- new_song.structure = original_song.structure
32
-
33
- split_songs[track_name] = new_song
34
- end
35
-
36
- return split_songs
37
- end
38
- end
Binary file
Binary file
Binary file