stretto 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/CHANGELOG.markdown +0 -0
  2. data/README.markdown +67 -0
  3. data/Rakefile +9 -0
  4. data/lib/stretto.rb +14 -0
  5. data/lib/stretto/grammar/channel_pressure_grammar.treetop +9 -0
  6. data/lib/stretto/grammar/chord_grammar.treetop +60 -0
  7. data/lib/stretto/grammar/controller_change_grammar.treetop +9 -0
  8. data/lib/stretto/grammar/duration_grammar.treetop +60 -0
  9. data/lib/stretto/grammar/grammar_helper.rb +6 -0
  10. data/lib/stretto/grammar/harmonic_chord_grammar.treetop +15 -0
  11. data/lib/stretto/grammar/harmony_grammar.treetop +15 -0
  12. data/lib/stretto/grammar/instrument_grammar.treetop +9 -0
  13. data/lib/stretto/grammar/key_signature_grammar.treetop +10 -0
  14. data/lib/stretto/grammar/layer_change_grammar.treetop +9 -0
  15. data/lib/stretto/grammar/measure_grammar.treetop +7 -0
  16. data/lib/stretto/grammar/note_grammar.treetop +32 -0
  17. data/lib/stretto/grammar/pitch_bend_grammar.treetop +7 -0
  18. data/lib/stretto/grammar/polyphonic_pressure_grammar.treetop +9 -0
  19. data/lib/stretto/grammar/rest_grammar.treetop +9 -0
  20. data/lib/stretto/grammar/stretto_grammar.treetop +62 -0
  21. data/lib/stretto/grammar/tempo_grammar.treetop +9 -0
  22. data/lib/stretto/grammar/timing_grammar.treetop +9 -0
  23. data/lib/stretto/grammar/tokens/attack_decay_token.rb +42 -0
  24. data/lib/stretto/grammar/tokens/chord_token.rb +67 -0
  25. data/lib/stretto/grammar/tokens/controller_change_token.rb +26 -0
  26. data/lib/stretto/grammar/tokens/duration_token.rb +55 -0
  27. data/lib/stretto/grammar/tokens/harmonic_chord_token.rb +25 -0
  28. data/lib/stretto/grammar/tokens/harmony_with_melody_token.rb +66 -0
  29. data/lib/stretto/grammar/tokens/hash_token.rb +15 -0
  30. data/lib/stretto/grammar/tokens/key_signature_token.rb +30 -0
  31. data/lib/stretto/grammar/tokens/measure_token.rb +21 -0
  32. data/lib/stretto/grammar/tokens/modifier_token.rb +99 -0
  33. data/lib/stretto/grammar/tokens/note_string_token.rb +106 -0
  34. data/lib/stretto/grammar/tokens/note_token.rb +25 -0
  35. data/lib/stretto/grammar/tokens/pattern_token.rb +26 -0
  36. data/lib/stretto/grammar/tokens/polyphonic_pressure_token.rb +28 -0
  37. data/lib/stretto/grammar/tokens/rest_token.rb +21 -0
  38. data/lib/stretto/grammar/tokens/value_token.rb +28 -0
  39. data/lib/stretto/grammar/tokens/variable_definition_token.rb +30 -0
  40. data/lib/stretto/grammar/value_grammar.treetop +45 -0
  41. data/lib/stretto/grammar/variable_grammar.treetop +10 -0
  42. data/lib/stretto/grammar/voice_change_grammar.treetop +9 -0
  43. data/lib/stretto/music_elements/channel_pressure.rb +44 -0
  44. data/lib/stretto/music_elements/chord.rb +194 -0
  45. data/lib/stretto/music_elements/controller_change.rb +49 -0
  46. data/lib/stretto/music_elements/harmonic_chord.rb +56 -0
  47. data/lib/stretto/music_elements/harmony.rb +37 -0
  48. data/lib/stretto/music_elements/instrument.rb +57 -0
  49. data/lib/stretto/music_elements/key_signature.rb +110 -0
  50. data/lib/stretto/music_elements/layer.rb +22 -0
  51. data/lib/stretto/music_elements/layer_change.rb +39 -0
  52. data/lib/stretto/music_elements/measure.rb +38 -0
  53. data/lib/stretto/music_elements/melody.rb +72 -0
  54. data/lib/stretto/music_elements/modifiers/attack_decay.rb +55 -0
  55. data/lib/stretto/music_elements/modifiers/chord_intervals.rb +44 -0
  56. data/lib/stretto/music_elements/modifiers/duration.rb +180 -0
  57. data/lib/stretto/music_elements/modifiers/value.rb +172 -0
  58. data/lib/stretto/music_elements/modifiers/variables.rb +365 -0
  59. data/lib/stretto/music_elements/music_element.rb +88 -0
  60. data/lib/stretto/music_elements/note.rb +282 -0
  61. data/lib/stretto/music_elements/pattern.rb +100 -0
  62. data/lib/stretto/music_elements/pitch_bend.rb +46 -0
  63. data/lib/stretto/music_elements/polyphonic_pressure.rb +62 -0
  64. data/lib/stretto/music_elements/rest.rb +26 -0
  65. data/lib/stretto/music_elements/tempo.rb +42 -0
  66. data/lib/stretto/music_elements/timing.rb +33 -0
  67. data/lib/stretto/music_elements/variable.rb +49 -0
  68. data/lib/stretto/music_elements/voice.rb +49 -0
  69. data/lib/stretto/music_elements/voice_change.rb +39 -0
  70. data/lib/stretto/parsers/exceptions.rb +11 -0
  71. data/lib/stretto/parsers/parser.rb +89 -0
  72. data/lib/stretto/renderers/midiator/player.rb +200 -0
  73. data/lib/stretto/util/jfugue_format_parser.rb +20 -0
  74. data/lib/stretto/util/node.rb +5 -0
  75. data/lib/stretto/util/utils.rb +41 -0
  76. data/lib/stretto/version.rb +3 -0
  77. metadata +203 -0
