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