midilib 2.0.5 → 3.0.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 (124) hide show
  1. checksums.yaml +5 -5
  2. data/ChangeLog +2 -1
  3. data/Credits +39 -2
  4. data/README.rdoc +5 -6
  5. data/Rakefile +36 -49
  6. data/TODO.rdoc +13 -2
  7. data/examples/from_scratch.rb +1 -1
  8. data/examples/measures_mbt.rb +11 -11
  9. data/examples/print_program_changes.rb +2 -2
  10. data/examples/reader2text.rb +47 -47
  11. data/examples/seq2text.rb +1 -1
  12. data/examples/split.rb +4 -3
  13. data/examples/strings.rb +4 -4
  14. data/examples/transpose.rb +19 -20
  15. data/install.rb +21 -13
  16. data/lib/midilib/consts.rb +237 -239
  17. data/lib/midilib/event.rb +128 -100
  18. data/lib/midilib/info.rb +3 -5
  19. data/lib/midilib/io/midifile.rb +155 -182
  20. data/lib/midilib/io/seqreader.rb +80 -85
  21. data/lib/midilib/io/seqwriter.rb +93 -88
  22. data/lib/midilib/measure.rb +78 -80
  23. data/lib/midilib/mergesort.rb +39 -0
  24. data/lib/midilib/sequence.rb +40 -32
  25. data/lib/midilib/track.rb +16 -57
  26. data/lib/midilib/utils.rb +4 -7
  27. data/lib/midilib.rb +5 -5
  28. data/test/event_equality.rb +28 -30
  29. data/test/test_event.rb +9 -11
  30. data/test/test_io.rb +83 -3
  31. data/test/test_mergesort.rb +37 -0
  32. data/test/test_midifile.rb +6 -19
  33. data/test/test_sequence.rb +5 -4
  34. data/test/test_track.rb +9 -38
  35. data/test/test_varlen.rb +1 -3
  36. metadata +8 -95
  37. data/html/IO.html +0 -155
  38. data/html/MIDI/ActiveSense.html +0 -206
  39. data/html/MIDI/ChannelEvent.html +0 -231
  40. data/html/MIDI/ChannelPressure.html +0 -265
  41. data/html/MIDI/Clock.html +0 -206
  42. data/html/MIDI/Continue.html +0 -206
  43. data/html/MIDI/Controller.html +0 -280
  44. data/html/MIDI/Event.html +0 -489
  45. data/html/MIDI/IO/MIDIFile.html +0 -2024
  46. data/html/MIDI/IO/SeqReader.html +0 -904
  47. data/html/MIDI/IO/SeqWriter.html +0 -572
  48. data/html/MIDI/IO.html +0 -95
  49. data/html/MIDI/KeySig.html +0 -353
  50. data/html/MIDI/MIDI/MIDI/Array.html +0 -255
  51. data/html/MIDI/MIDI/MIDI.html +0 -95
  52. data/html/MIDI/MIDI.html +0 -95
  53. data/html/MIDI/Marker.html +0 -158
  54. data/html/MIDI/Measure.html +0 -328
  55. data/html/MIDI/Measures.html +0 -285
  56. data/html/MIDI/MetaEvent.html +0 -461
  57. data/html/MIDI/NoteEvent.html +0 -331
  58. data/html/MIDI/NoteOff.html +0 -228
  59. data/html/MIDI/NoteOn.html +0 -228
  60. data/html/MIDI/PitchBend.html +0 -266
  61. data/html/MIDI/PolyPressure.html +0 -277
  62. data/html/MIDI/ProgramChange.html +0 -265
  63. data/html/MIDI/Realtime.html +0 -242
  64. data/html/MIDI/Sequence.html +0 -896
  65. data/html/MIDI/SongPointer.html +0 -266
  66. data/html/MIDI/SongSelect.html +0 -265
  67. data/html/MIDI/Start.html +0 -206
  68. data/html/MIDI/Stop.html +0 -206
  69. data/html/MIDI/SystemCommon.html +0 -158
  70. data/html/MIDI/SystemExclusive.html +0 -268
  71. data/html/MIDI/SystemReset.html +0 -206
  72. data/html/MIDI/Tempo.html +0 -396
  73. data/html/MIDI/TimeSig.html +0 -388
  74. data/html/MIDI/Track.html +0 -695
  75. data/html/MIDI/TuneRequest.html +0 -242
  76. data/html/MIDI/Utils.html +0 -220
  77. data/html/MIDI.html +0 -547
  78. data/html/README_rdoc.html +0 -731
  79. data/html/TODO_rdoc.html +0 -125
  80. data/html/created.rid +0 -14
  81. data/html/css/fonts.css +0 -167
  82. data/html/css/rdoc.css +0 -590
  83. data/html/fonts/Lato-Light.ttf +0 -0
  84. data/html/fonts/Lato-LightItalic.ttf +0 -0
  85. data/html/fonts/Lato-Regular.ttf +0 -0
  86. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  87. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  88. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  89. data/html/images/add.png +0 -0
  90. data/html/images/arrow_up.png +0 -0
  91. data/html/images/brick.png +0 -0
  92. data/html/images/brick_link.png +0 -0
  93. data/html/images/bug.png +0 -0
  94. data/html/images/bullet_black.png +0 -0
  95. data/html/images/bullet_toggle_minus.png +0 -0
  96. data/html/images/bullet_toggle_plus.png +0 -0
  97. data/html/images/date.png +0 -0
  98. data/html/images/delete.png +0 -0
  99. data/html/images/find.png +0 -0
  100. data/html/images/loadingAnimation.gif +0 -0
  101. data/html/images/macFFBgHack.png +0 -0
  102. data/html/images/package.png +0 -0
  103. data/html/images/page_green.png +0 -0
  104. data/html/images/page_white_text.png +0 -0
  105. data/html/images/page_white_width.png +0 -0
  106. data/html/images/plugin.png +0 -0
  107. data/html/images/ruby.png +0 -0
  108. data/html/images/tag_blue.png +0 -0
  109. data/html/images/tag_green.png +0 -0
  110. data/html/images/transparent.png +0 -0
  111. data/html/images/wrench.png +0 -0
  112. data/html/images/wrench_orange.png +0 -0
  113. data/html/images/zoom.png +0 -0
  114. data/html/index.html +0 -768
  115. data/html/js/darkfish.js +0 -161
  116. data/html/js/jquery.js +0 -4
  117. data/html/js/navigation.js +0 -142
  118. data/html/js/navigation.js.gz +0 -0
  119. data/html/js/search.js +0 -109
  120. data/html/js/search_index.js +0 -1
  121. data/html/js/search_index.js.gz +0 -0
  122. data/html/js/searcher.js +0 -228
  123. data/html/js/searcher.js.gz +0 -0
  124. data/html/table_of_contents.html +0 -1265