@@ -0,0 +1,20 @@
1
+ module Stretto
2
+
3
+ # @see JFugueFormatParser.parse
4
+ module JFugueFormatParser
5
+
6
+ def self.parse(jfugue_file)
7
+ begin
8
+ music_string = ""
9
+ until jfugue_file.eof
10
+ line = jfugue_file.readline
11
+ music_string << ' ' + line unless line.blank? or line[0, 1] == "#"
12
+ end
13
+ music_string
14
+ ensure
15
+ jfugue_file.close
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ module Stretto
2
+ module Node
3
+ attr_accessor :prev, :next
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+ class Object
2
+ def blank?
3
+ respond_to?(:empty?) ? empty? : !self
4
+ end
5
+
6
+ def present?
7
+ !blank?
8
+ end
9
+ end
10
+
11
+ class String
12
+ def blank?
13
+ self !~ /\S/
14
+ end
15
+ end
16
+
17
+ class Symbol
18
+ def to_proc
19
+ Proc.new { |obj, *args| obj.send(self, *args) }
20
+ end
21
+ end
22
+
23
+ class Array
24
+ def sum
25
+ inject(&:+)
26
+ end
27
+ end
28
+
29
+ class Hash
30
+ # As taken from ActiveSupport::CoreExtensions::Hash::Except
31
+
32
+ def except(*keys)
33
+ clone.except!(*keys)
34
+ end unless respond_to?(:except)
35
+
36
+ def except!(*keys)
37
+ keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
38
+ keys.each { |key| delete(key) }
39
+ self
40
+ end
41
+ end
@@ -0,0 +1,3 @@
1
+ module Stretto
2
+ VERSION = "0.6.1"
3
+ end
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stretto
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 1
10
+ version: 0.6.1
11
+ platform: ruby
12
+ authors:
13
+ - "Rub\xC3\xA9n Medell\xC3\xADn"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-20 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: treetop
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 23
44
+ segments:
45
+ - 1
46
+ - 4
47
+ - 8
48
+ version: 1.4.8
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: polyglot
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 17
60
+ segments:
61
+ - 0
62
+ - 3
63
+ - 1
64
+ version: 0.3.1
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: midiator
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 23
76
+ segments:
77
+ - 0
78
+ - 3
79
+ - 2
80
+ version: 0.3.2
81
+ type: :runtime
82
+ version_requirements: *id004
83
+ description: Stretto is a Ruby implementation of JFugue, an open source library originally written in Java by David Koelle for programming MIDI.
84
+ email:
85
+ executables: []
86
+
87
+ extensions: []
88
+
89
+ extra_rdoc_files: []
90
+
91
+ files:
92
+ - lib/stretto/grammar/channel_pressure_grammar.treetop
93
+ - lib/stretto/grammar/chord_grammar.treetop
94
+ - lib/stretto/grammar/controller_change_grammar.treetop
95
+ - lib/stretto/grammar/duration_grammar.treetop
96
+ - lib/stretto/grammar/grammar_helper.rb
97
+ - lib/stretto/grammar/harmonic_chord_grammar.treetop
98
+ - lib/stretto/grammar/harmony_grammar.treetop
99
+ - lib/stretto/grammar/instrument_grammar.treetop
100
+ - lib/stretto/grammar/key_signature_grammar.treetop
101
+ - lib/stretto/grammar/layer_change_grammar.treetop
102
+ - lib/stretto/grammar/measure_grammar.treetop
103
+ - lib/stretto/grammar/note_grammar.treetop
104
+ - lib/stretto/grammar/pitch_bend_grammar.treetop
105
+ - lib/stretto/grammar/polyphonic_pressure_grammar.treetop
106
+ - lib/stretto/grammar/rest_grammar.treetop
107
+ - lib/stretto/grammar/stretto_grammar.treetop
108
+ - lib/stretto/grammar/tempo_grammar.treetop
109
+ - lib/stretto/grammar/timing_grammar.treetop
110
+ - lib/stretto/grammar/tokens/attack_decay_token.rb
111
+ - lib/stretto/grammar/tokens/chord_token.rb
112
+ - lib/stretto/grammar/tokens/controller_change_token.rb
113
+ - lib/stretto/grammar/tokens/duration_token.rb
114
+ - lib/stretto/grammar/tokens/harmonic_chord_token.rb
115
+ - lib/stretto/grammar/tokens/harmony_with_melody_token.rb
116
+ - lib/stretto/grammar/tokens/hash_token.rb
117
+ - lib/stretto/grammar/tokens/key_signature_token.rb
118
+ - lib/stretto/grammar/tokens/measure_token.rb
119
+ - lib/stretto/grammar/tokens/modifier_token.rb
120
+ - lib/stretto/grammar/tokens/note_string_token.rb
121
+ - lib/stretto/grammar/tokens/note_token.rb
122
+ - lib/stretto/grammar/tokens/pattern_token.rb
123
+ - lib/stretto/grammar/tokens/polyphonic_pressure_token.rb
124
+ - lib/stretto/grammar/tokens/rest_token.rb
125
+ - lib/stretto/grammar/tokens/value_token.rb
126
+ - lib/stretto/grammar/tokens/variable_definition_token.rb
127
+ - lib/stretto/grammar/value_grammar.treetop
128
+ - lib/stretto/grammar/variable_grammar.treetop
129
+ - lib/stretto/grammar/voice_change_grammar.treetop
130
+ - lib/stretto/music_elements/channel_pressure.rb
131
+ - lib/stretto/music_elements/chord.rb
132
+ - lib/stretto/music_elements/controller_change.rb
133
+ - lib/stretto/music_elements/harmonic_chord.rb
134
+ - lib/stretto/music_elements/harmony.rb
135
+ - lib/stretto/music_elements/instrument.rb
136
+ - lib/stretto/music_elements/key_signature.rb
137
+ - lib/stretto/music_elements/layer.rb
138
+ - lib/stretto/music_elements/layer_change.rb
139
+ - lib/stretto/music_elements/measure.rb
140
+ - lib/stretto/music_elements/melody.rb
141
+ - lib/stretto/music_elements/modifiers/attack_decay.rb
142
+ - lib/stretto/music_elements/modifiers/chord_intervals.rb
143
+ - lib/stretto/music_elements/modifiers/duration.rb
144
+ - lib/stretto/music_elements/modifiers/value.rb
145
+ - lib/stretto/music_elements/modifiers/variables.rb
146
+ - lib/stretto/music_elements/music_element.rb
147
+ - lib/stretto/music_elements/note.rb
148
+ - lib/stretto/music_elements/pattern.rb
149
+ - lib/stretto/music_elements/pitch_bend.rb
150
+ - lib/stretto/music_elements/polyphonic_pressure.rb
151
+ - lib/stretto/music_elements/rest.rb
152
+ - lib/stretto/music_elements/tempo.rb
153
+ - lib/stretto/music_elements/timing.rb
154
+ - lib/stretto/music_elements/variable.rb
155
+ - lib/stretto/music_elements/voice.rb
156
+ - lib/stretto/music_elements/voice_change.rb
157
+ - lib/stretto/parsers/exceptions.rb
158
+ - lib/stretto/parsers/parser.rb
159
+ - lib/stretto/renderers/midiator/player.rb
160
+ - lib/stretto/util/jfugue_format_parser.rb
161
+ - lib/stretto/util/node.rb
162
+ - lib/stretto/util/utils.rb
163
+ - lib/stretto/version.rb
164
+ - lib/stretto.rb
165
+ - Rakefile
166
+ - README.markdown
167
+ - CHANGELOG.markdown
168
+ has_rdoc: true
169
+ homepage: http://github.com/chubas/stretto
170
+ licenses: []
171
+
172
+ post_install_message:
173
+ rdoc_options: []
174
+
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ hash: 3
183
+ segments:
184
+ - 0
185
+ version: "0"
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ hash: 3
192
+ segments:
193
+ - 0
194
+ version: "0"
195
+ requirements: []
196
+
197
+ rubyforge_project:
198
+ rubygems_version: 1.6.2
199
+ signing_key:
200
+ specification_version: 3
201
+ summary: A Ruby implementation of JFugue
202
+ test_files: []
203
+