midilib 3.1.0 → 4.0.0

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