@@ -1,731 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>README - midilib</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "./";
11
- </script>
12
-
13
- <script src="./js/jquery.js"></script>
14
- <script src="./js/darkfish.js"></script>
15
-
16
- <link href="./css/fonts.css" rel="stylesheet">
17
- <link href="./css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" role="document" class="file">
22
- <nav role="navigation">
23
- <div id="project-navigation">
24
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
- <h2>
26
- <a href="./index.html" rel="home">Home</a>
27
- </h2>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="./table_of_contents.html#pages">Pages</a>
31
- <a href="./table_of_contents.html#classes">Classes</a>
32
- <a href="./table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
38
- <div id="search-field-wrapper">
39
- <input id="search-field" role="combobox" aria-label="Search"
40
- aria-autocomplete="list" aria-controls="search-results"
41
- type="text" name="search" placeholder="Search" spellcheck="false"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
45
- <ul id="search-results" aria-label="Search Results"
46
- aria-busy="false" aria-expanded="false"
47
- aria-atomic="false" class="initially-hidden"></ul>
48
- </form>
49
- </div>
50
-
51
- </div>
52
-
53
-
54
- <div class="nav-section">
55
- <h3>Table of Contents</h3>
56
-
57
- <ul class="link-list" role="directory">
58
- <li><a href="#label-midilib">midilib</a>
59
- <li><a href="#label-Dependencies">Dependencies</a>
60
- <li><a href="#label-Installation">Installation</a>
61
- <li><a href="#label-RubyGems+Installation">RubyGems Installation</a>
62
- <li><a href="#label-Manual+Installation">Manual Installation</a>
63
- <li><a href="#label-Testing">Testing</a>
64
- <li><a href="#label-Overview">Overview</a>
65
- <li><a href="#label-MIDI-3A-3ASequence">MIDI::Sequence</a>
66
- <li><a href="#label-MIDI-3A-3ATrack">MIDI::Track</a>
67
- <li><a href="#label-MIDI-3A-3AMeasure">MIDI::Measure</a>
68
- <li><a href="#label-MIDI-3A-3AMeasures">MIDI::Measures</a>
69
- <li><a href="#label-MIDI-3A-3AEvent">MIDI::Event</a>
70
- <li><a href="#label-How+To+Use">How To Use</a>
71
- <li><a href="#label-Reading+a+MIDI+File">Reading a MIDI File</a>
72
- <li><a href="#label-Writing+a+MIDI+File">Writing a MIDI File</a>
73
- <li><a href="#label-Editing+a+MIDI+File">Editing a MIDI File</a>
74
- <li><a href="#label-Transposing+One+Channel">Transposing One Channel</a>
75
- <li><a href="#label-Manipulating+tracks">Manipulating tracks</a>
76
- <li><a href="#label-Calculating+delta+times">Calculating delta times</a>
77
- <li><a href="#label-Example+Scripts">Example Scripts</a>
78
- <li><a href="#label-Resources">Resources</a>
79
- <li><a href="#label-To+Do">To Do</a>
80
- <li><a href="#label-Bugs">Bugs</a>
81
- <li><a href="#label-Features">Features</a>
82
- <li><a href="#label-Documentation">Documentation</a>
83
- <li><a href="#label-Tests">Tests</a>
84
- <li><a href="#label-Support">Support</a>
85
- <li><a href="#label-Administrivia">Administrivia</a>
86
- <li><a href="#label-Copying">Copying</a>
87
- <li><a href="#label-Recent+Changes">Recent Changes</a>
88
- <li><a href="#label-Changes+for+2.0.5-3A">Changes for 2.0.5:</a>
89
- <li><a href="#label-Changes+for+2.0.3-3A">Changes for 2.0.3:</a>
90
- <li><a href="#label-Changes+for+2.0.2-3A">Changes for 2.0.2:</a>
91
- <li><a href="#label-Changes+for+2.0.0-3A">Changes for 2.0.0:</a>
92
- <li><a href="#label-Changes+for+1.2.0-3A">Changes for 1.2.0:</a>
93
- <li><a href="#label-New+code+repository">New code repository</a>
94
- <li><a href="#label-Changes+for+1.1.4-3A">Changes for 1.1.4:</a>
95
- <li><a href="#label-Changes+for+1.1.3-3A">Changes for 1.1.3:</a>
96
- <li><a href="#label-Changes+for+1.1.2-3A">Changes for 1.1.2:</a>
97
- <li><a href="#label-Changes+for+1.1.1-3A">Changes for 1.1.1:</a>
98
- <li><a href="#label-Changes+for+1.1.0-3A">Changes for 1.1.0:</a>
99
- <li><a href="#label-Changes+for+1.0.0-3A">Changes for 1.0.0:</a>
100
- <li><a href="#label-Changes+for+0.8.7-3A">Changes for 0.8.7:</a>
101
- <li><a href="#label-Changes+for+0.8.6-3A">Changes for 0.8.6:</a>
102
- <li><a href="#label-Changes+for+0.8.5-3A">Changes for 0.8.5:</a>
103
- <li><a href="#label-Changes+for+0.8.4-3A">Changes for 0.8.4:</a>
104
- <li><a href="#label-Changes+for+0.8.3-3A">Changes for 0.8.3:</a>
105
- <li><a href="#label-Changes+for+0.8.2-3A">Changes for 0.8.2:</a>
106
- <li><a href="#label-Changes+for+0.8.1-3A">Changes for 0.8.1:</a>
107
- <li><a href="#label-Warranty">Warranty</a>
108
- </ul>
109
- </div>
110
-
111
-
112
- <div id="project-metadata">
113
- <div id="fileindex-section" class="nav-section">
114
- <h3>Pages</h3>
115
-
116
- <ul class="link-list">
117
-
118
- <li><a href="./README_rdoc.html">README</a>
119
-
120
- <li><a href="./TODO_rdoc.html">TODO</a>
121
-
122
- </ul>
123
- </div>
124
-
125
- </div>
126
- </nav>
127
-
128
- <main role="main" aria-label="Page README.rdoc">
129
-
130
- <h1 id="label-midilib">midilib<span><a href="#label-midilib">&para;</a> <a href="#top">&uarr;</a></span></h1>
131
-
132
- <p>midilib is a pure Ruby <a href="MIDI.html">MIDI</a> library useful for
133
- reading and writing standard <a href="MIDI.html">MIDI</a> files and
134
- manipulating <a href="MIDI.html">MIDI</a> event data.</p>
135
-
136
- <p>The GitHub project page and Web site of midilib is <a
137
- href="http://github.com/jimm/midilib">github.com/jimm/midilib</a> and the
138
- RubyGems.org page is <a
139
- href="http://rubygems.org/gems/midilib">rubygems.org/gems/midilib</a>,
140
- where you can also find all the RDoc documentation.</p>
141
-
142
- <p>midilib is compatible with Ruby 1.8.x 1.9.x, and 2.x.</p>
143
-
144
- <h2 id="label-Dependencies">Dependencies<span><a href="#label-Dependencies">&para;</a> <a href="#top">&uarr;</a></span></h2>
145
-
146
- <p>midilib does not require any other packages. The test suite in the tests
147
- directory requires the testing framework TestUnit, which comes with Ruby
148
- 1.8 and later and can also be found in the Ruby Application Archive (<a
149
- href="http://raa.ruby-lang.org">raa.ruby-lang.org</a>).</p>
150
-
151
- <p>To rebuild the gem or RDocs or run the tests easily, you can use the
152
- Rakefile which requires Rake (<a
153
- href="http://rake.rubyforge.org">rake.rubyforge.org</a>).</p>
154
-
155
- <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
156
-
157
- <h3 id="label-RubyGems+Installation">RubyGems Installation<span><a href="#label-RubyGems+Installation">&para;</a> <a href="#top">&uarr;</a></span></h3>
158
-
159
- <p>To install midilib as a gem, type</p>
160
-
161
- <pre>% gem install midilib</pre>
162
-
163
- <p>or, if you already have a previous version, use</p>
164
-
165
- <pre>% gem update midilib</pre>
166
-
167
- <p>You may need root privileges to install or update the gem.</p>
168
-
169
- <h3 id="label-Manual+Installation">Manual Installation<span><a href="#label-Manual+Installation">&para;</a> <a href="#top">&uarr;</a></span></h3>
170
-
171
- <p>After downloading and expanding the archive, you can install midilib with
172
- the command</p>
173
-
174
- <pre>% ruby install.rb</pre>
175
-
176
- <p>(or)</p>
177
-
178
- <pre>% ruby install.rb --install-dir=my_directory</pre>
179
-
180
- <p>You may need root privileges to install.</p>
181
-
182
- <h2 id="label-Testing">Testing<span><a href="#label-Testing">&para;</a> <a href="#top">&uarr;</a></span></h2>
183
-
184
- <pre>% rake test</pre>
185
-
186
- <p>runs all of the tests in the test directory.</p>
187
-
188
- <h2 id="label-Overview">Overview<span><a href="#label-Overview">&para;</a> <a href="#top">&uarr;</a></span></h2>
189
-
190
- <p>The midilib <a href="MIDI.html">MIDI</a> file reader only understands <a
191
- href="MIDI.html">MIDI</a> file format 1, where a sequence is made up of
192
- multiple tracks. It doesn&#39;t yet understand format 0 (a single track
193
- containing all events) or format 2 (a collection of format 0 files in one
194
- file).</p>
195
-
196
- <h3 id="label-MIDI-3A-3ASequence"><a href="MIDI/Sequence.html">MIDI::Sequence</a><span><a href="#label-MIDI-3A-3ASequence">&para;</a> <a href="#top">&uarr;</a></span></h3>
197
-
198
- <p>A sequence contains a collection of tracks and global information like the
199
- sequence&#39;s pulses per quarter note (ppqn) and time signature.</p>
200
-
201
- <p>The first track in a sequence is special; it holds meta-events like tempo
202
- and sequence name. Don&#39;t put any notes in this track.</p>
203
-
204
- <p><a href="MIDI/Sequence.html">MIDI::Sequence</a> also contains some
205
- convenience methods that let you set and retrieve the sequence&#39;s name,
206
- the time signature, and to retrieve the first tempo event&#39;s
207
- beats-per-minute value.</p>
208
-
209
- <p>Normally instances of <a
210
- href="MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a> and <a
211
- href="MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a> are used when a
212
- sequence reads itself from or writes itself to a <a
213
- href="MIDI.html">MIDI</a> file. You can change that by setting a
214
- sequence&#39;s reader_class or writer_class attributes. Instances of the
215
- classes contained in those attributes are created and used whenever the
216
- sequence reads or writes itself.</p>
217
-
218
- <h3 id="label-MIDI-3A-3ATrack"><a href="MIDI/Track.html">MIDI::Track</a><span><a href="#label-MIDI-3A-3ATrack">&para;</a> <a href="#top">&uarr;</a></span></h3>
219
-
220
- <p>A track contains an array of events.</p>
221
-
222
- <p>When you modify the <code>events</code> array, make sure to call
223
- recalc_times so each event gets its <code>time_from_start</code>
224
- recalculated. You don&#39;t have to do that after every event you add; just
225
- remember to do so before using the track in a way that expects the list of
226
- events to be ordered correctly.</p>
227
-
228
- <p>A Track also holds a bit mask that specifies the channels used by the
229
- track. This bit mask is set when the track is read from the <a
230
- href="MIDI.html">MIDI</a> file by a SeqReader but is <em>not</em> kept up
231
- to date by any other methods. Specifically, if you add events to a track at
232
- any other time, the bit mask will not be updated.</p>
233
-
234
- <h3 id="label-MIDI-3A-3AMeasure"><a href="MIDI/Measure.html">MIDI::Measure</a><span><a href="#label-MIDI-3A-3AMeasure">&para;</a> <a href="#top">&uarr;</a></span></h3>
235
-
236
- <p>This class contains information about a measure from the sequence. Measure
237
- data is based on the time signature information from the sequence and is
238
- not stored in the sequence itself.</p>
239
-
240
- <h3 id="label-MIDI-3A-3AMeasures"><a href="MIDI/Measures.html">MIDI::Measures</a><span><a href="#label-MIDI-3A-3AMeasures">&para;</a> <a href="#top">&uarr;</a></span></h3>
241
-
242
- <p>The class <a href="MIDI/Sequence.html">MIDI::Sequence</a> method
243
- get_measures returns a <a href="MIDI/Measures.html">MIDI::Measures</a>
244
- object. <a href="MIDI/Measures.html">MIDI::Measures</a> is a subclass of
245
- Array. It is a specialized container for <a
246
- href="MIDI/Measure.html">MIDI::Measure</a> objects, which can be use to map
247
- event times to measure numbers. Please note that this object has to be
248
- remade when events are deleted/added in the sequence.</p>
249
-
250
- <p><a href="MIDI/Measure.html">MIDI::Measure</a> and <a
251
- href="MIDI/Measures.html">MIDI::Measures</a> are brought to us by Jari
252
- Williamsson &lt;jari.williamsson@mailbox.swipnet.se&gt;, who also
253
- contributed some improvements to the <a
254
- href="MIDI/Event.html">MIDI::Event</a> and <a
255
- href="MIDI/Track.html">MIDI::Track</a> classes.</p>
256
-
257
- <h3 id="label-MIDI-3A-3AEvent"><a href="MIDI/Event.html">MIDI::Event</a><span><a href="#label-MIDI-3A-3AEvent">&para;</a> <a href="#top">&uarr;</a></span></h3>
258
-
259
- <p>Each event holds not only its delta time but also its time from the start
260
- of the track. The track is responsible for recalculating its events&#39;
261
- start times. You can call <a
262
- href="MIDI/Track.html#method-i-recalc_times">MIDI::Track#recalc_times</a>
263
- to do so.</p>
264
-
265
- <p>Subclasses of <a href="MIDI/Event.html">MIDI::Event</a> implement the
266
- various <a href="MIDI.html">MIDI</a> messages such as note on and off,
267
- controller values, system exclusive data, and realtime bytes.</p>
268
-
269
- <p><a href="MIDI/Realtime.html">MIDI::Realtime</a> events have delta values
270
- and start times, just like all the other midilib event types do. (MIDI real
271
- time status bytes don&#39;t have delta times, but this way we can record
272
- when in a track the realtime byte was received and should be sent. This is
273
- useful for start/continue/stop events that control other devices, for
274
- example.) Note that when a <a href="MIDI/Realtime.html">MIDI::Realtime</a>
275
- event is written out to a <a href="MIDI.html">MIDI</a> file, the delta time
276
- is not written.</p>
277
-
278
- <p><a href="MIDI/MetaEvent.html">MIDI::MetaEvent</a> events hold an array of
279
- bytes named &#39;data&#39;. Many meta events are string holders (text,
280
- lyric, marker, etc.) Though the &#39;data&#39; value is always an array of
281
- bytes, <a href="MIDI/MetaEvent.html">MIDI::MetaEvent</a> helps with saving
282
- and accessing string. The <a
283
- href="MIDI/MetaEvent.html#method-i-data_as_str">MIDI::MetaEvent#data_as_str</a>
284
- method returns the data bytes as a string. When assigning to a meta
285
- event&#39;s data, if you pass in a string it will get converted to an array
286
- of bytes.</p>
287
-
288
- <h2 id="label-How+To+Use">How To Use<span><a href="#label-How+To+Use">&para;</a> <a href="#top">&uarr;</a></span></h2>
289
-
290
- <p>The following examples show you how to use midilib to read, write, and
291
- manipulate <a href="MIDI.html">MIDI</a> files and modify track events. See
292
- also the files in the examples directory, which are described below.</p>
293
-
294
- <h3 id="label-Reading+a+MIDI+File">Reading a <a href="MIDI.html">MIDI</a> File<span><a href="#label-Reading+a+MIDI+File">&para;</a> <a href="#top">&uarr;</a></span></h3>
295
-
296
- <p>To read a <a href="MIDI.html">MIDI</a> file, create a <a
297
- href="MIDI/Sequence.html">MIDI::Sequence</a> object and call its read
298
- method, passing in an <a href="IO.html">IO</a> object.</p>
299
-
300
- <p>The read method takes an optional block. If present, the block is called
301
- once after each track has finished being read. Each time, it is passed the
302
- track object, the total number of tracks and the number of the current
303
- track that has just been read. This is useful for notifying the user of
304
- progress, for example by updating a GUI progress bar.</p>
305
-
306
- <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;midilib/io/seqreader&#39;</span>
307
-
308
- <span class="ruby-comment"># Create a new, empty sequence.</span>
309
- <span class="ruby-identifier">seq</span> = <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Sequence</span>.<span class="ruby-identifier">new</span>()
310
-
311
- <span class="ruby-comment"># Read the contents of a MIDI file into the sequence.</span>
312
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&#39;my_midi_file.mid&#39;</span>, <span class="ruby-string">&#39;rb&#39;</span>) { <span class="ruby-operator">|</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">|</span>
313
- <span class="ruby-identifier">seq</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>) { <span class="ruby-operator">|</span> <span class="ruby-identifier">track</span>, <span class="ruby-identifier">num_tracks</span>, <span class="ruby-identifier">i</span> <span class="ruby-operator">|</span>
314
- <span class="ruby-comment"># Print something when each track is read.</span>
315
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;read track #{i} of #{num_tracks}&quot;</span>
316
- }
317
- }
318
- </pre>
319
-
320
- <h3 id="label-Writing+a+MIDI+File">Writing a <a href="MIDI.html">MIDI</a> File<span><a href="#label-Writing+a+MIDI+File">&para;</a> <a href="#top">&uarr;</a></span></h3>
321
-
322
- <p>To write a <a href="MIDI.html">MIDI</a> file, call the write method,
323
- passing in an <a href="IO.html">IO</a> object.</p>
324
-
325
- <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;midilib/io/seqwriter&#39;</span>
326
-
327
- <span class="ruby-comment"># Start with a sequence that has something worth saving.</span>
328
- <span class="ruby-identifier">seq</span> = <span class="ruby-identifier">read_or_create_seq_we_care_not_how</span>()
329
-
330
- <span class="ruby-comment"># Write the sequence to a MIDI file.</span>
331
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&#39;my_output_file.mid&#39;</span>, <span class="ruby-string">&#39;wb&#39;</span>) { <span class="ruby-operator">|</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">seq</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">file</span>) }
332
- </pre>
333
-
334
- <h3 id="label-Editing+a+MIDI+File">Editing a <a href="MIDI.html">MIDI</a> File<span><a href="#label-Editing+a+MIDI+File">&para;</a> <a href="#top">&uarr;</a></span></h3>
335
-
336
- <p>Combining the last two examples, here is a script that reads a <a
337
- href="MIDI.html">MIDI</a> file, transposes some events, and writes the
338
- sequence out to a different file. This is a useful template for
339
- programatically manipulating <a href="MIDI.html">MIDI</a> data.</p>
340
-
341
- <p>This code transposes all of the note events (note on, note off, and poly
342
- pressure) on channel 5 down one octave.</p>
343
-
344
- <h4 id="label-Transposing+One+Channel">Transposing One Channel<span><a href="#label-Transposing+One+Channel">&para;</a> <a href="#top">&uarr;</a></span></h4>
345
-
346
- <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;midilib/io/seqreader&#39;</span>
347
- <span class="ruby-identifier">require</span> <span class="ruby-string">&#39;midilib/io/seqwriter&#39;</span>
348
-
349
- <span class="ruby-comment"># Create a new, empty sequence.</span>
350
- <span class="ruby-identifier">seq</span> = <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Sequence</span>.<span class="ruby-identifier">new</span>()
351
-
352
- <span class="ruby-comment"># Read the contents of a MIDI file into the sequence.</span>
353
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&#39;my_input_file.mid&#39;</span>, <span class="ruby-string">&#39;rb&#39;</span>) { <span class="ruby-operator">|</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">|</span>
354
- <span class="ruby-identifier">seq</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>) { <span class="ruby-operator">|</span> <span class="ruby-identifier">track</span>, <span class="ruby-identifier">num_tracks</span>, <span class="ruby-identifier">i</span> <span class="ruby-operator">|</span>
355
- <span class="ruby-comment"># Print something when each track is read.</span>
356
- <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;read track #{i} of #{num_tracks}&quot;</span>
357
- }
358
- }
359
-
360
- <span class="ruby-comment"># Iterate over every event in every track.</span>
361
- <span class="ruby-identifier">seq</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">track</span> <span class="ruby-operator">|</span>
362
- <span class="ruby-identifier">track</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">event</span> <span class="ruby-operator">|</span>
363
- <span class="ruby-comment"># If the event is a note event (note on, note off, or poly</span>
364
- <span class="ruby-comment"># pressure) and it is on MIDI channel 5 (channels start at</span>
365
- <span class="ruby-comment"># 0, so we use 4), then transpose the event down one octave.</span>
366
- <span class="ruby-keyword">if</span> <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">NoteEvent</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">event</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">channel</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>
367
- <span class="ruby-identifier">event</span>.<span class="ruby-identifier">note</span> <span class="ruby-operator">-=</span> <span class="ruby-value">12</span>
368
- <span class="ruby-keyword">end</span>
369
- }
370
- }
371
-
372
- <span class="ruby-comment"># Write the sequence to a MIDI file.</span>
373
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&#39;my_output_file.mid&#39;</span>, <span class="ruby-string">&#39;wb&#39;</span>) { <span class="ruby-operator">|</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">seq</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">file</span>) }
374
- </pre>
375
-
376
- <h3 id="label-Manipulating+tracks">Manipulating tracks<span><a href="#label-Manipulating+tracks">&para;</a> <a href="#top">&uarr;</a></span></h3>
377
-
378
- <p>If you modify a track&#39;s list of events directly, don&#39;t forget to
379
- call <a
380
- href="MIDI/Track.html#method-i-recalc_times">MIDI::Track#recalc_times</a>
381
- when you are done.</p>
382
-
383
- <pre class="ruby"><span class="ruby-identifier">track</span>.<span class="ruby-identifier">events</span>[<span class="ruby-value">42</span>, <span class="ruby-value">1</span>] = <span class="ruby-identifier">array_of_events</span>
384
- <span class="ruby-identifier">track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">an_event</span>
385
- <span class="ruby-identifier">track</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">array_of_events</span>)
386
- <span class="ruby-identifier">track</span>.<span class="ruby-identifier">recalc_times</span>
387
- </pre>
388
-
389
- <h3 id="label-Calculating+delta+times">Calculating delta times<span><a href="#label-Calculating+delta+times">&para;</a> <a href="#top">&uarr;</a></span></h3>
390
-
391
- <p>A few methods in <a href="MIDI/Sequence.html">MIDI::Sequence</a> make it
392
- easier to calculate the delta times that represent note lengths. <a
393
- href="MIDI/Sequence.html#method-i-length_to_delta">MIDI::Sequence#length_to_delta</a>
394
- takes a note length (a multiple of a quarter note) and returns the delta
395
- time given the sequence&#39;s current ppqn (pulses per quarter note)
396
- setting. 1 is a quarter note, 1.0/32.0 is a 32nd note (use floating-point
397
- numbers to avoid integer rounding), 1.5 is a dotted quarter, etc. See the
398
- documentation for that method for more information.</p>
399
-
400
- <p><a
401
- href="MIDI/Sequence.html#method-i-note_to_length">MIDI::Sequence#note_to_length</a>
402
- takes a note name and returns a length value (again, as a multiple of a
403
- quarter note). Legal note names are those found in
404
- MIDI::Sequence::NOTE_TO_LENGTH, and may begin with “dotted” and/or end with
405
- “triplet”. For example, “whole”, “sixteenth”, “32nd”, “quarter triplet”,
406
- “dotted 16th”, and “dotted 8th triplet” are all legal note names.</p>
407
-
408
- <p>Finally, <a
409
- href="MIDI/Sequence.html#method-i-note_to_delta">MIDI::Sequence#note_to_delta</a>
410
- takes a note name and returns a delta time. It does this by calling
411
- note_to_length, then passing the result to length_to_delta.</p>
412
-
413
- <h3 id="label-Example+Scripts">Example Scripts<span><a href="#label-Example+Scripts">&para;</a> <a href="#top">&uarr;</a></span></h3>
414
-
415
- <p>Here are short descriptions of each of the examples found in the examples
416
- directory.</p>
417
- <ul><li>
418
- <p>examples/from_scratch.rb shows you how to create a new sequence from
419
- scratch and save it to a <a href="MIDI.html">MIDI</a> file. It creates a
420
- file called &#39;from_scratch.mid&#39;.</p>
421
- </li><li>
422
- <p>examples/seq2text.rb dumps a <a href="MIDI.html">MIDI</a> file as text. It
423
- reads in a sequence and uses the to_s method of each event.</p>
424
- </li><li>
425
- <p>examples/reader2text.rb dumps a <a href="MIDI.html">MIDI</a> file as text.
426
- It subclasses MIDI::SeqReader instead of creating a sequence containing
427
- tracks and events.</p>
428
- </li><li>
429
- <p>examples/transpose.rb transposes all note events (note on, note off, poly
430
- pressure) on a specified channel by a specified amount.</p>
431
- </li><li>
432
- <p>There is also one <a href="MIDI.html">MIDI</a> file, examples/NoFences.mid.
433
- It is a little pop ditty I wrote. The instruments in this file use General
434
- <a href="MIDI.html">MIDI</a> patch numbers and drum note assignments. Since
435
- I don&#39;t normally use GM patches, the sounds used here are at best
436
- approximations of the sounds I use.</p>
437
- </li></ul>
438
-
439
- <h2 id="label-Resources">Resources<span><a href="#label-Resources">&para;</a> <a href="#top">&uarr;</a></span></h2>
440
-
441
- <p>The Ruby Web site (<a
442
- href="http://www.ruby-lang.org/en/index.html">www.ruby-lang.org/en/index.html</a>)
443
- contains an introduction to Ruby, the Ruby Application Archive (RAA) at <a
444
- href="http://raa.ruby-lang.org">raa.ruby-lang.org</a>, and pointers to more
445
- information.</p>
446
-
447
- <p>&lt;cite&gt;Programming Ruby, The Pragmatic Programmer&#39;s
448
- Guide&lt;/cite&gt;, by David Thomas and Andrew Hunt, is a well-written and
449
- practical introduction to Ruby. Its Web page at <a
450
- href="http://www.rubycentral.com/book">www.rubycentral.com/book</a> also
451
- contains a wealth of Ruby information. Though the first edition book is
452
- available online, I encourage you to purchase a copy of the latest edition.</p>
453
-
454
- <p>A description of the <a href="MIDI.html">MIDI</a> file format can be found
455
- in a few places such as <a
456
- href="http://www.borg.com/~jglatt/tech/midifile.htm">www.borg.com/~jglatt/tech/midifile.htm</a>.</p>
457
-
458
- <p>The <a href="MIDI.html">MIDI</a> message reference at <a
459
- href="http://www.jimmenard.com/midi_ref.html">www.jimmenard.com/midi_ref.html</a>
460
- describes the format of <a href="MIDI.html">MIDI</a> commands.</p>
461
-
462
- <h1 id="label-To+Do">To Do<span><a href="#label-To+Do">&para;</a> <a href="#top">&uarr;</a></span></h1>
463
-
464
- <h2 id="label-Bugs">Bugs<span><a href="#label-Bugs">&para;</a> <a href="#top">&uarr;</a></span></h2>
465
-
466
- <p>No known bugs. (If that&#39;s not a challenge, I don&#39;t know what is.)</p>
467
-
468
- <h2 id="label-Features">Features<span><a href="#label-Features">&para;</a> <a href="#top">&uarr;</a></span></h2>
469
- <ul><li>
470
- <p><code>print_decimal_numbers</code> and
471
- <code>print_channel_numbers_from_one</code> should be associated with
472
- sequence, or perhaps track, not event.</p>
473
- </li><li>
474
- <p>Method to translate event&#39;s time_from_start to number of milliseconds
475
- from start.</p>
476
- </li><li>
477
- <p>Swing quantizing. (Implied by list email from Carl Youngblood
478
- &lt;carl.youngblood@gmail.com&gt;)</p>
479
- </li><li>
480
- <p>Implement key signature in SeqReader.</p>
481
- </li><li>
482
- <p>Format 0 files.</p>
483
- </li><li>
484
- <p>Format 2 files(?).</p>
485
- </li></ul>
486
-
487
- <h2 id="label-Documentation">Documentation<span><a href="#label-Documentation">&para;</a> <a href="#top">&uarr;</a></span></h2>
488
- <ul><li>
489
- <p>Write better docs.</p>
490
- </li></ul>
491
-
492
- <h2 id="label-Tests">Tests<span><a href="#label-Tests">&para;</a> <a href="#top">&uarr;</a></span></h2>
493
- <ul><li>
494
- <p>Tests for Noah Thorp&#39;s midilib bug fixes.</p>
495
- </li></ul>
496
-
497
- <h1 id="label-Support">Support<span><a href="#label-Support">&para;</a> <a href="#top">&uarr;</a></span></h1>
498
- <ul><li>
499
- <p>Visit the forums, bug list, and mailing list pages at <a
500
- href="http://rubyforge.org/projects/midilib">rubyforge.org/projects/midilib</a></p>
501
- </li><li>
502
- <p>Send email to Jim Menard at <a
503
- href="mailto:jim@jimmenard.com">jim@jimmenard.com</a></p>
504
- </li><li>
505
- <p>Ask on the ruby-talk mailing list</p>
506
- </li></ul>
507
-
508
- <h1 id="label-Administrivia">Administrivia<span><a href="#label-Administrivia">&para;</a> <a href="#top">&uarr;</a></span></h1>
509
- <dl class="rdoc-list note-list"><dt>Author
510
- <dd>
511
- <p>Jim Menard (<a href="mailto:jim@jimmenard.com">jim@jimmenard.com</a>)</p>
512
- </dd><dt>Copyright
513
- <dd>
514
- <p>Copyright © 2003-2013 Jim Menard</p>
515
- </dd><dt>License
516
- <dd>
517
- <p>Distributed under the same license as Ruby.</p>
518
- </dd></dl>
519
-
520
- <h2 id="label-Copying">Copying<span><a href="#label-Copying">&para;</a> <a href="#top">&uarr;</a></span></h2>
521
-
522
- <p>midilib is copyrighted free software by Jim Menard and is released under
523
- the same license as Ruby. See the Ruby license at <a
524
- href="http://www.ruby-lang.org/en/LICENSE.txt">www.ruby-lang.org/en/LICENSE.txt</a>.</p>
525
-
526
- <p>midilib may be freely copied in its entirety providing this notice, all
527
- source code, all documentation, and all other files are included.</p>
528
-
529
- <p>midilib is Copyright © 2003-2013 by Jim Menard.</p>
530
-
531
- <p>The song “No Fences” contained in the <a href="MIDI.html">MIDI</a> file
532
- examples/NoFences.mid is Copyright © 1992 by Jim Menard
533
- (jim@jimmenard.com). It may be freely used for non-commercial purposes as
534
- long as the author is given credit.</p>
535
-
536
- <h2 id="label-Recent+Changes">Recent Changes<span><a href="#label-Recent+Changes">&para;</a> <a href="#top">&uarr;</a></span></h2>
537
-
538
- <h3 id="label-Changes+for+2.0.5-3A">Changes for 2.0.5:<span><a href="#label-Changes+for+2.0.5-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
539
-
540
- <p>Updated <code>install.rb</code> to work with newer versions of Ruby by
541
- using <code>fileutils</code> instead of <code>ftools</code>.</p>
542
-
543
- <h3 id="label-Changes+for+2.0.3-3A">Changes for 2.0.3:<span><a href="#label-Changes+for+2.0.3-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
544
-
545
- <p>New <a
546
- href="MIDI/Sequence.html#method-i-pulses_to_seconds">MIDI::Sequence#pulses_to_seconds</a>
547
- method.</p>
548
-
549
- <h3 id="label-Changes+for+2.0.2-3A">Changes for 2.0.2:<span><a href="#label-Changes+for+2.0.2-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
550
-
551
- <p>Stop monkeypatching Array in <a href="MIDI/Track.html">MIDI::Track</a>.</p>
552
-
553
- <h3 id="label-Changes+for+2.0.0-3A">Changes for 2.0.0:<span><a href="#label-Changes+for+2.0.0-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
554
-
555
- <p><a href="MIDI/NoteOn.html">MIDI::NoteOnEvent</a> and <a
556
- href="MIDI/NoteOff.html">MIDI::NoteOffEvent</a> renamed to <a
557
- href="MIDI/NoteOn.html">MIDI::NoteOn</a> and <a
558
- href="MIDI/NoteOff.html">MIDI::NoteOff</a>. The old names will still work
559
- for a while.</p>
560
-
561
- <p>The <a href="MIDI/Event.html">MIDI::Event</a> boolean methods like meta?
562
- and note? have been removed. Use the event classes themselves (for example,
563
- <a href="MIDI/MetaEvent.html">MIDI::MetaEvent</a> === my_event or
564
- my_event.kind_of?(MIDI::MetaEvent)). Case statements that use classes work,
565
- too:</p>
566
-
567
- <pre class="ruby"><span class="ruby-keyword">case</span> <span class="ruby-identifier">my_event</span>
568
- <span class="ruby-keyword">when</span> <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">NoteEvent</span> <span class="ruby-comment"># superclass of note on, note off, poly press</span>
569
- <span class="ruby-identifier">do_this</span>()
570
- <span class="ruby-keyword">when</span> <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Controller</span>
571
- <span class="ruby-identifier">do_that</span>()
572
- <span class="ruby-keyword">end</span>
573
- </pre>
574
-
575
- <p>Introduced Adam Murray&#39;s stable sorting code for <a
576
- href="MIDI/Track.html#method-i-recalc_delta_from_times">MIDI::Track#recalc_delta_from_times</a>.
577
- See <a
578
- href="http://wiki.github.com/adamjmurray/cosy/midilib-notes">wiki.github.com/adamjmurray/cosy/midilib-notes</a>
579
- and <a
580
- href="http://github.com/adamjmurray/cosy/blob/master/lib/cosy/helper/midi_file_renderer_helper.rb">github.com/adamjmurray/cosy/blob/master/lib/cosy/helper/midi_file_renderer_helper.rb</a>
581
- for details.</p>
582
-
583
- <p>Aliased <a href="MIDI/Track.html#method-i-sort">MIDI::Track#sort</a> to <a
584
- href="MIDI/Track.html#method-i-recalc_delta_from_times">MIDI::Track#recalc_delta_from_times</a>,
585
- since all sort did was sort the events then call recalc_delta_from_times,
586
- and recalc_delta_from_times sorts the events before doing anything else.</p>
587
-
588
- <p>MIDI::Tempo#mpq_to_bpm now returns a float.</p>
589
-
590
- <h3 id="label-Changes+for+1.2.0-3A">Changes for 1.2.0:<span><a href="#label-Changes+for+1.2.0-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
591
-
592
- <p>Use byte arrays instead of strings for passing around data. All tests now
593
- pass for both Ruby 1.8.X and 1.9.X.</p>
594
-
595
- <h3 id="label-New+code+repository">New code repository<span><a href="#label-New+code+repository">&para;</a> <a href="#top">&uarr;</a></span></h3>
596
-
597
- <p>The midilib code is now hosted at Github (<a
598
- href="http://github.com/jimm/midilib">github.com/jimm/midilib</a>).</p>
599
-
600
- <h3 id="label-Changes+for+1.1.4-3A">Changes for 1.1.4:<span><a href="#label-Changes+for+1.1.4-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
601
- <ul><li>
602
- <p>Fixed a bug in KeySig.data_as_bytes. Thanks to Noah Thorp for finding this
603
- and the bug fixed in 1.1.3.</p>
604
- </li></ul>
605
-
606
- <h3 id="label-Changes+for+1.1.3-3A">Changes for 1.1.3:<span><a href="#label-Changes+for+1.1.3-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
607
- <ul><li>
608
- <p>Fixed the way midilib detects the behavior of IO.getc.</p>
609
- </li></ul>
610
-
611
- <h3 id="label-Changes+for+1.1.2-3A">Changes for 1.1.2:<span><a href="#label-Changes+for+1.1.2-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
612
- <ul><li>
613
- <p>Define <a
614
- href="MIDI/IO/MIDIFile.html#method-i-getc">MIDI::IO::MIDIFile#getc</a>
615
- differently for different Ruby versions, instead of checking for
616
- String.bytes every time we read a byte.</p>
617
- </li></ul>
618
-
619
- <h3 id="label-Changes+for+1.1.1-3A">Changes for 1.1.1:<span><a href="#label-Changes+for+1.1.1-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
620
- <ul><li>
621
- <p>Make <a
622
- href="MIDI/IO/MIDIFile.html#method-i-getc">MIDI::IO::MIDIFile#getc</a> do
623
- the right thing for both Ruby 1.8 and 1.9.</p>
624
- </li></ul>
625
-
626
- <h3 id="label-Changes+for+1.1.0-3A">Changes for 1.1.0:<span><a href="#label-Changes+for+1.1.0-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
627
- <ul><li>
628
- <p>Added test/test.mid to list of files to be included when packaging midifile
629
- for distribution.</p>
630
- </li></ul>
631
-
632
- <h3 id="label-Changes+for+1.0.0-3A">Changes for 1.0.0:<span><a href="#label-Changes+for+1.0.0-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
633
- <ul><li>
634
- <p>Fixed the bug in Track#recalc_delta_from_times found by Christopher Rose.</p>
635
- </li></ul>
636
-
637
- <h3 id="label-Changes+for+0.8.7-3A">Changes for 0.8.7:<span><a href="#label-Changes+for+0.8.7-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
638
- <ul><li>
639
- <p>Fixed the misspelled POLY_PRESSURE constant, thanks to Mario Pehle.</p>
640
- </li></ul>
641
-
642
- <h3 id="label-Changes+for+0.8.6-3A">Changes for 0.8.6:<span><a href="#label-Changes+for+0.8.6-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
643
- <ul><li>
644
- <p>Added missing test/test.mid.</p>
645
- </li></ul>
646
-
647
- <h3 id="label-Changes+for+0.8.5-3A">Changes for 0.8.5:<span><a href="#label-Changes+for+0.8.5-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
648
- <ul><li>
649
- <p>Fixed bugs in <a href="MIDI/PitchBend.html">MIDI::PitchBend</a> reading and
650
- writing, thanks to Emanuel Borsboom.</p>
651
- </li><li>
652
- <p>Fixed a bug in <a
653
- href="MIDI/Track.html#method-i-quantize">MIDI::Track#quantize</a>.</p>
654
- </li><li>
655
- <p>The argument to <a
656
- href="MIDI/Track.html#method-i-quantize">MIDI::Track#quantize</a> has
657
- changed: it is now either a note name (“sixteenth”, “32nd”, “8th triplet”)
658
- or a length (1 = quarter, 0.25 = sixteenth). This is a drastic change that
659
- will break all previous calls to quantize. However, since that method was
660
- broken already, I don&#39;t feel it&#39;s a burden to anybody to change the
661
- arguments.</p>
662
- </li></ul>
663
-
664
- <h3 id="label-Changes+for+0.8.4-3A">Changes for 0.8.4:<span><a href="#label-Changes+for+0.8.4-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
665
- <ul><li>
666
- <p>Realtime status bytes now set @is_realtime to true and return true when
667
- realtime? is called.</p>
668
- </li><li>
669
- <p>All system common events now set @is_system to true and return true when
670
- system? is called, not just system exclusive events.</p>
671
- </li><li>
672
- <p>Added examples/from_scratch.rb, which shows how to create a sequence
673
- manually.</p>
674
- </li><li>
675
- <p>New <a href="MIDI/Sequence.html">MIDI::Sequence</a> methods that turn note
676
- length names like “32nd”, “dotted quarter”, and “16th triplet” into delta
677
- times. See the docs below and MIDI::Sequence::length_to_delta,
678
- MIDI::Sequence::note_to_length, and MIDI::Sequence::note_to_delta.</p>
679
- </li></ul>
680
-
681
- <h3 id="label-Changes+for+0.8.3-3A">Changes for 0.8.3:<span><a href="#label-Changes+for+0.8.3-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
682
- <ul><li>
683
- <p>Added <a
684
- href="MIDI/NoteEvent.html#method-i-note_to_s">MIDI::NoteEvent#note_to_s</a>,
685
- which returns note name as a string like “C4” or “F#6”.</p>
686
- </li><li>
687
- <p>Added new boolean attributes to MIDI::Event: @print_decimal_numbers and
688
- @print_note_names. These are used by all Event to_s methods. See
689
- examples/seq2text.rb for an example.</p>
690
- </li></ul>
691
-
692
- <h3 id="label-Changes+for+0.8.2-3A">Changes for 0.8.2:<span><a href="#label-Changes+for+0.8.2-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
693
- <ul><li>
694
- <p>Changed MIDI::MetaEvent.type to MIDI::MetaEvent.event_type to avoid runtime
695
- complaints about Object#type calls.</p>
696
- </li><li>
697
- <p>Added &#39;b&#39; binary flag to file open modes for Windows.</p>
698
- </li><li>
699
- <p>Fixed $LOAD_PATH in example files.</p>
700
- </li><li>
701
- <p>Fixed read and write block arguments.</p>
702
- </li><li>
703
- <p>Fixed other example script bugs.</p>
704
- </li></ul>
705
-
706
- <h3 id="label-Changes+for+0.8.1-3A">Changes for 0.8.1:<span><a href="#label-Changes+for+0.8.1-3A">&para;</a> <a href="#top">&uarr;</a></span></h3>
707
- <ul><li>
708
- <p>Fixed track sorting.</p>
709
- </li><li>
710
- <p>Fixed track&#39;s recalc_delta_from_times method.</p>
711
- </li><li>
712
- <p>Fixed event quantization.</p>
713
- </li><li>
714
- <p>More tests and documentation.</p>
715
- </li></ul>
716
-
717
- <h2 id="label-Warranty">Warranty<span><a href="#label-Warranty">&para;</a> <a href="#top">&uarr;</a></span></h2>
718
-
719
- <p>This software is provided “as is” and without any express or implied
720
- warranties, including, without limitation, the implied warranties of
721
- merchantability and fitness for a particular purpose.</p>
722
- </main>
723
-
724
-
725
-
726
- <footer id="validator-badges" role="contentinfo">
727
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
728
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
729
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
730
- </footer>
731
-