midilib 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -1
- data/lib/midilib/info.rb +1 -1
- data/lib/midilib/io/midifile.rb +10 -4
- metadata +2 -296
- data/html/classes/MIDI.html +0 -758
- data/html/classes/MIDI/ActiveSense.html +0 -156
- data/html/classes/MIDI/ActiveSense.src/M000157.html +0 -18
- data/html/classes/MIDI/ActiveSense.src/M000158.html +0 -18
- data/html/classes/MIDI/ChannelEvent.html +0 -179
- data/html/classes/MIDI/ChannelEvent.src/M000129.html +0 -20
- data/html/classes/MIDI/ChannelEvent.src/M000130.html +0 -18
- data/html/classes/MIDI/ChannelPressure.html +0 -184
- data/html/classes/MIDI/ChannelPressure.src/M000089.html +0 -19
- data/html/classes/MIDI/ChannelPressure.src/M000090.html +0 -21
- data/html/classes/MIDI/ChannelPressure.src/M000091.html +0 -18
- data/html/classes/MIDI/Clock.html +0 -156
- data/html/classes/MIDI/Clock.src/M000145.html +0 -18
- data/html/classes/MIDI/Clock.src/M000146.html +0 -18
- data/html/classes/MIDI/Continue.html +0 -156
- data/html/classes/MIDI/Continue.src/M000143.html +0 -18
- data/html/classes/MIDI/Continue.src/M000144.html +0 -18
- data/html/classes/MIDI/Controller.html +0 -189
- data/html/classes/MIDI/Controller.src/M000134.html +0 -21
- data/html/classes/MIDI/Controller.src/M000135.html +0 -22
- data/html/classes/MIDI/Controller.src/M000136.html +0 -18
- data/html/classes/MIDI/Event.html +0 -507
- data/html/classes/MIDI/Event.src/M000166.html +0 -30
- data/html/classes/MIDI/Event.src/M000167.html +0 -18
- data/html/classes/MIDI/Event.src/M000168.html +0 -18
- data/html/classes/MIDI/Event.src/M000169.html +0 -18
- data/html/classes/MIDI/Event.src/M000170.html +0 -18
- data/html/classes/MIDI/Event.src/M000171.html +0 -18
- data/html/classes/MIDI/Event.src/M000172.html +0 -18
- data/html/classes/MIDI/Event.src/M000173.html +0 -18
- data/html/classes/MIDI/Event.src/M000174.html +0 -18
- data/html/classes/MIDI/Event.src/M000175.html +0 -18
- data/html/classes/MIDI/Event.src/M000176.html +0 -18
- data/html/classes/MIDI/Event.src/M000177.html +0 -18
- data/html/classes/MIDI/Event.src/M000178.html +0 -22
- data/html/classes/MIDI/Event.src/M000179.html +0 -18
- data/html/classes/MIDI/Event.src/M000180.html +0 -18
- data/html/classes/MIDI/Event.src/M000181.html +0 -19
- data/html/classes/MIDI/Event.src/M000182.html +0 -18
- data/html/classes/MIDI/IO.html +0 -121
- data/html/classes/MIDI/IO/MIDIFile.html +0 -931
- data/html/classes/MIDI/IO/MIDIFile.src/M000029.html +0 -22
- data/html/classes/MIDI/IO/MIDIFile.src/M000030.html +0 -24
- data/html/classes/MIDI/IO/MIDIFile.src/M000031.html +0 -20
- data/html/classes/MIDI/IO/MIDIFile.src/M000032.html +0 -19
- data/html/classes/MIDI/IO/MIDIFile.src/M000033.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000034.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000035.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000036.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000037.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000038.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000039.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000040.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000041.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000042.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000043.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000044.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000045.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000046.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000047.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000048.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000049.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000050.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000051.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000052.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000053.html +0 -17
- data/html/classes/MIDI/IO/MIDIFile.src/M000054.html +0 -43
- data/html/classes/MIDI/IO/MIDIFile.src/M000055.html +0 -34
- data/html/classes/MIDI/IO/MIDIFile.src/M000056.html +0 -96
- data/html/classes/MIDI/IO/MIDIFile.src/M000057.html +0 -18
- data/html/classes/MIDI/IO/MIDIFile.src/M000058.html +0 -48
- data/html/classes/MIDI/IO/MIDIFile.src/M000059.html +0 -42
- data/html/classes/MIDI/IO/MIDIFile.src/M000060.html +0 -19
- data/html/classes/MIDI/IO/MIDIFile.src/M000061.html +0 -19
- data/html/classes/MIDI/IO/MIDIFile.src/M000062.html +0 -20
- data/html/classes/MIDI/IO/MIDIFile.src/M000063.html +0 -21
- data/html/classes/MIDI/IO/MIDIFile.src/M000064.html +0 -31
- data/html/classes/MIDI/IO/MIDIFile.src/M000065.html +0 -20
- data/html/classes/MIDI/IO/MIDIFile.src/M000066.html +0 -22
- data/html/classes/MIDI/IO/MIDIFile.src/M000067.html +0 -30
- data/html/classes/MIDI/IO/MIDIFile.src/M000068.html +0 -18
- data/html/classes/MIDI/IO/MIDIFile.src/M000069.html +0 -20
- data/html/classes/MIDI/IO/MIDIFile.src/M000070.html +0 -18
- data/html/classes/MIDI/IO/MIDIFile.src/M000071.html +0 -18
- data/html/classes/MIDI/IO/SeqReader.html +0 -476
- data/html/classes/MIDI/IO/SeqReader.src/M000001.html +0 -22
- data/html/classes/MIDI/IO/SeqReader.src/M000002.html +0 -22
- data/html/classes/MIDI/IO/SeqReader.src/M000003.html +0 -21
- data/html/classes/MIDI/IO/SeqReader.src/M000004.html +0 -34
- data/html/classes/MIDI/IO/SeqReader.src/M000005.html +0 -26
- data/html/classes/MIDI/IO/SeqReader.src/M000006.html +0 -28
- data/html/classes/MIDI/IO/SeqReader.src/M000007.html +0 -21
- data/html/classes/MIDI/IO/SeqReader.src/M000008.html +0 -19
- data/html/classes/MIDI/IO/SeqReader.src/M000009.html +0 -19
- data/html/classes/MIDI/IO/SeqReader.src/M000010.html +0 -19
- data/html/classes/MIDI/IO/SeqReader.src/M000011.html +0 -19
- data/html/classes/MIDI/IO/SeqReader.src/M000012.html +0 -19
- data/html/classes/MIDI/IO/SeqReader.src/M000013.html +0 -18
- data/html/classes/MIDI/IO/SeqReader.src/M000014.html +0 -18
- data/html/classes/MIDI/IO/SeqReader.src/M000015.html +0 -29
- data/html/classes/MIDI/IO/SeqReader.src/M000016.html +0 -19
- data/html/classes/MIDI/IO/SeqReader.src/M000017.html +0 -18
- data/html/classes/MIDI/IO/SeqReader.src/M000018.html +0 -18
- data/html/classes/MIDI/IO/SeqReader.src/M000019.html +0 -18
- data/html/classes/MIDI/IO/SeqWriter.html +0 -267
- data/html/classes/MIDI/IO/SeqWriter.src/M000020.html +0 -19
- data/html/classes/MIDI/IO/SeqWriter.src/M000021.html +0 -25
- data/html/classes/MIDI/IO/SeqWriter.src/M000022.html +0 -22
- data/html/classes/MIDI/IO/SeqWriter.src/M000023.html +0 -54
- data/html/classes/MIDI/IO/SeqWriter.src/M000024.html +0 -49
- data/html/classes/MIDI/IO/SeqWriter.src/M000025.html +0 -21
- data/html/classes/MIDI/IO/SeqWriter.src/M000026.html +0 -19
- data/html/classes/MIDI/IO/SeqWriter.src/M000027.html +0 -24
- data/html/classes/MIDI/IO/SeqWriter.src/M000028.html +0 -26
- data/html/classes/MIDI/KeySig.html +0 -241
- data/html/classes/MIDI/KeySig.src/M000137.html +0 -19
- data/html/classes/MIDI/KeySig.src/M000138.html +0 -23
- data/html/classes/MIDI/KeySig.src/M000139.html +0 -18
- data/html/classes/MIDI/KeySig.src/M000140.html +0 -18
- data/html/classes/MIDI/KeySig.src/M000141.html +0 -18
- data/html/classes/MIDI/KeySig.src/M000142.html +0 -23
- data/html/classes/MIDI/Marker.html +0 -139
- data/html/classes/MIDI/Marker.src/M000111.html +0 -18
- data/html/classes/MIDI/Measure.html +0 -242
- data/html/classes/MIDI/Measure.src/M000147.html +0 -23
- data/html/classes/MIDI/Measure.src/M000148.html +0 -20
- data/html/classes/MIDI/Measure.src/M000149.html +0 -18
- data/html/classes/MIDI/Measures.html +0 -217
- data/html/classes/MIDI/Measures.src/M000105.html +0 -20
- data/html/classes/MIDI/Measures.src/M000106.html +0 -18
- data/html/classes/MIDI/Measures.src/M000107.html +0 -21
- data/html/classes/MIDI/MetaEvent.html +0 -189
- data/html/classes/MIDI/MetaEvent.src/M000192.html +0 -21
- data/html/classes/MIDI/MetaEvent.src/M000193.html +0 -23
- data/html/classes/MIDI/MetaEvent.src/M000194.html +0 -53
- data/html/classes/MIDI/NoteEvent.html +0 -233
- data/html/classes/MIDI/NoteEvent.src/M000092.html +0 -21
- data/html/classes/MIDI/NoteEvent.src/M000093.html +0 -20
- data/html/classes/MIDI/NoteEvent.src/M000094.html +0 -18
- data/html/classes/MIDI/NoteEvent.src/M000095.html +0 -22
- data/html/classes/MIDI/NoteOffEvent.html +0 -169
- data/html/classes/MIDI/NoteOffEvent.src/M000087.html +0 -19
- data/html/classes/MIDI/NoteOffEvent.src/M000088.html +0 -19
- data/html/classes/MIDI/NoteOnEvent.html +0 -169
- data/html/classes/MIDI/NoteOnEvent.src/M000103.html +0 -19
- data/html/classes/MIDI/NoteOnEvent.src/M000104.html +0 -19
- data/html/classes/MIDI/PitchBend.html +0 -184
- data/html/classes/MIDI/PitchBend.src/M000108.html +0 -19
- data/html/classes/MIDI/PitchBend.src/M000109.html +0 -22
- data/html/classes/MIDI/PitchBend.src/M000110.html +0 -18
- data/html/classes/MIDI/PolyPressure.html +0 -186
- data/html/classes/MIDI/PolyPressure.src/M000195.html +0 -18
- data/html/classes/MIDI/PolyPressure.src/M000196.html +0 -18
- data/html/classes/MIDI/PolyPressure.src/M000197.html +0 -18
- data/html/classes/MIDI/PolyPressure.src/M000198.html +0 -19
- data/html/classes/MIDI/ProgramChange.html +0 -184
- data/html/classes/MIDI/ProgramChange.src/M000100.html +0 -20
- data/html/classes/MIDI/ProgramChange.src/M000101.html +0 -21
- data/html/classes/MIDI/ProgramChange.src/M000102.html +0 -18
- data/html/classes/MIDI/Realtime.html +0 -171
- data/html/classes/MIDI/Realtime.src/M000084.html +0 -19
- data/html/classes/MIDI/Realtime.src/M000085.html +0 -20
- data/html/classes/MIDI/Realtime.src/M000086.html +0 -18
- data/html/classes/MIDI/Sequence.html +0 -500
- data/html/classes/MIDI/Sequence.src/M000112.html +0 -28
- data/html/classes/MIDI/Sequence.src/M000113.html +0 -21
- data/html/classes/MIDI/Sequence.src/M000114.html +0 -22
- data/html/classes/MIDI/Sequence.src/M000117.html +0 -18
- data/html/classes/MIDI/Sequence.src/M000118.html +0 -27
- data/html/classes/MIDI/Sequence.src/M000119.html +0 -18
- data/html/classes/MIDI/Sequence.src/M000120.html +0 -19
- data/html/classes/MIDI/Sequence.src/M000121.html +0 -19
- data/html/classes/MIDI/Sequence.src/M000122.html +0 -19
- data/html/classes/MIDI/Sequence.src/M000123.html +0 -19
- data/html/classes/MIDI/Sequence.src/M000124.html +0 -18
- data/html/classes/MIDI/Sequence.src/M000125.html +0 -54
- data/html/classes/MIDI/SongPointer.html +0 -184
- data/html/classes/MIDI/SongPointer.src/M000159.html +0 -19
- data/html/classes/MIDI/SongPointer.src/M000160.html +0 -22
- data/html/classes/MIDI/SongPointer.src/M000161.html +0 -18
- data/html/classes/MIDI/SongSelect.html +0 -184
- data/html/classes/MIDI/SongSelect.src/M000131.html +0 -19
- data/html/classes/MIDI/SongSelect.src/M000132.html +0 -21
- data/html/classes/MIDI/SongSelect.src/M000133.html +0 -18
- data/html/classes/MIDI/Start.html +0 -156
- data/html/classes/MIDI/Start.src/M000098.html +0 -18
- data/html/classes/MIDI/Start.src/M000099.html +0 -18
- data/html/classes/MIDI/Stop.html +0 -156
- data/html/classes/MIDI/Stop.src/M000096.html +0 -18
- data/html/classes/MIDI/Stop.src/M000097.html +0 -18
- data/html/classes/MIDI/SystemCommon.html +0 -139
- data/html/classes/MIDI/SystemCommon.src/M000165.html +0 -19
- data/html/classes/MIDI/SystemExclusive.html +0 -184
- data/html/classes/MIDI/SystemExclusive.src/M000162.html +0 -19
- data/html/classes/MIDI/SystemExclusive.src/M000163.html +0 -23
- data/html/classes/MIDI/SystemExclusive.src/M000164.html +0 -18
- data/html/classes/MIDI/SystemReset.html +0 -156
- data/html/classes/MIDI/SystemReset.src/M000082.html +0 -18
- data/html/classes/MIDI/SystemReset.src/M000083.html +0 -18
- data/html/classes/MIDI/Tempo.html +0 -250
- data/html/classes/MIDI/Tempo.src/M000183.html +0 -18
- data/html/classes/MIDI/Tempo.src/M000184.html +0 -20
- data/html/classes/MIDI/Tempo.src/M000185.html +0 -18
- data/html/classes/MIDI/Tempo.src/M000186.html +0 -18
- data/html/classes/MIDI/Tempo.src/M000187.html +0 -18
- data/html/classes/MIDI/Tempo.src/M000188.html +0 -25
- data/html/classes/MIDI/Tempo.src/M000189.html +0 -18
- data/html/classes/MIDI/TimeSig.html +0 -263
- data/html/classes/MIDI/TimeSig.src/M000150.html +0 -19
- data/html/classes/MIDI/TimeSig.src/M000151.html +0 -25
- data/html/classes/MIDI/TimeSig.src/M000152.html +0 -18
- data/html/classes/MIDI/TimeSig.src/M000153.html +0 -18
- data/html/classes/MIDI/TimeSig.src/M000154.html +0 -18
- data/html/classes/MIDI/TimeSig.src/M000155.html +0 -18
- data/html/classes/MIDI/TimeSig.src/M000156.html +0 -18
- data/html/classes/MIDI/Track.html +0 -389
- data/html/classes/MIDI/Track.src/M000072.html +0 -23
- data/html/classes/MIDI/Track.src/M000073.html +0 -21
- data/html/classes/MIDI/Track.src/M000074.html +0 -26
- data/html/classes/MIDI/Track.src/M000075.html +0 -18
- data/html/classes/MIDI/Track.src/M000076.html +0 -22
- data/html/classes/MIDI/Track.src/M000077.html +0 -25
- data/html/classes/MIDI/Track.src/M000078.html +0 -22
- data/html/classes/MIDI/Track.src/M000079.html +0 -26
- data/html/classes/MIDI/Track.src/M000080.html +0 -18
- data/html/classes/MIDI/Track.src/M000081.html +0 -19
- data/html/classes/MIDI/TuneRequest.html +0 -171
- data/html/classes/MIDI/TuneRequest.src/M000126.html +0 -18
- data/html/classes/MIDI/TuneRequest.src/M000127.html +0 -20
- data/html/classes/MIDI/TuneRequest.src/M000128.html +0 -18
- data/html/classes/MIDI/Utils.html +0 -190
- data/html/classes/MIDI/Utils.src/M000190.html +0 -20
- data/html/classes/MIDI/Utils.src/M000191.html +0 -25
- data/html/created.rid +0 -1
- data/html/files/README.html +0 -681
- data/html/files/TODO.html +0 -142
- data/html/files/lib/midilib/consts_rb.html +0 -107
- data/html/files/lib/midilib/event_rb.html +0 -109
- data/html/files/lib/midilib/info_rb.html +0 -101
- data/html/files/lib/midilib/io/midifile_rb.html +0 -108
- data/html/files/lib/midilib/io/seqreader_rb.html +0 -110
- data/html/files/lib/midilib/io/seqwriter_rb.html +0 -115
- data/html/files/lib/midilib/measure_rb.html +0 -108
- data/html/files/lib/midilib/sequence_rb.html +0 -110
- data/html/files/lib/midilib/track_rb.html +0 -108
- data/html/files/lib/midilib/utils_rb.html +0 -101
- data/html/files/lib/midilib_rb.html +0 -124
- data/html/fr_class_index.html +0 -63
- data/html/fr_file_index.html +0 -39
- data/html/fr_method_index.html +0 -224
- data/html/index.html +0 -24
- data/html/rdoc-style.css +0 -208
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>to_s (MIDI::TuneRequest)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/midilib/event.rb, line 404</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
15
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">super</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"tune req"</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,190 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: MIDI::Utils</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">MIDI::Utils</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/midilib/utils_rb.html">
|
59
|
-
lib/midilib/utils.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
Utility methods.
|
84
|
-
</p>
|
85
|
-
|
86
|
-
</div>
|
87
|
-
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<div id="method-list">
|
92
|
-
<h3 class="section-bar">Methods</h3>
|
93
|
-
|
94
|
-
<div class="name-list">
|
95
|
-
<a href="#M000191">as_var_len</a>
|
96
|
-
<a href="#M000190">note_to_s</a>
|
97
|
-
</div>
|
98
|
-
</div>
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
|
103
|
-
<!-- if includes -->
|
104
|
-
|
105
|
-
<div id="section">
|
106
|
-
|
107
|
-
|
108
|
-
<div id="constants-list">
|
109
|
-
<h3 class="section-bar">Constants</h3>
|
110
|
-
|
111
|
-
<div class="name-list">
|
112
|
-
<table summary="Constants">
|
113
|
-
<tr class="top-aligned-row context-row">
|
114
|
-
<td class="context-item-name">NOTE_NAMES</td>
|
115
|
-
<td>=</td>
|
116
|
-
<td class="context-item-value">[ 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'</td>
|
117
|
-
<td width="3em"> </td>
|
118
|
-
<td class="context-item-desc">
|
119
|
-
<a href="../MIDI.html">MIDI</a> note names. NOTE_NAMES[0] is
|
120
|
-
‘C’, NOTE_NAMES[1] is ‘C#’, etc.
|
121
|
-
|
122
|
-
</td>
|
123
|
-
</tr>
|
124
|
-
</table>
|
125
|
-
</div>
|
126
|
-
</div>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<!-- if method_list -->
|
134
|
-
<div id="methods">
|
135
|
-
<h3 class="section-bar">Public Class methods</h3>
|
136
|
-
|
137
|
-
<div id="method-M000191" class="method-detail">
|
138
|
-
<a name="M000191"></a>
|
139
|
-
|
140
|
-
<div class="method-heading">
|
141
|
-
<a href="Utils.src/M000191.html" target="Code" class="method-signature"
|
142
|
-
onclick="popupCode('Utils.src/M000191.html');return false;">
|
143
|
-
<span class="method-name">as_var_len</span><span class="method-args">(val)</span>
|
144
|
-
</a>
|
145
|
-
</div>
|
146
|
-
|
147
|
-
<div class="method-description">
|
148
|
-
<p>
|
149
|
-
Given an integer, returns it as a variable length array of bytes (the
|
150
|
-
format used by <a href="../MIDI.html">MIDI</a> files).
|
151
|
-
</p>
|
152
|
-
<p>
|
153
|
-
The converse operation—converting a var len into a
|
154
|
-
number—requires input from a stream of bytes. Therefore we
|
155
|
-
don‘t supply it here. That is a part of the MIDIFile class.
|
156
|
-
</p>
|
157
|
-
</div>
|
158
|
-
</div>
|
159
|
-
|
160
|
-
<div id="method-M000190" class="method-detail">
|
161
|
-
<a name="M000190"></a>
|
162
|
-
|
163
|
-
<div class="method-heading">
|
164
|
-
<a href="Utils.src/M000190.html" target="Code" class="method-signature"
|
165
|
-
onclick="popupCode('Utils.src/M000190.html');return false;">
|
166
|
-
<span class="method-name">note_to_s</span><span class="method-args">(num)</span>
|
167
|
-
</a>
|
168
|
-
</div>
|
169
|
-
|
170
|
-
<div class="method-description">
|
171
|
-
<p>
|
172
|
-
Given a <a href="../MIDI.html">MIDI</a> note number, return the name and
|
173
|
-
octave as a string.
|
174
|
-
</p>
|
175
|
-
</div>
|
176
|
-
</div>
|
177
|
-
|
178
|
-
|
179
|
-
</div>
|
180
|
-
|
181
|
-
|
182
|
-
</div>
|
183
|
-
|
184
|
-
|
185
|
-
<div id="validator-badges">
|
186
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
</body>
|
190
|
-
</html>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>note_to_s (MIDI::Utils)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/midilib/utils.rb, line 12</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">note_to_s</span>(<span class="ruby-identifier">num</span>)
|
15
|
-
<span class="ruby-identifier">note</span> = <span class="ruby-identifier">num</span> <span class="ruby-operator">%</span> <span class="ruby-value">12</span>
|
16
|
-
<span class="ruby-identifier">octave</span> = <span class="ruby-identifier">num</span> <span class="ruby-operator">/</span> <span class="ruby-value">12</span>
|
17
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{NOTE_NAMES[note]}#{octave - 1}"</span>
|
18
|
-
<span class="ruby-keyword kw">end</span></pre>
|
19
|
-
</body>
|
20
|
-
</html>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>as_var_len (MIDI::Utils)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/midilib/utils.rb, line 24</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Utils</span>.<span class="ruby-identifier">as_var_len</span>(<span class="ruby-identifier">val</span>)
|
15
|
-
<span class="ruby-identifier">buffer</span> = <span class="ruby-value str">''</span>
|
16
|
-
<span class="ruby-identifier">buffer</span> <span class="ruby-operator"><<</span> (<span class="ruby-identifier">val</span> <span class="ruby-operator">&</span> <span class="ruby-value">0x7f</span>)
|
17
|
-
<span class="ruby-identifier">val</span> = (<span class="ruby-identifier">val</span> <span class="ruby-operator">>></span> <span class="ruby-value">7</span>)
|
18
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
19
|
-
<span class="ruby-identifier">buffer</span> <span class="ruby-operator"><<</span> (<span class="ruby-value">0x80</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">val</span> <span class="ruby-operator">&</span> <span class="ruby-value">0x7f</span>))
|
20
|
-
<span class="ruby-identifier">val</span> = (<span class="ruby-identifier">val</span> <span class="ruby-operator">>></span> <span class="ruby-value">7</span>)
|
21
|
-
<span class="ruby-keyword kw">end</span>
|
22
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">reverse!</span>
|
23
|
-
<span class="ruby-keyword kw">end</span></pre>
|
24
|
-
</body>
|
25
|
-
</html>
|
data/html/created.rid
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Sat, 08 Nov 2008 10:24:47 -0500
|
data/html/files/README.html
DELETED
@@ -1,681 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>File: README</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="fileHeader">
|
50
|
-
<h1>README</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>README
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Sat Nov 08 10:23:27 -0500 2008</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<h1>midilib</h1>
|
73
|
-
<p>
|
74
|
-
midilib is a pure Ruby <a href="../classes/MIDI.html">MIDI</a> library
|
75
|
-
useful for reading and writing standard <a
|
76
|
-
href="../classes/MIDI.html">MIDI</a> files and manipulating <a
|
77
|
-
href="../classes/MIDI.html">MIDI</a> event data. Classes include <a
|
78
|
-
href="../classes/MIDI/Sequence.html">MIDI::Sequence</a>, <a
|
79
|
-
href="../classes/MIDI/Track.html">MIDI::Track</a>, <a
|
80
|
-
href="../classes/MIDI/Event.html">MIDI::Event</a>, and <a
|
81
|
-
href="../classes/MIDI/IO/MIDIFile.html">MIDI::IO::MIDIFile</a> and its
|
82
|
-
subclasses <a
|
83
|
-
href="../classes/MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a> and <a
|
84
|
-
href="../classes/MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a>.
|
85
|
-
</p>
|
86
|
-
<p>
|
87
|
-
The Web site of midilib is (<a
|
88
|
-
href="http://midilib.rubyforge.org">midilib.rubyforge.org</a>). The
|
89
|
-
RubyForge project page is <a
|
90
|
-
href="http://rubyforge.org/projects/midilib">rubyforge.org/projects/midilib</a>,
|
91
|
-
where the latest version of midilib may be downloaded. midilib is also
|
92
|
-
available as a RubyGem.
|
93
|
-
</p>
|
94
|
-
<h2>Dependencies</h2>
|
95
|
-
<p>
|
96
|
-
midilib does not require any other packages. The test suite in the tests
|
97
|
-
directory requires the testing framework TestUnit, which comes with Ruby
|
98
|
-
1.8 and later and can also be found in the Ruby Application Archive (<a
|
99
|
-
href="http://raa.ruby-lang.org">raa.ruby-lang.org</a>).
|
100
|
-
</p>
|
101
|
-
<p>
|
102
|
-
To rebuild the gem or RDocs or run the tests easily, you can use the
|
103
|
-
Rakefile which requires Rake (<a
|
104
|
-
href="http://rake.rubyforge.org">rake.rubyforge.org</a>).
|
105
|
-
</p>
|
106
|
-
<h2>Installation</h2>
|
107
|
-
<h3>RubyGems Installation</h3>
|
108
|
-
<p>
|
109
|
-
To install midilib as a gem, type
|
110
|
-
</p>
|
111
|
-
<pre>
|
112
|
-
% gem install midilib
|
113
|
-
</pre>
|
114
|
-
<p>
|
115
|
-
or
|
116
|
-
</p>
|
117
|
-
<pre>
|
118
|
-
% gem update midilib
|
119
|
-
</pre>
|
120
|
-
<p>
|
121
|
-
if you already have a previous version. You may need root privileges to
|
122
|
-
install or update the gem.
|
123
|
-
</p>
|
124
|
-
<h3>Manual Installation</h3>
|
125
|
-
<p>
|
126
|
-
After downloading and expanding the archive, you can install midilib with
|
127
|
-
the command
|
128
|
-
</p>
|
129
|
-
<pre>
|
130
|
-
% ruby install.rb
|
131
|
-
</pre>
|
132
|
-
<p>
|
133
|
-
(or)
|
134
|
-
</p>
|
135
|
-
<pre>
|
136
|
-
% ruby install.rb --install-dir=my_directory
|
137
|
-
</pre>
|
138
|
-
<p>
|
139
|
-
You may need root privileges to install.
|
140
|
-
</p>
|
141
|
-
<h2>Testing</h2>
|
142
|
-
<pre>
|
143
|
-
% rake test
|
144
|
-
</pre>
|
145
|
-
<p>
|
146
|
-
runs all of the tests in the test directory.
|
147
|
-
</p>
|
148
|
-
<h2>Overview</h2>
|
149
|
-
<p>
|
150
|
-
<a href="../classes/MIDI.html">MIDI</a> file IO only understands <a
|
151
|
-
href="../classes/MIDI.html">MIDI</a> file format 1, where a sequence is
|
152
|
-
made up of multiple tracks. It doesn‘t yet understand format 0 (a
|
153
|
-
single track containing all events) or format 2 (a collection of format 0
|
154
|
-
files in one file).
|
155
|
-
</p>
|
156
|
-
<h3><a href="../classes/MIDI/Sequence.html">MIDI::Sequence</a></h3>
|
157
|
-
<p>
|
158
|
-
A sequence contains a collection of tracks and global information like the
|
159
|
-
sequence‘s pulses per quarter note (ppqn) and time signature.
|
160
|
-
</p>
|
161
|
-
<p>
|
162
|
-
The first track in a sequence is special; it holds meta-events like tempo
|
163
|
-
and sequence name. Don‘t put any notes in this track.
|
164
|
-
</p>
|
165
|
-
<p>
|
166
|
-
<a href="../classes/MIDI/Sequence.html">MIDI::Sequence</a> also contains
|
167
|
-
some convenience methods that let you set and retrieve the sequence‘s
|
168
|
-
name, the time signature, and to retrieve the first tempo event‘s
|
169
|
-
beats-per-minute value.
|
170
|
-
</p>
|
171
|
-
<p>
|
172
|
-
Normally instances of <a
|
173
|
-
href="../classes/MIDI/IO/SeqReader.html">MIDI::IO::SeqReader</a> and <a
|
174
|
-
href="../classes/MIDI/IO/SeqWriter.html">MIDI::IO::SeqWriter</a> are used
|
175
|
-
when a sequence reads itself from or writes itself to a <a
|
176
|
-
href="../classes/MIDI.html">MIDI</a> file. You can change that by setting a
|
177
|
-
sequence‘s reader_class or writer_class attributes. Instances of the
|
178
|
-
classes contained in those attributes are created and used whenever the
|
179
|
-
sequence reads or writes itself.
|
180
|
-
</p>
|
181
|
-
<h3><a href="../classes/MIDI/Track.html">MIDI::Track</a></h3>
|
182
|
-
<p>
|
183
|
-
A track contains an array of events.
|
184
|
-
</p>
|
185
|
-
<p>
|
186
|
-
When you modify the <tt>events</tt> array, make sure to call recalc_times
|
187
|
-
so each event gets its <tt>time_from_start</tt> recalculated. You
|
188
|
-
don‘t have to do that after every event you add; just remember to do
|
189
|
-
so before using the track in a way that expects the list of events to be
|
190
|
-
ordered correctly.
|
191
|
-
</p>
|
192
|
-
<p>
|
193
|
-
A Track also holds a bit mask that specifies the channels used by the
|
194
|
-
track. This bit mask is set when the track is read from the <a
|
195
|
-
href="../classes/MIDI.html">MIDI</a> file by a SeqReader but is
|
196
|
-
<em>not</em> kept up to date by any other methods. Specifically, if you add
|
197
|
-
events to a track at any other time, the bit mask will not be updated.
|
198
|
-
</p>
|
199
|
-
<h3><a href="../classes/MIDI/Measure.html">MIDI::Measure</a></h3>
|
200
|
-
<p>
|
201
|
-
This class contains information about a measure from the sequence. Measure
|
202
|
-
data is based on the time signature information from the sequence and is
|
203
|
-
not stored in the sequence itself.
|
204
|
-
</p>
|
205
|
-
<h3><a href="../classes/MIDI/Measures.html">MIDI::Measures</a></h3>
|
206
|
-
<p>
|
207
|
-
The class <a href="../classes/MIDI/Sequence.html">MIDI::Sequence</a> method
|
208
|
-
get_measures returns a <a
|
209
|
-
href="../classes/MIDI/Measures.html">MIDI::Measures</a> object. <a
|
210
|
-
href="../classes/MIDI/Measures.html">MIDI::Measures</a> is a subclass of
|
211
|
-
Array. It is a specialized container for <a
|
212
|
-
href="../classes/MIDI/Measure.html">MIDI::Measure</a> objects, which can be
|
213
|
-
use to map event times to measure numbers. Please note that this object has
|
214
|
-
to be remade when events are deleted/added in the sequence.
|
215
|
-
</p>
|
216
|
-
<p>
|
217
|
-
<a href="../classes/MIDI/Measure.html">MIDI::Measure</a> and <a
|
218
|
-
href="../classes/MIDI/Measures.html">MIDI::Measures</a> are brought to us
|
219
|
-
by Jari Williamsson <jari.williamsson@mailbox.swipnet.se>, who also
|
220
|
-
contributed some improvements to the <a
|
221
|
-
href="../classes/MIDI/Event.html">MIDI::Event</a> and <a
|
222
|
-
href="../classes/MIDI/Track.html">MIDI::Track</a> classes.
|
223
|
-
</p>
|
224
|
-
<h3><a href="../classes/MIDI/Event.html">MIDI::Event</a></h3>
|
225
|
-
<p>
|
226
|
-
Each event holds not only its delta time but also its time from the start
|
227
|
-
of the track. The track is responsible for recalculating its events’
|
228
|
-
start times. You can call MIDI::Track#recalc_times to do so.
|
229
|
-
</p>
|
230
|
-
<p>
|
231
|
-
Events have a number of boolean methods that identify their types, like
|
232
|
-
channel?, note?, note_on?, note_off?, meta?, system?, realtime?, and
|
233
|
-
program_change?. Events know how to print themselves. By default, all
|
234
|
-
numbers are printed as hexidecimal and channel numbers are printed from
|
235
|
-
0-15. Setting print_decimal_numbers to true will output decimal numbers and
|
236
|
-
setting print_channel_numbers_from_one will output channel numbers from
|
237
|
-
1-16.
|
238
|
-
</p>
|
239
|
-
<p>
|
240
|
-
Subclasses of <a href="../classes/MIDI/Event.html">MIDI::Event</a>
|
241
|
-
implement the various <a href="../classes/MIDI.html">MIDI</a> messages such
|
242
|
-
as note on and off, controller values, system exclusive data, and realtime
|
243
|
-
bytes.
|
244
|
-
</p>
|
245
|
-
<p>
|
246
|
-
<a href="../classes/MIDI/Realtime.html">MIDI::Realtime</a> events have
|
247
|
-
delta values and start times, just like all the other midilib event types
|
248
|
-
do. (<a href="../classes/MIDI.html">MIDI</a> real time status bytes
|
249
|
-
don‘t have delta times, but this way we can record when in a track
|
250
|
-
the realtime byte was received and should be sent. This is useful for
|
251
|
-
start/continue/stop events that control other devices, for example.) Note
|
252
|
-
that when a <a href="../classes/MIDI/Realtime.html">MIDI::Realtime</a>
|
253
|
-
event is written out to a <a href="../classes/MIDI.html">MIDI</a> file, the
|
254
|
-
delta time is not written.
|
255
|
-
</p>
|
256
|
-
<h2>How To Use</h2>
|
257
|
-
<p>
|
258
|
-
The following examples show you how to use midilib to read, write, and
|
259
|
-
manipulate <a href="../classes/MIDI.html">MIDI</a> files and modify track
|
260
|
-
events. See also the files in the examples directory, which are described
|
261
|
-
below.
|
262
|
-
</p>
|
263
|
-
<h3>Reading a <a href="../classes/MIDI.html">MIDI</a> File</h3>
|
264
|
-
<p>
|
265
|
-
To read a <a href="../classes/MIDI.html">MIDI</a> file, create a <a
|
266
|
-
href="../classes/MIDI/Sequence.html">MIDI::Sequence</a> object and call its
|
267
|
-
read method, passing in an IO object.
|
268
|
-
</p>
|
269
|
-
<p>
|
270
|
-
The read method takes an optional block. If present, the block is called
|
271
|
-
once after each track has finished being read. Each time, it is passed the
|
272
|
-
total number of tracks and the number of the current track that has just
|
273
|
-
been read. This is useful for notifying the user of progress, for example
|
274
|
-
by updating a GUI progress bar.
|
275
|
-
</p>
|
276
|
-
<pre>
|
277
|
-
require 'midi/io/seqreader'
|
278
|
-
|
279
|
-
# Create a new, empty sequence.
|
280
|
-
seq = MIDI::Sequence.new()
|
281
|
-
|
282
|
-
# Read the contents of a MIDI file into the sequence.
|
283
|
-
File.open('my_midi_file.mid', 'rb') { | file |
|
284
|
-
seq.read(file) { | num_tracks, i |
|
285
|
-
# Print something when each track is read.
|
286
|
-
puts "read track #{i} of #{num_tracks}"
|
287
|
-
}
|
288
|
-
}
|
289
|
-
</pre>
|
290
|
-
<h3>Writing a <a href="../classes/MIDI.html">MIDI</a> File</h3>
|
291
|
-
<p>
|
292
|
-
To write a <a href="../classes/MIDI.html">MIDI</a> file, call the write
|
293
|
-
method, passing in an IO object.
|
294
|
-
</p>
|
295
|
-
<pre>
|
296
|
-
require 'midi/io/seqwriter'
|
297
|
-
|
298
|
-
# Start with a sequence that has something worth saving.
|
299
|
-
seq = read_or_create_seq_we_care_not_how()
|
300
|
-
|
301
|
-
# Write the sequence to a MIDI file.
|
302
|
-
File.open('my_output_file.mid', 'wb') { | file | seq.write(file) }
|
303
|
-
</pre>
|
304
|
-
<h3>Editing a <a href="../classes/MIDI.html">MIDI</a> File</h3>
|
305
|
-
<p>
|
306
|
-
Combining the last two examples, here is a script that reads a <a
|
307
|
-
href="../classes/MIDI.html">MIDI</a> file, transposes some events, and
|
308
|
-
writes the sequence out to a different file. This is a useful template for
|
309
|
-
programatically manipulating <a href="../classes/MIDI.html">MIDI</a> data.
|
310
|
-
</p>
|
311
|
-
<p>
|
312
|
-
This code transposes all of the note events (note on, note off, and poly
|
313
|
-
pressure) on channel 5 down one octave. It‘s easy to find events that
|
314
|
-
need to be transposed: the method note? returns true.
|
315
|
-
</p>
|
316
|
-
<h4>Transposing One Channel</h4>
|
317
|
-
<pre>
|
318
|
-
require 'midi/io/seqreader'
|
319
|
-
require 'midi/io/seqwriter'
|
320
|
-
|
321
|
-
# Create a new, empty sequence.
|
322
|
-
seq = MIDI::Sequence.new()
|
323
|
-
|
324
|
-
# Read the contents of a MIDI file into the sequence.
|
325
|
-
File.open('my_input_file.mid', 'rb') { | file |
|
326
|
-
seq.read(file) { | num_tracks, i |
|
327
|
-
# Print something when each track is read.
|
328
|
-
puts "read track #{i} of #{num_tracks}"
|
329
|
-
}
|
330
|
-
}
|
331
|
-
|
332
|
-
# Iterate over every event in every track.
|
333
|
-
seq.each { | track |
|
334
|
-
track.each { | event |
|
335
|
-
# If the event is a note event (note on, note off, or poly
|
336
|
-
# pressure) and it is on MIDI channel 5 (channels start at
|
337
|
-
# 0, so we use 4), then transpose the event down one octave.
|
338
|
-
if event.note? && event.channel == 4
|
339
|
-
event.note -= 12
|
340
|
-
end
|
341
|
-
}
|
342
|
-
}
|
343
|
-
|
344
|
-
# Write the sequence to a MIDI file.
|
345
|
-
File.open('my_output_file.mid', 'wb') { | file | seq.write(file) }
|
346
|
-
</pre>
|
347
|
-
<h3>Manipulating tracks</h3>
|
348
|
-
<p>
|
349
|
-
If you modify a track‘s list of events directly, don‘t forget
|
350
|
-
to call MIDI::Track#recalc_times when you are done.
|
351
|
-
</p>
|
352
|
-
<pre>
|
353
|
-
track.events[42, 1] = array_of_events
|
354
|
-
track.events << an_event
|
355
|
-
track.merge(array_of_events)
|
356
|
-
track.recalc_times
|
357
|
-
</pre>
|
358
|
-
<h3>Calculating delta times</h3>
|
359
|
-
<p>
|
360
|
-
A few methods in <a href="../classes/MIDI/Sequence.html">MIDI::Sequence</a>
|
361
|
-
make it easier to calculate the delta times that represent note lengths.
|
362
|
-
MIDI::Sequence#length_to_delta takes a note length (a multiple of a quarter
|
363
|
-
note) and returns the delta time given the sequence‘s current ppqn
|
364
|
-
(pulses per quarter note) setting. 1 is a quarter note, 1.0/32.0 is a 32nd
|
365
|
-
note (use floating-point numbers to avoid integer rounding), 1.5 is a
|
366
|
-
dotted quarter, etc. See the documentation for that method for more
|
367
|
-
information.
|
368
|
-
</p>
|
369
|
-
<p>
|
370
|
-
MIDI::Sequence#note_to_length takes a note name and returns a length value
|
371
|
-
(again, as a multiple of a quarter note). Legal note names are those found
|
372
|
-
in MIDI::Sequence::NOTE_TO_LENGTH, and may begin with "dotted"
|
373
|
-
and/or end with "triplet". For example, "whole",
|
374
|
-
"sixteenth", "32nd", "quarter triplet",
|
375
|
-
"dotted 16th", and "dotted 8th triplet" are all legal
|
376
|
-
note names.
|
377
|
-
</p>
|
378
|
-
<p>
|
379
|
-
Finally, MIDI::Sequence#note_to_delta takes a note name and returns a delta
|
380
|
-
time. It does this by calling note_to_length, then passing the result to
|
381
|
-
length_to_delta.
|
382
|
-
</p>
|
383
|
-
<h3>Example Scripts</h3>
|
384
|
-
<p>
|
385
|
-
Here are short descriptions of each of the examples found in the examples
|
386
|
-
directory.
|
387
|
-
</p>
|
388
|
-
<ul>
|
389
|
-
<li>examples/from_scratch.rb shows you how to create a new sequence from
|
390
|
-
scratch and save it to a <a href="../classes/MIDI.html">MIDI</a> file. It
|
391
|
-
creates a file called ‘from_scratch.mid’.
|
392
|
-
|
393
|
-
</li>
|
394
|
-
<li>examples/seq2text.rb dumps a <a href="../classes/MIDI.html">MIDI</a> file
|
395
|
-
as text. It reads in a sequence and uses the to_s method of each event.
|
396
|
-
|
397
|
-
</li>
|
398
|
-
<li>examples/reader2text.rb dumps a <a href="../classes/MIDI.html">MIDI</a>
|
399
|
-
file as text. It subclasses MIDI::SeqReader instead of creating a sequence
|
400
|
-
containing tracks and events.
|
401
|
-
|
402
|
-
</li>
|
403
|
-
<li>examples/transpose.rb transposes all note events (note on, note off, poly
|
404
|
-
pressure) on a specified channel by a specified amount.
|
405
|
-
|
406
|
-
</li>
|
407
|
-
<li>There is also one <a href="../classes/MIDI.html">MIDI</a> file,
|
408
|
-
examples/NoFences.mid. It is a little pop ditty I wrote. The instruments in
|
409
|
-
this file use General <a href="../classes/MIDI.html">MIDI</a> patch numbers
|
410
|
-
and drum note assignments. Since I don‘t normally use GM patches, the
|
411
|
-
sounds used here are at best approximations of the sounds I use.
|
412
|
-
|
413
|
-
</li>
|
414
|
-
</ul>
|
415
|
-
<h2>Resources</h2>
|
416
|
-
<p>
|
417
|
-
The Ruby Web site (<a
|
418
|
-
href="http://www.ruby-lang.org/en/index.html">www.ruby-lang.org/en/index.html</a>)
|
419
|
-
contains an introduction to Ruby, the Ruby Application Archive (RAA) at <a
|
420
|
-
href="http://raa.ruby-lang.org">raa.ruby-lang.org</a>, and pointers to more
|
421
|
-
information.
|
422
|
-
</p>
|
423
|
-
<p>
|
424
|
-
<cite>Programming Ruby, The Pragmatic Programmer‘s
|
425
|
-
Guide</cite>, by David Thomas and Andrew Hunt, is a well-written and
|
426
|
-
practical introduction to Ruby. Its Web page at <a
|
427
|
-
href="http://www.rubycentral.com/book">www.rubycentral.com/book</a> also
|
428
|
-
contains a wealth of Ruby information. Though the first edition book is
|
429
|
-
available online, I encourage you to purchase a copy of the latest edition.
|
430
|
-
</p>
|
431
|
-
<p>
|
432
|
-
A description of the <a href="../classes/MIDI.html">MIDI</a> file format
|
433
|
-
can be found in a few places such as <a
|
434
|
-
href="http://www.borg.com/~jglatt/tech/midifile.htm">www.borg.com/~jglatt/tech/midifile.htm</a>.
|
435
|
-
</p>
|
436
|
-
<p>
|
437
|
-
The <a href="../classes/MIDI.html">MIDI</a> message reference at <a
|
438
|
-
href="http://www.io.com/~jimm/midi_ref.html">www.io.com/~jimm/midi_ref.html</a>
|
439
|
-
describes the format of <a href="../classes/MIDI.html">MIDI</a> commands.
|
440
|
-
</p>
|
441
|
-
<h1>To Do</h1>
|
442
|
-
<h2>Bugs</h2>
|
443
|
-
<ul>
|
444
|
-
<li>None known.
|
445
|
-
|
446
|
-
</li>
|
447
|
-
</ul>
|
448
|
-
<h2>Features</h2>
|
449
|
-
<ul>
|
450
|
-
<li>Method to translate event‘s time_from_start to number of milliseconds
|
451
|
-
from start.
|
452
|
-
|
453
|
-
</li>
|
454
|
-
<li>Swing quantizing. (Implied by list email from Carl Youngblood
|
455
|
-
<carl.youngblood@gmail.com>)
|
456
|
-
|
457
|
-
</li>
|
458
|
-
<li>Implement key signature in SeqReader.
|
459
|
-
|
460
|
-
</li>
|
461
|
-
<li>Format 0 files.
|
462
|
-
|
463
|
-
</li>
|
464
|
-
<li>Format 2 files(?).
|
465
|
-
|
466
|
-
</li>
|
467
|
-
</ul>
|
468
|
-
<h2>Documentation</h2>
|
469
|
-
<ul>
|
470
|
-
<li>Write better docs.
|
471
|
-
|
472
|
-
</li>
|
473
|
-
</ul>
|
474
|
-
<h2>Tests</h2>
|
475
|
-
<ul>
|
476
|
-
<li>More needed?
|
477
|
-
|
478
|
-
</li>
|
479
|
-
</ul>
|
480
|
-
<h1>Support</h1>
|
481
|
-
<ul>
|
482
|
-
<li>Visit the forums, bug list, and mailing list pages at <a
|
483
|
-
href="http://rubyforge.org/projects/midilib">rubyforge.org/projects/midilib</a>
|
484
|
-
|
485
|
-
</li>
|
486
|
-
<li>Send email to Jim Menard at <a href="mailto:jimm@io.com">jimm@io.com</a>
|
487
|
-
|
488
|
-
</li>
|
489
|
-
<li>Ask on the ruby-talk mailing list
|
490
|
-
|
491
|
-
</li>
|
492
|
-
</ul>
|
493
|
-
<h1>Administrivia</h1>
|
494
|
-
<table>
|
495
|
-
<tr><td valign="top">Author:</td><td>Jim Menard (<a href="mailto:jimm@io.com">jimm@io.com</a>)
|
496
|
-
|
497
|
-
</td></tr>
|
498
|
-
<tr><td valign="top">Copyright:</td><td>Copyright (c) 2003-2005 Jim Menard
|
499
|
-
|
500
|
-
</td></tr>
|
501
|
-
<tr><td valign="top">License:</td><td>Distributed under the same license as Ruby.
|
502
|
-
|
503
|
-
</td></tr>
|
504
|
-
</table>
|
505
|
-
<h2>Copying</h2>
|
506
|
-
<p>
|
507
|
-
midilib is copyrighted free software by Jim Menard and is released under
|
508
|
-
the same license as Ruby. See the Ruby license at <a
|
509
|
-
href="http://www.ruby-lang.org/en/LICENSE.txt">www.ruby-lang.org/en/LICENSE.txt</a>.
|
510
|
-
</p>
|
511
|
-
<p>
|
512
|
-
midilib may be freely copied in its entirety providing this notice, all
|
513
|
-
source code, all documentation, and all other files are included.
|
514
|
-
</p>
|
515
|
-
<p>
|
516
|
-
midilib is Copyright (c) 2003-2005 by Jim Menard.
|
517
|
-
</p>
|
518
|
-
<p>
|
519
|
-
The song "No Fences" contained in the <a
|
520
|
-
href="../classes/MIDI.html">MIDI</a> file examples/NoFences.mid is
|
521
|
-
Copyright (c) 1992 by Jim Menard (jimm@io.com). It may be freely used for
|
522
|
-
non-commercial purposes as long as the author is given credit.
|
523
|
-
</p>
|
524
|
-
<h3>Recent Changes</h3>
|
525
|
-
<h4>Changes for 1.1.1:</h4>
|
526
|
-
<ul>
|
527
|
-
<li>Mak MIDI::IO::MIDIFile.getc do the right thing for both Ruby 1.8 and 1.9.
|
528
|
-
|
529
|
-
</li>
|
530
|
-
</ul>
|
531
|
-
<h4>Changes for 1.1.0:</h4>
|
532
|
-
<ul>
|
533
|
-
<li>Added test/test.mid to list of files to be included when packaging midifile
|
534
|
-
for distribution.
|
535
|
-
|
536
|
-
</li>
|
537
|
-
</ul>
|
538
|
-
<h4>Changes for 1.0.0:</h4>
|
539
|
-
<ul>
|
540
|
-
<li>Fixed the bug in Track#recalc_delta_from_times found by Christopher Rose.
|
541
|
-
|
542
|
-
</li>
|
543
|
-
</ul>
|
544
|
-
<h4>Changes for 0.8.7:</h4>
|
545
|
-
<ul>
|
546
|
-
<li>Fixed the misspelled POLY_PRESSURE constant, thanks to Mario Pehle.
|
547
|
-
|
548
|
-
</li>
|
549
|
-
</ul>
|
550
|
-
<h4>Changes for 0.8.6:</h4>
|
551
|
-
<ul>
|
552
|
-
<li>Added missing test/test.mid.
|
553
|
-
|
554
|
-
</li>
|
555
|
-
</ul>
|
556
|
-
<h4>Changes for 0.8.5:</h4>
|
557
|
-
<ul>
|
558
|
-
<li>Fixed bugs in <a href="../classes/MIDI/PitchBend.html">MIDI::PitchBend</a>
|
559
|
-
reading and writing, thanks to Emanuel Borsboom.
|
560
|
-
|
561
|
-
</li>
|
562
|
-
<li>Fixed a bug in MIDI::Track#quantize.
|
563
|
-
|
564
|
-
</li>
|
565
|
-
<li>The argument to MIDI::Track#quantize has changed: it is now either a note
|
566
|
-
name ("sixteenth", "32nd", "8th triplet") or
|
567
|
-
a length (1 = quarter, 0.25 = sixteenth). This is a drastic change that
|
568
|
-
will break all previous calls to quantize. However, since that method was
|
569
|
-
broken already, I don‘t feel it‘s a burden to anybody to change
|
570
|
-
the arguments.
|
571
|
-
|
572
|
-
</li>
|
573
|
-
</ul>
|
574
|
-
<h4>Changes for 0.8.4:</h4>
|
575
|
-
<ul>
|
576
|
-
<li>Realtime status bytes now set @is_realtime to true and return true when
|
577
|
-
realtime? is called.
|
578
|
-
|
579
|
-
</li>
|
580
|
-
<li>All system common events now set @is_system to true and return true when
|
581
|
-
system? is called, not just system exclusive events.
|
582
|
-
|
583
|
-
</li>
|
584
|
-
<li>Added examples/from_scratch.rb, which shows how to create a sequence
|
585
|
-
manually.
|
586
|
-
|
587
|
-
</li>
|
588
|
-
<li>New <a href="../classes/MIDI/Sequence.html">MIDI::Sequence</a> methods that
|
589
|
-
turn note length names like "32nd", "dotted quarter",
|
590
|
-
and "16th triplet" into delta times. See the docs below and
|
591
|
-
MIDI::Sequence::length_to_delta, MIDI::Sequence::note_to_length, and
|
592
|
-
MIDI::Sequence::note_to_delta.
|
593
|
-
|
594
|
-
</li>
|
595
|
-
</ul>
|
596
|
-
<h4>Changes for 0.8.3:</h4>
|
597
|
-
<ul>
|
598
|
-
<li>Added MIDI::NoteEvent.note_to_s, which returns note name as a string like
|
599
|
-
"C4" or "F#6".
|
600
|
-
|
601
|
-
</li>
|
602
|
-
<li>Added new boolean attributes to <a
|
603
|
-
href="../classes/MIDI/Event.html">MIDI::Event</a>: @print_decimal_numbers
|
604
|
-
and @print_note_names. These are used by all Event to_s methods. See
|
605
|
-
examples/seq2text.rb for an example.
|
606
|
-
|
607
|
-
</li>
|
608
|
-
</ul>
|
609
|
-
<h4>Changes for 0.8.2:</h4>
|
610
|
-
<ul>
|
611
|
-
<li>Changed MIDI::MetaEvent.type to MIDI::MetaEvent.event_type to avoid runtime
|
612
|
-
complaints about Object#type calls.
|
613
|
-
|
614
|
-
</li>
|
615
|
-
<li>Added ‘b’ binary flag to file open modes for Windows.
|
616
|
-
|
617
|
-
</li>
|
618
|
-
<li>Fixed $LOAD_PATH in example files.
|
619
|
-
|
620
|
-
</li>
|
621
|
-
<li>Fixed read and write block arguments.
|
622
|
-
|
623
|
-
</li>
|
624
|
-
<li>Fixed other example script bugs.
|
625
|
-
|
626
|
-
</li>
|
627
|
-
</ul>
|
628
|
-
<h4>Changes for 0.8.1:</h4>
|
629
|
-
<ul>
|
630
|
-
<li>Fixed track sorting.
|
631
|
-
|
632
|
-
</li>
|
633
|
-
<li>Fixed track‘s recalc_delta_from_times method.
|
634
|
-
|
635
|
-
</li>
|
636
|
-
<li>Fixed event quantization.
|
637
|
-
|
638
|
-
</li>
|
639
|
-
<li>More tests and documentation.
|
640
|
-
|
641
|
-
</li>
|
642
|
-
</ul>
|
643
|
-
<h2>Warranty</h2>
|
644
|
-
<p>
|
645
|
-
This software is provided "as is" and without any express or
|
646
|
-
implied warranties, including, without limitation, the implied warranties
|
647
|
-
of merchantability and fitness for a particular purpose.
|
648
|
-
</p>
|
649
|
-
|
650
|
-
</div>
|
651
|
-
|
652
|
-
|
653
|
-
</div>
|
654
|
-
|
655
|
-
|
656
|
-
</div>
|
657
|
-
|
658
|
-
|
659
|
-
<!-- if includes -->
|
660
|
-
|
661
|
-
<div id="section">
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
<!-- if method_list -->
|
671
|
-
|
672
|
-
|
673
|
-
</div>
|
674
|
-
|
675
|
-
|
676
|
-
<div id="validator-badges">
|
677
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
678
|
-
</div>
|
679
|
-
|
680
|
-
</body>
|
681
|
-
</html>
|