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/README_rdoc.html
CHANGED
@@ -2,187 +2,149 @@
|
|
2
2
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
5
|
+
<meta charset="UTF-8">
|
6
6
|
|
7
7
|
<title>README - 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 class="file">
|
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
|
-
</
|
32
|
-
|
36
|
+
</div>
|
37
|
+
</div>
|
33
38
|
|
34
|
-
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
35
40
|
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<
|
37
|
-
<input
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
38
45
|
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
-
</
|
40
|
-
</form>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
46
|
+
</div>
|
44
47
|
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
45
53
|
|
46
|
-
|
47
|
-
<nav id="fileindex-section" class="section project-section">
|
48
|
-
<h3 class="section-header">Pages</h3>
|
54
|
+
</div>
|
49
55
|
|
50
|
-
<ul>
|
51
|
-
|
52
|
-
<li class="file"><a href="./README_rdoc.html">README</a>
|
53
|
-
|
54
|
-
<li class="file"><a href="./TODO_rdoc.html">TODO</a>
|
55
56
|
|
57
|
+
<div class="nav-section">
|
58
|
+
<h3>Table of Contents</h3>
|
59
|
+
|
60
|
+
<ul class="link-list" role="directory">
|
61
|
+
<li><a href="#label-midilib">midilib</a>
|
62
|
+
<li><a href="#label-Dependencies">Dependencies</a>
|
63
|
+
<li><a href="#label-Installation">Installation</a>
|
64
|
+
<li><a href="#label-RubyGems+Installation">RubyGems Installation</a>
|
65
|
+
<li><a href="#label-Manual+Installation">Manual Installation</a>
|
66
|
+
<li><a href="#label-Testing">Testing</a>
|
67
|
+
<li><a href="#label-Overview">Overview</a>
|
68
|
+
<li><a href="#label-MIDI-3A-3ASequence">MIDI::Sequence</a>
|
69
|
+
<li><a href="#label-MIDI-3A-3ATrack">MIDI::Track</a>
|
70
|
+
<li><a href="#label-MIDI-3A-3AMeasure">MIDI::Measure</a>
|
71
|
+
<li><a href="#label-MIDI-3A-3AMeasures">MIDI::Measures</a>
|
72
|
+
<li><a href="#label-MIDI-3A-3AEvent">MIDI::Event</a>
|
73
|
+
<li><a href="#label-How+To+Use">How To Use</a>
|
74
|
+
<li><a href="#label-Reading+a+MIDI+File">Reading a MIDI File</a>
|
75
|
+
<li><a href="#label-Writing+a+MIDI+File">Writing a MIDI File</a>
|
76
|
+
<li><a href="#label-Editing+a+MIDI+File">Editing a MIDI File</a>
|
77
|
+
<li><a href="#label-Transposing+One+Channel">Transposing One Channel</a>
|
78
|
+
<li><a href="#label-Manipulating+tracks">Manipulating tracks</a>
|
79
|
+
<li><a href="#label-Calculating+delta+times">Calculating delta times</a>
|
80
|
+
<li><a href="#label-Example+Scripts">Example Scripts</a>
|
81
|
+
<li><a href="#label-Resources">Resources</a>
|
82
|
+
<li><a href="#label-To+Do">To Do</a>
|
83
|
+
<li><a href="#label-Bugs">Bugs</a>
|
84
|
+
<li><a href="#label-Features">Features</a>
|
85
|
+
<li><a href="#label-Documentation">Documentation</a>
|
86
|
+
<li><a href="#label-Tests">Tests</a>
|
87
|
+
<li><a href="#label-Support">Support</a>
|
88
|
+
<li><a href="#label-Administrivia">Administrivia</a>
|
89
|
+
<li><a href="#label-Copying">Copying</a>
|
90
|
+
<li><a href="#label-Recent+Changes">Recent Changes</a>
|
91
|
+
<li><a href="#label-Changes+for+2.0.5-3A">Changes for 2.0.5:</a>
|
92
|
+
<li><a href="#label-Changes+for+2.0.3-3A">Changes for 2.0.3:</a>
|
93
|
+
<li><a href="#label-Changes+for+2.0.2-3A">Changes for 2.0.2:</a>
|
94
|
+
<li><a href="#label-Changes+for+2.0.0-3A">Changes for 2.0.0:</a>
|
95
|
+
<li><a href="#label-Changes+for+1.2.0-3A">Changes for 1.2.0:</a>
|
96
|
+
<li><a href="#label-New+code+repository">New code repository</a>
|
97
|
+
<li><a href="#label-Changes+for+1.1.4-3A">Changes for 1.1.4:</a>
|
98
|
+
<li><a href="#label-Changes+for+1.1.3-3A">Changes for 1.1.3:</a>
|
99
|
+
<li><a href="#label-Changes+for+1.1.2-3A">Changes for 1.1.2:</a>
|
100
|
+
<li><a href="#label-Changes+for+1.1.1-3A">Changes for 1.1.1:</a>
|
101
|
+
<li><a href="#label-Changes+for+1.1.0-3A">Changes for 1.1.0:</a>
|
102
|
+
<li><a href="#label-Changes+for+1.0.0-3A">Changes for 1.0.0:</a>
|
103
|
+
<li><a href="#label-Changes+for+0.8.7-3A">Changes for 0.8.7:</a>
|
104
|
+
<li><a href="#label-Changes+for+0.8.6-3A">Changes for 0.8.6:</a>
|
105
|
+
<li><a href="#label-Changes+for+0.8.5-3A">Changes for 0.8.5:</a>
|
106
|
+
<li><a href="#label-Changes+for+0.8.4-3A">Changes for 0.8.4:</a>
|
107
|
+
<li><a href="#label-Changes+for+0.8.3-3A">Changes for 0.8.3:</a>
|
108
|
+
<li><a href="#label-Changes+for+0.8.2-3A">Changes for 0.8.2:</a>
|
109
|
+
<li><a href="#label-Changes+for+0.8.1-3A">Changes for 0.8.1:</a>
|
110
|
+
<li><a href="#label-Warranty">Warranty</a>
|
56
111
|
</ul>
|
57
|
-
</
|
112
|
+
</div>
|
113
|
+
|
58
114
|
|
59
|
-
|
60
|
-
|
115
|
+
<div id="project-metadata">
|
116
|
+
|
117
|
+
<div id="fileindex-section" class="nav-section">
|
118
|
+
<h3>Pages</h3>
|
61
119
|
|
62
120
|
<ul class="link-list">
|
63
|
-
|
64
|
-
<li><a href="./
|
65
|
-
|
66
|
-
<li><a href="./MIDI/ActiveSense.html">MIDI::ActiveSense</a>
|
67
|
-
|
68
|
-
<li><a href="./MIDI/ChannelEvent.html">MIDI::ChannelEvent</a>
|
69
|
-
|
70
|
-
<li><a href="./MIDI/ChannelPressure.html">MIDI::ChannelPressure</a>
|
71
|
-
|
72
|
-
<li><a href="./MIDI/Clock.html">MIDI::Clock</a>
|
73
|
-
|
74
|
-
<li><a href="./MIDI/Continue.html">MIDI::Continue</a>
|
75
|
-
|
76
|
-
<li><a href="./MIDI/Controller.html">MIDI::Controller</a>
|
77
|
-
|
78
|
-
<li><a href="./MIDI/Event.html">MIDI::Event</a>
|
79
|
-
|
80
|
-
<li><a href="./MIDI/IO.html">MIDI::IO</a>
|
81
|
-
|
82
|
-
<li><a href="./MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a>
|
83
|
-
|
84
|
-
<li><a href="./MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a>
|
85
|
-
|
86
|
-
<li><a href="./MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>
|
87
|
-
|
88
|
-
<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
|
-
<li><a href="./MIDI/Marker.html">MIDI::Marker</a>
|
97
|
-
|
98
|
-
<li><a href="./MIDI/Measure.html">MIDI::Measure</a>
|
99
|
-
|
100
|
-
<li><a href="./MIDI/Measures.html">MIDI::Measures</a>
|
101
|
-
|
102
|
-
<li><a href="./MIDI/MetaEvent.html">MIDI::MetaEvent</a>
|
103
|
-
|
104
|
-
<li><a href="./MIDI/NoteEvent.html">MIDI::NoteEvent</a>
|
105
|
-
|
106
|
-
<li><a href="./MIDI/NoteOff.html">MIDI::NoteOff</a>
|
107
|
-
|
108
|
-
<li><a href="./MIDI/NoteOff.html">MIDI::NoteOffEvent</a>
|
109
|
-
|
110
|
-
<li><a href="./MIDI/NoteOn.html">MIDI::NoteOn</a>
|
111
|
-
|
112
|
-
<li><a href="./MIDI/NoteOn.html">MIDI::NoteOnEvent</a>
|
113
|
-
|
114
|
-
<li><a href="./MIDI/PitchBend.html">MIDI::PitchBend</a>
|
115
|
-
|
116
|
-
<li><a href="./MIDI/PolyPressure.html">MIDI::PolyPressure</a>
|
117
|
-
|
118
|
-
<li><a href="./MIDI/ProgramChange.html">MIDI::ProgramChange</a>
|
119
|
-
|
120
|
-
<li><a href="./MIDI/Realtime.html">MIDI::Realtime</a>
|
121
|
-
|
122
|
-
<li><a href="./MIDI/Sequence.html">MIDI::Sequence</a>
|
123
|
-
|
124
|
-
<li><a href="./MIDI/SongPointer.html">MIDI::SongPointer</a>
|
125
|
-
|
126
|
-
<li><a href="./MIDI/SongSelect.html">MIDI::SongSelect</a>
|
127
|
-
|
128
|
-
<li><a href="./MIDI/Start.html">MIDI::Start</a>
|
129
|
-
|
130
|
-
<li><a href="./MIDI/Stop.html">MIDI::Stop</a>
|
131
|
-
|
132
|
-
<li><a href="./MIDI/SystemCommon.html">MIDI::SystemCommon</a>
|
133
|
-
|
134
|
-
<li><a href="./MIDI/SystemExclusive.html">MIDI::SystemExclusive</a>
|
135
|
-
|
136
|
-
<li><a href="./MIDI/SystemReset.html">MIDI::SystemReset</a>
|
137
|
-
|
138
|
-
<li><a href="./MIDI/Tempo.html">MIDI::Tempo</a>
|
139
|
-
|
140
|
-
<li><a href="./MIDI/TimeSig.html">MIDI::TimeSig</a>
|
141
|
-
|
142
|
-
<li><a href="./MIDI/Track.html">MIDI::Track</a>
|
143
|
-
|
144
|
-
<li><a href="./MIDI/TuneRequest.html">MIDI::TuneRequest</a>
|
145
|
-
|
146
|
-
<li><a href="./MIDI/Utils.html">MIDI::Utils</a>
|
147
|
-
|
148
|
-
<li><a href="./IO.html">IO</a>
|
149
|
-
|
121
|
+
<li><a href="./README_rdoc.html">README</a>
|
122
|
+
<li><a href="./TODO_rdoc.html">TODO</a>
|
150
123
|
</ul>
|
151
|
-
</
|
124
|
+
</div>
|
152
125
|
|
153
126
|
</div>
|
154
127
|
</nav>
|
155
128
|
|
156
|
-
<
|
157
|
-
|
158
|
-
<h1 id="label-midilib">midilib
|
129
|
+
<main role="main" aria-label="Page README.rdoc">
|
130
|
+
|
131
|
+
<h1 id="label-midilib">midilib<span><a href="#label-midilib">¶</a> <a href="#top">↑</a></span></h1>
|
159
132
|
|
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>
|
133
|
+
<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
134
|
|
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>
|
135
|
+
<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
136
|
|
170
|
-
<p>midilib is compatible with
|
137
|
+
<p>midilib is compatible with Ruby 2.6 and higher.</p>
|
171
138
|
|
172
|
-
<h2 id="label-Dependencies">Dependencies
|
139
|
+
<h2 id="label-Dependencies">Dependencies<span><a href="#label-Dependencies">¶</a> <a href="#top">↑</a></span></h2>
|
173
140
|
|
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>
|
141
|
+
<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
142
|
|
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>
|
143
|
+
<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
144
|
|
183
|
-
<h2 id="label-Installation">Installation
|
145
|
+
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#top">↑</a></span></h2>
|
184
146
|
|
185
|
-
<h3 id="label-RubyGems+Installation">RubyGems Installation
|
147
|
+
<h3 id="label-RubyGems+Installation">RubyGems Installation<span><a href="#label-RubyGems+Installation">¶</a> <a href="#top">↑</a></span></h3>
|
186
148
|
|
187
149
|
<p>To install midilib as a gem, type</p>
|
188
150
|
|
@@ -194,10 +156,9 @@ href="http://rake.rubyforge.org">rake.rubyforge.org</a>).</p>
|
|
194
156
|
|
195
157
|
<p>You may need root privileges to install or update the gem.</p>
|
196
158
|
|
197
|
-
<h3 id="label-Manual+Installation">Manual Installation
|
159
|
+
<h3 id="label-Manual+Installation">Manual Installation<span><a href="#label-Manual+Installation">¶</a> <a href="#top">↑</a></span></h3>
|
198
160
|
|
199
|
-
<p>After downloading and expanding the archive, you can install midilib with
|
200
|
-
the command</p>
|
161
|
+
<p>After downloading and expanding the archive, you can install midilib with the command</p>
|
201
162
|
|
202
163
|
<pre>% ruby install.rb</pre>
|
203
164
|
|
@@ -207,136 +168,71 @@ the command</p>
|
|
207
168
|
|
208
169
|
<p>You may need root privileges to install.</p>
|
209
170
|
|
210
|
-
<h2 id="label-Testing">Testing
|
171
|
+
<h2 id="label-Testing">Testing<span><a href="#label-Testing">¶</a> <a href="#top">↑</a></span></h2>
|
211
172
|
|
212
173
|
<pre>% rake test</pre>
|
213
174
|
|
214
175
|
<p>runs all of the tests in the test directory.</p>
|
215
176
|
|
216
|
-
<h2 id="label-Overview">Overview
|
177
|
+
<h2 id="label-Overview">Overview<span><a href="#label-Overview">¶</a> <a href="#top">↑</a></span></h2>
|
217
178
|
|
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>
|
179
|
+
<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
180
|
|
224
|
-
<
|
181
|
+
<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
182
|
|
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>
|
183
|
+
<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
184
|
|
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>
|
185
|
+
<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
186
|
|
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>
|
187
|
+
<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
188
|
|
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>
|
189
|
+
<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
190
|
|
246
|
-
<h3 id="label-MIDI
|
191
|
+
<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
192
|
|
248
193
|
<p>A track contains an array of events.</p>
|
249
194
|
|
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>
|
195
|
+
<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>
|
196
|
+
|
197
|
+
<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>
|
198
|
+
|
199
|
+
<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>
|
200
|
+
|
201
|
+
<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>
|
202
|
+
|
203
|
+
<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>
|
204
|
+
|
205
|
+
<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>
|
206
|
+
|
207
|
+
<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>
|
208
|
+
|
209
|
+
<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>
|
210
|
+
|
211
|
+
<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>
|
212
|
+
|
213
|
+
<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>
|
214
|
+
|
215
|
+
<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>
|
216
|
+
|
217
|
+
<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>
|
218
|
+
|
219
|
+
<h2 id="label-How+To+Use">How To Use<span><a href="#label-How+To+Use">¶</a> <a href="#top">↑</a></span></h2>
|
220
|
+
|
221
|
+
<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>
|
222
|
+
|
223
|
+
<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>
|
224
|
+
|
225
|
+
<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>
|
226
|
+
|
227
|
+
<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>
|
228
|
+
|
229
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'midilib/io/seqreader'</span>
|
334
230
|
|
335
231
|
<span class="ruby-comment"># Create a new, empty sequence.</span>
|
336
232
|
<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
233
|
|
338
234
|
<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"
|
235
|
+
<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
236
|
<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
237
|
<span class="ruby-comment"># Print something when each track is read.</span>
|
342
238
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"read track #{i} of #{num_tracks}"</span>
|
@@ -344,40 +240,35 @@ progress, for example by updating a GUI progress bar.</p>
|
|
344
240
|
}
|
345
241
|
</pre>
|
346
242
|
|
347
|
-
<h3 id="label-Writing+a+MIDI+File">Writing a <a href="MIDI.html">MIDI</a> File
|
243
|
+
<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
244
|
|
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>
|
245
|
+
<p>To write a <a href="MIDI.html"><code>MIDI</code></a> file, call the write method, passing in an IO object.</p>
|
351
246
|
|
352
|
-
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string"
|
247
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'midilib/io/seqwriter'</span>
|
353
248
|
|
354
249
|
<span class="ruby-comment"># Start with a sequence that has something worth saving.</span>
|
355
250
|
<span class="ruby-identifier">seq</span> = <span class="ruby-identifier">read_or_create_seq_we_care_not_how</span>()
|
356
251
|
|
357
252
|
<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"
|
253
|
+
<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
254
|
</pre>
|
360
255
|
|
361
|
-
<h3 id="label-Editing+a+MIDI+File">Editing a <a href="MIDI.html">MIDI</a> File
|
256
|
+
<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
257
|
|
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>
|
258
|
+
<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
259
|
|
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>
|
260
|
+
<p>This code transposes all of the note events (note on, note off, and poly pressure) on channel 5 down one octave.</p>
|
370
261
|
|
371
|
-
<h4 id="label-Transposing+One+Channel">Transposing One Channel
|
262
|
+
<h4 id="label-Transposing+One+Channel">Transposing One Channel<span><a href="#label-Transposing+One+Channel">¶</a> <a href="#top">↑</a></span></h4>
|
372
263
|
|
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"
|
264
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'midilib/io/seqreader'</span>
|
265
|
+
<span class="ruby-identifier">require</span> <span class="ruby-string">'midilib/io/seqwriter'</span>
|
375
266
|
|
376
267
|
<span class="ruby-comment"># Create a new, empty sequence.</span>
|
377
268
|
<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
269
|
|
379
270
|
<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"
|
271
|
+
<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
272
|
<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
273
|
<span class="ruby-comment"># Print something when each track is read.</span>
|
383
274
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"read track #{i} of #{num_tracks}"</span>
|
@@ -397,323 +288,228 @@ pressure) on channel 5 down one octave.</p>
|
|
397
288
|
}
|
398
289
|
|
399
290
|
<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"
|
291
|
+
<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>) }
|
292
|
+
</pre>
|
293
|
+
|
294
|
+
<h3 id="label-Manipulating+tracks">Manipulating tracks<span><a href="#label-Manipulating+tracks">¶</a> <a href="#top">↑</a></span></h3>
|
295
|
+
|
296
|
+
<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>
|
297
|
+
|
298
|
+
<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>
|
299
|
+
<span class="ruby-identifier">track</span>.<span class="ruby-identifier">events</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">an_event</span>
|
300
|
+
<span class="ruby-identifier">track</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">array_of_events</span>)
|
301
|
+
<span class="ruby-identifier">track</span>.<span class="ruby-identifier">recalc_times</span>
|
401
302
|
</pre>
|
402
303
|
|
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>
|
304
|
+
<h3 id="label-Calculating+delta+times">Calculating delta times<span><a href="#label-Calculating+delta+times">¶</a> <a href="#top">↑</a></span></h3>
|
305
|
+
|
306
|
+
<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>
|
307
|
+
|
308
|
+
<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>
|
309
|
+
|
310
|
+
<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>
|
311
|
+
|
312
|
+
<h3 id="label-Example+Scripts">Example Scripts<span><a href="#label-Example+Scripts">¶</a> <a href="#top">↑</a></span></h3>
|
313
|
+
|
314
|
+
<p>Here are short descriptions of each of the examples found in the examples directory.</p>
|
442
315
|
<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>
|
316
|
+
<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
317
|
</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>
|
318
|
+
<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
319
|
</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>
|
320
|
+
<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
321
|
</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>
|
322
|
+
<p>examples/transpose.rb transposes all note events (note on, note off, poly pressure) on a specified channel by a specified amount.</p>
|
456
323
|
</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>
|
324
|
+
<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
325
|
</li></ul>
|
463
326
|
|
464
|
-
<h2 id="label-Resources">Resources
|
327
|
+
<h2 id="label-Resources">Resources<span><a href="#label-Resources">¶</a> <a href="#top">↑</a></span></h2>
|
465
328
|
|
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>
|
329
|
+
<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
330
|
|
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>
|
331
|
+
<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
332
|
|
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>
|
333
|
+
<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
334
|
|
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>
|
335
|
+
<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
336
|
|
487
|
-
<h1 id="label-To+Do">To Do
|
337
|
+
<h1 id="label-To+Do">To Do<span><a href="#label-To+Do">¶</a> <a href="#top">↑</a></span></h1>
|
488
338
|
|
489
|
-
<h2 id="label-Bugs">Bugs
|
339
|
+
<h2 id="label-Bugs">Bugs<span><a href="#label-Bugs">¶</a> <a href="#top">↑</a></span></h2>
|
490
340
|
|
491
|
-
<p>
|
341
|
+
<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
342
|
|
493
|
-
<h2 id="label-Features">Features
|
343
|
+
<h2 id="label-Features">Features<span><a href="#label-Features">¶</a> <a href="#top">↑</a></span></h2>
|
494
344
|
<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>
|
345
|
+
<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
346
|
</li><li>
|
499
|
-
<p>Method to translate event
|
500
|
-
start.</p>
|
347
|
+
<p>Method to translate event’s time_from_start to number of milliseconds from start.</p>
|
501
348
|
</li><li>
|
502
|
-
<p>Swing quantizing. (Implied by list email from Carl Youngblood <gmail
|
503
|
-
carl.youngblood.com>)</p>
|
349
|
+
<p>Swing quantizing. (Implied by list email from Carl Youngblood <carl.youngblood@gmail.com>)</p>
|
504
350
|
</li><li>
|
505
351
|
<p>Implement key signature in SeqReader.</p>
|
506
352
|
</li><li>
|
507
|
-
<p>
|
353
|
+
<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
354
|
</li><li>
|
509
355
|
<p>Format 2 files(?).</p>
|
510
356
|
</li></ul>
|
511
357
|
|
512
|
-
<h2 id="label-Documentation">Documentation
|
358
|
+
<h2 id="label-Documentation">Documentation<span><a href="#label-Documentation">¶</a> <a href="#top">↑</a></span></h2>
|
513
359
|
<ul><li>
|
514
360
|
<p>Write better docs.</p>
|
515
361
|
</li></ul>
|
516
362
|
|
517
|
-
<h2 id="label-Tests">Tests
|
363
|
+
<h2 id="label-Tests">Tests<span><a href="#label-Tests">¶</a> <a href="#top">↑</a></span></h2>
|
518
364
|
<ul><li>
|
519
|
-
<p>Tests for Noah Thorp
|
365
|
+
<p>Tests for Noah Thorp’s midilib bug fixes.</p>
|
520
366
|
</li></ul>
|
521
367
|
|
522
|
-
<h1 id="label-Support">Support
|
368
|
+
<h1 id="label-Support">Support<span><a href="#label-Support">¶</a> <a href="#top">↑</a></span></h1>
|
523
369
|
<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>
|
370
|
+
<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
371
|
</li><li>
|
527
|
-
<p>Send email to Jim Menard at <a
|
528
|
-
href="mailto:jim@jimmenard.com">jim@jimmenard.com</a></p>
|
372
|
+
<p>Send email to Jim Menard at <a href="mailto:jim@jimmenard.com">jim@jimmenard.com</a></p>
|
529
373
|
</li><li>
|
530
374
|
<p>Ask on the ruby-talk mailing list</p>
|
531
375
|
</li></ul>
|
532
376
|
|
533
|
-
<h1 id="label-Administrivia">Administrivia
|
377
|
+
<h1 id="label-Administrivia">Administrivia<span><a href="#label-Administrivia">¶</a> <a href="#top">↑</a></span></h1>
|
534
378
|
<dl class="rdoc-list note-list"><dt>Author
|
535
379
|
<dd>
|
536
380
|
<p>Jim Menard (<a href="mailto:jim@jimmenard.com">jim@jimmenard.com</a>)</p>
|
537
381
|
</dd><dt>Copyright
|
538
382
|
<dd>
|
539
|
-
<p>Copyright
|
383
|
+
<p>Copyright © 2003-2013 Jim Menard</p>
|
540
384
|
</dd><dt>License
|
541
385
|
<dd>
|
542
386
|
<p>Distributed under the same license as Ruby.</p>
|
543
387
|
</dd></dl>
|
544
388
|
|
545
|
-
<h2 id="label-Copying">Copying
|
389
|
+
<h2 id="label-Copying">Copying<span><a href="#label-Copying">¶</a> <a href="#top">↑</a></span></h2>
|
390
|
+
|
391
|
+
<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
392
|
|
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>
|
393
|
+
<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
394
|
|
551
|
-
<p>midilib
|
552
|
-
source code, all documentation, and all other files are included.</p>
|
395
|
+
<p>midilib is Copyright © 2003-2013 by Jim Menard.</p>
|
553
396
|
|
554
|
-
<p>
|
397
|
+
<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
398
|
|
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>
|
399
|
+
<h2 id="label-Recent+Changes">Recent Changes<span><a href="#label-Recent+Changes">¶</a> <a href="#top">↑</a></span></h2>
|
560
400
|
|
561
|
-
<
|
401
|
+
<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
402
|
|
563
|
-
<
|
403
|
+
<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
404
|
|
565
|
-
<
|
566
|
-
href="MIDI/Sequence.html#method-i-pulses_to_seconds">MIDI::Sequence#pulses_to_seconds</a>
|
567
|
-
method.</p>
|
405
|
+
<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
406
|
|
569
|
-
<
|
407
|
+
<p>New <a href="MIDI/Sequence.html#method-i-pulses_to_seconds"><code>MIDI::Sequence.pulses_to_seconds</code></a> method.</p>
|
570
408
|
|
571
|
-
<
|
409
|
+
<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
410
|
|
573
|
-
<
|
411
|
+
<p>Stop monkeypatching Array in <a href="MIDI/Track.html"><code>MIDI::Track</code></a>.</p>
|
574
412
|
|
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>
|
413
|
+
<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
414
|
|
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>
|
415
|
+
<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
416
|
|
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>
|
417
|
+
<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
418
|
|
594
|
-
<
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
419
|
+
<pre class="ruby"><span class="ruby-keyword">case</span> <span class="ruby-identifier">my_event</span>
|
420
|
+
<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>
|
421
|
+
<span class="ruby-identifier">do_this</span>()
|
422
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">MIDI</span><span class="ruby-operator">::</span><span class="ruby-constant">Controller</span>
|
423
|
+
<span class="ruby-identifier">do_that</span>()
|
424
|
+
<span class="ruby-keyword">end</span>
|
425
|
+
</pre>
|
426
|
+
|
427
|
+
<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
428
|
|
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>
|
429
|
+
<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
430
|
|
607
431
|
<p>MIDI::Tempo#mpq_to_bpm now returns a float.</p>
|
608
432
|
|
609
|
-
<h3 id="label-Changes+for+1.2.0
|
433
|
+
<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
434
|
|
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>
|
435
|
+
<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
436
|
|
614
|
-
<h3 id="label-New+code+repository">New code repository
|
437
|
+
<h3 id="label-New+code+repository">New code repository<span><a href="#label-New+code+repository">¶</a> <a href="#top">↑</a></span></h3>
|
615
438
|
|
616
|
-
<p>The midilib code is now hosted at Github (<a
|
617
|
-
href="http://github.com/jimm/midilib">github.com/jimm/midilib</a>).</p>
|
439
|
+
<p>The midilib code is now hosted at Github (<a href="http://github.com/jimm/midilib">github.com/jimm/midilib</a>).</p>
|
618
440
|
|
619
|
-
<h3 id="label-Changes+for+1.1.4
|
441
|
+
<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
442
|
<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>
|
443
|
+
<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
444
|
</li></ul>
|
624
445
|
|
625
|
-
<h3 id="label-Changes+for+1.1.3
|
446
|
+
<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
447
|
<ul><li>
|
627
448
|
<p>Fixed the way midilib detects the behavior of IO.getc.</p>
|
628
449
|
</li></ul>
|
629
450
|
|
630
|
-
<h3 id="label-Changes+for+1.1.2
|
451
|
+
<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
452
|
<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>
|
453
|
+
<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
454
|
</li></ul>
|
637
455
|
|
638
|
-
<h3 id="label-Changes+for+1.1.1
|
456
|
+
<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
457
|
<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>
|
458
|
+
<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
459
|
</li></ul>
|
644
460
|
|
645
|
-
<h3 id="label-Changes+for+1.1.0
|
461
|
+
<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
462
|
<ul><li>
|
647
|
-
<p>Added test/test.mid to list of files to be included when packaging midifile
|
648
|
-
for distribution.</p>
|
463
|
+
<p>Added test/test.mid to list of files to be included when packaging midifile for distribution.</p>
|
649
464
|
</li></ul>
|
650
465
|
|
651
|
-
<h3 id="label-Changes+for+1.0.0
|
466
|
+
<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
467
|
<ul><li>
|
653
468
|
<p>Fixed the bug in Track#recalc_delta_from_times found by Christopher Rose.</p>
|
654
469
|
</li></ul>
|
655
470
|
|
656
|
-
<h3 id="label-Changes+for+0.8.7
|
471
|
+
<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
472
|
<ul><li>
|
658
473
|
<p>Fixed the misspelled POLY_PRESSURE constant, thanks to Mario Pehle.</p>
|
659
474
|
</li></ul>
|
660
475
|
|
661
|
-
<h3 id="label-Changes+for+0.8.6
|
476
|
+
<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
477
|
<ul><li>
|
663
478
|
<p>Added missing test/test.mid.</p>
|
664
479
|
</li></ul>
|
665
480
|
|
666
|
-
<h3 id="label-Changes+for+0.8.5
|
481
|
+
<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
482
|
<ul><li>
|
668
|
-
<p>Fixed bugs in <a href="MIDI/PitchBend.html">MIDI::PitchBend</a> reading and
|
669
|
-
writing, thanks to Emanuel Borsboom.</p>
|
483
|
+
<p>Fixed bugs in <a href="MIDI/PitchBend.html"><code>MIDI::PitchBend</code></a> reading and writing, thanks to Emanuel Borsboom.</p>
|
670
484
|
</li><li>
|
671
|
-
<p>Fixed a bug in <a
|
672
|
-
href="MIDI/Track.html#method-i-quantize">MIDI::Track#quantize</a>.</p>
|
485
|
+
<p>Fixed a bug in <a href="MIDI/Track.html#method-i-quantize"><code>MIDI::Track#quantize</code></a>.</p>
|
673
486
|
</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>
|
487
|
+
<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
488
|
</li></ul>
|
682
489
|
|
683
|
-
<h3 id="label-Changes+for+0.8.4
|
490
|
+
<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
491
|
<ul><li>
|
685
|
-
<p>Realtime status bytes now set @is_realtime to true and return true when
|
686
|
-
realtime? is called.</p>
|
492
|
+
<p>Realtime status bytes now set @is_realtime to true and return true when realtime? is called.</p>
|
687
493
|
</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>
|
494
|
+
<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
495
|
</li><li>
|
691
|
-
<p>Added examples/from_scratch.rb, which shows how to create a sequence
|
692
|
-
manually.</p>
|
496
|
+
<p>Added examples/from_scratch.rb, which shows how to create a sequence manually.</p>
|
693
497
|
</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>
|
498
|
+
<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
499
|
</li></ul>
|
699
500
|
|
700
|
-
<h3 id="label-Changes+for+0.8.3
|
501
|
+
<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
502
|
<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>
|
503
|
+
<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
504
|
</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>
|
505
|
+
<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
506
|
</li></ul>
|
710
507
|
|
711
|
-
<h3 id="label-Changes+for+0.8.2
|
508
|
+
<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
509
|
<ul><li>
|
713
|
-
<p>Changed MIDI::MetaEvent.type to MIDI::MetaEvent.event_type to avoid runtime
|
714
|
-
complaints about Object#type calls.</p>
|
510
|
+
<p>Changed MIDI::MetaEvent.type to MIDI::MetaEvent.event_type to avoid runtime complaints about Object#type calls.</p>
|
715
511
|
</li><li>
|
716
|
-
<p>Added
|
512
|
+
<p>Added ‘b’ binary flag to file open modes for Windows.</p>
|
717
513
|
</li><li>
|
718
514
|
<p>Fixed $LOAD_PATH in example files.</p>
|
719
515
|
</li><li>
|
@@ -722,30 +518,28 @@ complaints about Object#type calls.</p>
|
|
722
518
|
<p>Fixed other example script bugs.</p>
|
723
519
|
</li></ul>
|
724
520
|
|
725
|
-
<h3 id="label-Changes+for+0.8.1
|
521
|
+
<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
522
|
<ul><li>
|
727
523
|
<p>Fixed track sorting.</p>
|
728
524
|
</li><li>
|
729
|
-
<p>Fixed track
|
525
|
+
<p>Fixed track’s recalc_delta_from_times method.</p>
|
730
526
|
</li><li>
|
731
527
|
<p>Fixed event quantization.</p>
|
732
528
|
</li><li>
|
733
529
|
<p>More tests and documentation.</p>
|
734
530
|
</li></ul>
|
735
531
|
|
736
|
-
<h2 id="label-Warranty">Warranty
|
532
|
+
<h2 id="label-Warranty">Warranty<span><a href="#label-Warranty">¶</a> <a href="#top">↑</a></span></h2>
|
737
533
|
|
738
|
-
<p>This software is provided
|
739
|
-
warranties, including, without limitation, the implied warranties of
|
740
|
-
merchantability and fitness for a particular purpose.</p>
|
534
|
+
<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
535
|
|
742
|
-
</
|
536
|
+
</main>
|
743
537
|
|
744
538
|
|
745
539
|
|
746
|
-
<footer id="validator-badges">
|
747
|
-
<p><a href="
|
748
|
-
<p>Generated by <a href="https://github.
|
749
|
-
<p>
|
540
|
+
<footer id="validator-badges" role="contentinfo">
|
541
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
542
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
543
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
750
544
|
</footer>
|
751
545
|
|