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