midilib 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. data/ChangeLog +87 -0
  2. data/Credits +8 -0
  3. data/README +361 -0
  4. data/Rakefile +68 -0
  5. data/TODO +25 -0
  6. data/examples/NoFences.mid +0 -0
  7. data/examples/from_scratch.mid +0 -0
  8. data/examples/from_scratch.rb +56 -0
  9. data/examples/reader2text.rb +220 -0
  10. data/examples/seq2text.rb +41 -0
  11. data/examples/strings.rb +34 -0
  12. data/examples/transpose.rb +75 -0
  13. data/html/classes/MIDI.html +738 -0
  14. data/html/classes/MIDI/ActiveSense.html +156 -0
  15. data/html/classes/MIDI/ActiveSense.src/M000136.html +18 -0
  16. data/html/classes/MIDI/ActiveSense.src/M000137.html +18 -0
  17. data/html/classes/MIDI/ChannelEvent.html +179 -0
  18. data/html/classes/MIDI/ChannelEvent.src/M000124.html +20 -0
  19. data/html/classes/MIDI/ChannelEvent.src/M000125.html +18 -0
  20. data/html/classes/MIDI/ChannelPressure.html +184 -0
  21. data/html/classes/MIDI/ChannelPressure.src/M000088.html +19 -0
  22. data/html/classes/MIDI/ChannelPressure.src/M000089.html +21 -0
  23. data/html/classes/MIDI/ChannelPressure.src/M000090.html +18 -0
  24. data/html/classes/MIDI/Clock.html +156 -0
  25. data/html/classes/MIDI/Clock.src/M000134.html +18 -0
  26. data/html/classes/MIDI/Clock.src/M000135.html +18 -0
  27. data/html/classes/MIDI/Continue.html +156 -0
  28. data/html/classes/MIDI/Continue.src/M000132.html +18 -0
  29. data/html/classes/MIDI/Continue.src/M000133.html +18 -0
  30. data/html/classes/MIDI/Controller.html +189 -0
  31. data/html/classes/MIDI/Controller.src/M000129.html +21 -0
  32. data/html/classes/MIDI/Controller.src/M000130.html +22 -0
  33. data/html/classes/MIDI/Controller.src/M000131.html +18 -0
  34. data/html/classes/MIDI/Event.html +424 -0
  35. data/html/classes/MIDI/Event.src/M000145.html +27 -0
  36. data/html/classes/MIDI/Event.src/M000146.html +18 -0
  37. data/html/classes/MIDI/Event.src/M000147.html +18 -0
  38. data/html/classes/MIDI/Event.src/M000148.html +18 -0
  39. data/html/classes/MIDI/Event.src/M000149.html +18 -0
  40. data/html/classes/MIDI/Event.src/M000150.html +18 -0
  41. data/html/classes/MIDI/Event.src/M000151.html +18 -0
  42. data/html/classes/MIDI/Event.src/M000152.html +18 -0
  43. data/html/classes/MIDI/Event.src/M000153.html +18 -0
  44. data/html/classes/MIDI/Event.src/M000154.html +22 -0
  45. data/html/classes/MIDI/Event.src/M000155.html +18 -0
  46. data/html/classes/MIDI/Event.src/M000156.html +18 -0
  47. data/html/classes/MIDI/Event.src/M000157.html +18 -0
  48. data/html/classes/MIDI/IO.html +121 -0
  49. data/html/classes/MIDI/IO/MIDIFile.html +925 -0
  50. data/html/classes/MIDI/IO/MIDIFile.src/M000028.html +22 -0
  51. data/html/classes/MIDI/IO/MIDIFile.src/M000029.html +24 -0
  52. data/html/classes/MIDI/IO/MIDIFile.src/M000030.html +19 -0
  53. data/html/classes/MIDI/IO/MIDIFile.src/M000031.html +19 -0
  54. data/html/classes/MIDI/IO/MIDIFile.src/M000032.html +17 -0
  55. data/html/classes/MIDI/IO/MIDIFile.src/M000033.html +17 -0
  56. data/html/classes/MIDI/IO/MIDIFile.src/M000034.html +17 -0
  57. data/html/classes/MIDI/IO/MIDIFile.src/M000035.html +17 -0
  58. data/html/classes/MIDI/IO/MIDIFile.src/M000036.html +17 -0
  59. data/html/classes/MIDI/IO/MIDIFile.src/M000037.html +17 -0
  60. data/html/classes/MIDI/IO/MIDIFile.src/M000038.html +17 -0
  61. data/html/classes/MIDI/IO/MIDIFile.src/M000039.html +17 -0
  62. data/html/classes/MIDI/IO/MIDIFile.src/M000040.html +17 -0
  63. data/html/classes/MIDI/IO/MIDIFile.src/M000041.html +17 -0
  64. data/html/classes/MIDI/IO/MIDIFile.src/M000042.html +17 -0
  65. data/html/classes/MIDI/IO/MIDIFile.src/M000043.html +17 -0
  66. data/html/classes/MIDI/IO/MIDIFile.src/M000044.html +17 -0
  67. data/html/classes/MIDI/IO/MIDIFile.src/M000045.html +17 -0
  68. data/html/classes/MIDI/IO/MIDIFile.src/M000046.html +17 -0
  69. data/html/classes/MIDI/IO/MIDIFile.src/M000047.html +17 -0
  70. data/html/classes/MIDI/IO/MIDIFile.src/M000048.html +17 -0
  71. data/html/classes/MIDI/IO/MIDIFile.src/M000049.html +17 -0
  72. data/html/classes/MIDI/IO/MIDIFile.src/M000050.html +17 -0
  73. data/html/classes/MIDI/IO/MIDIFile.src/M000051.html +17 -0
  74. data/html/classes/MIDI/IO/MIDIFile.src/M000052.html +17 -0
  75. data/html/classes/MIDI/IO/MIDIFile.src/M000053.html +43 -0
  76. data/html/classes/MIDI/IO/MIDIFile.src/M000054.html +34 -0
  77. data/html/classes/MIDI/IO/MIDIFile.src/M000055.html +96 -0
  78. data/html/classes/MIDI/IO/MIDIFile.src/M000056.html +18 -0
  79. data/html/classes/MIDI/IO/MIDIFile.src/M000057.html +48 -0
  80. data/html/classes/MIDI/IO/MIDIFile.src/M000058.html +42 -0
  81. data/html/classes/MIDI/IO/MIDIFile.src/M000059.html +19 -0
  82. data/html/classes/MIDI/IO/MIDIFile.src/M000060.html +19 -0
  83. data/html/classes/MIDI/IO/MIDIFile.src/M000061.html +20 -0
  84. data/html/classes/MIDI/IO/MIDIFile.src/M000062.html +21 -0
  85. data/html/classes/MIDI/IO/MIDIFile.src/M000063.html +31 -0
  86. data/html/classes/MIDI/IO/MIDIFile.src/M000064.html +20 -0
  87. data/html/classes/MIDI/IO/MIDIFile.src/M000065.html +22 -0
  88. data/html/classes/MIDI/IO/MIDIFile.src/M000066.html +30 -0
  89. data/html/classes/MIDI/IO/MIDIFile.src/M000067.html +18 -0
  90. data/html/classes/MIDI/IO/MIDIFile.src/M000068.html +20 -0
  91. data/html/classes/MIDI/IO/MIDIFile.src/M000069.html +18 -0
  92. data/html/classes/MIDI/IO/MIDIFile.src/M000070.html +18 -0
  93. data/html/classes/MIDI/IO/SeqReader.html +460 -0
  94. data/html/classes/MIDI/IO/SeqReader.src/M000001.html +22 -0
  95. data/html/classes/MIDI/IO/SeqReader.src/M000002.html +22 -0
  96. data/html/classes/MIDI/IO/SeqReader.src/M000003.html +21 -0
  97. data/html/classes/MIDI/IO/SeqReader.src/M000004.html +34 -0
  98. data/html/classes/MIDI/IO/SeqReader.src/M000005.html +26 -0
  99. data/html/classes/MIDI/IO/SeqReader.src/M000006.html +28 -0
  100. data/html/classes/MIDI/IO/SeqReader.src/M000007.html +21 -0
  101. data/html/classes/MIDI/IO/SeqReader.src/M000008.html +19 -0
  102. data/html/classes/MIDI/IO/SeqReader.src/M000009.html +19 -0
  103. data/html/classes/MIDI/IO/SeqReader.src/M000010.html +19 -0
  104. data/html/classes/MIDI/IO/SeqReader.src/M000011.html +19 -0
  105. data/html/classes/MIDI/IO/SeqReader.src/M000012.html +19 -0
  106. data/html/classes/MIDI/IO/SeqReader.src/M000013.html +18 -0
  107. data/html/classes/MIDI/IO/SeqReader.src/M000014.html +18 -0
  108. data/html/classes/MIDI/IO/SeqReader.src/M000015.html +27 -0
  109. data/html/classes/MIDI/IO/SeqReader.src/M000016.html +18 -0
  110. data/html/classes/MIDI/IO/SeqReader.src/M000017.html +18 -0
  111. data/html/classes/MIDI/IO/SeqReader.src/M000018.html +18 -0
  112. data/html/classes/MIDI/IO/SeqWriter.html +267 -0
  113. data/html/classes/MIDI/IO/SeqWriter.src/M000019.html +19 -0
  114. data/html/classes/MIDI/IO/SeqWriter.src/M000020.html +25 -0
  115. data/html/classes/MIDI/IO/SeqWriter.src/M000021.html +22 -0
  116. data/html/classes/MIDI/IO/SeqWriter.src/M000022.html +54 -0
  117. data/html/classes/MIDI/IO/SeqWriter.src/M000023.html +49 -0
  118. data/html/classes/MIDI/IO/SeqWriter.src/M000024.html +21 -0
  119. data/html/classes/MIDI/IO/SeqWriter.src/M000025.html +19 -0
  120. data/html/classes/MIDI/IO/SeqWriter.src/M000026.html +24 -0
  121. data/html/classes/MIDI/IO/SeqWriter.src/M000027.html +26 -0
  122. data/html/classes/MIDI/Marker.html +139 -0
  123. data/html/classes/MIDI/Marker.src/M000107.html +18 -0
  124. data/html/classes/MIDI/MetaEvent.html +189 -0
  125. data/html/classes/MIDI/MetaEvent.src/M000167.html +21 -0
  126. data/html/classes/MIDI/MetaEvent.src/M000168.html +23 -0
  127. data/html/classes/MIDI/MetaEvent.src/M000169.html +53 -0
  128. data/html/classes/MIDI/NoteEvent.html +233 -0
  129. data/html/classes/MIDI/NoteEvent.src/M000091.html +21 -0
  130. data/html/classes/MIDI/NoteEvent.src/M000092.html +20 -0
  131. data/html/classes/MIDI/NoteEvent.src/M000093.html +18 -0
  132. data/html/classes/MIDI/NoteEvent.src/M000094.html +22 -0
  133. data/html/classes/MIDI/NoteOffEvent.html +169 -0
  134. data/html/classes/MIDI/NoteOffEvent.src/M000086.html +19 -0
  135. data/html/classes/MIDI/NoteOffEvent.src/M000087.html +19 -0
  136. data/html/classes/MIDI/NoteOnEvent.html +169 -0
  137. data/html/classes/MIDI/NoteOnEvent.src/M000102.html +19 -0
  138. data/html/classes/MIDI/NoteOnEvent.src/M000103.html +19 -0
  139. data/html/classes/MIDI/PitchBend.html +184 -0
  140. data/html/classes/MIDI/PitchBend.src/M000104.html +19 -0
  141. data/html/classes/MIDI/PitchBend.src/M000105.html +22 -0
  142. data/html/classes/MIDI/PitchBend.src/M000106.html +18 -0
  143. data/html/classes/MIDI/PolyPressure.html +186 -0
  144. data/html/classes/MIDI/PolyPressure.src/M000170.html +18 -0
  145. data/html/classes/MIDI/PolyPressure.src/M000171.html +18 -0
  146. data/html/classes/MIDI/PolyPressure.src/M000172.html +18 -0
  147. data/html/classes/MIDI/PolyPressure.src/M000173.html +19 -0
  148. data/html/classes/MIDI/ProgramChange.html +184 -0
  149. data/html/classes/MIDI/ProgramChange.src/M000099.html +19 -0
  150. data/html/classes/MIDI/ProgramChange.src/M000100.html +21 -0
  151. data/html/classes/MIDI/ProgramChange.src/M000101.html +18 -0
  152. data/html/classes/MIDI/Realtime.html +171 -0
  153. data/html/classes/MIDI/Realtime.src/M000083.html +19 -0
  154. data/html/classes/MIDI/Realtime.src/M000084.html +20 -0
  155. data/html/classes/MIDI/Realtime.src/M000085.html +18 -0
  156. data/html/classes/MIDI/Sequence.html +469 -0
  157. data/html/classes/MIDI/Sequence.src/M000108.html +28 -0
  158. data/html/classes/MIDI/Sequence.src/M000109.html +21 -0
  159. data/html/classes/MIDI/Sequence.src/M000110.html +22 -0
  160. data/html/classes/MIDI/Sequence.src/M000113.html +18 -0
  161. data/html/classes/MIDI/Sequence.src/M000114.html +27 -0
  162. data/html/classes/MIDI/Sequence.src/M000115.html +18 -0
  163. data/html/classes/MIDI/Sequence.src/M000116.html +19 -0
  164. data/html/classes/MIDI/Sequence.src/M000117.html +19 -0
  165. data/html/classes/MIDI/Sequence.src/M000118.html +20 -0
  166. data/html/classes/MIDI/Sequence.src/M000119.html +19 -0
  167. data/html/classes/MIDI/Sequence.src/M000120.html +18 -0
  168. data/html/classes/MIDI/SongPointer.html +184 -0
  169. data/html/classes/MIDI/SongPointer.src/M000138.html +19 -0
  170. data/html/classes/MIDI/SongPointer.src/M000139.html +22 -0
  171. data/html/classes/MIDI/SongPointer.src/M000140.html +18 -0
  172. data/html/classes/MIDI/SongSelect.html +184 -0
  173. data/html/classes/MIDI/SongSelect.src/M000126.html +19 -0
  174. data/html/classes/MIDI/SongSelect.src/M000127.html +21 -0
  175. data/html/classes/MIDI/SongSelect.src/M000128.html +18 -0
  176. data/html/classes/MIDI/Start.html +156 -0
  177. data/html/classes/MIDI/Start.src/M000097.html +18 -0
  178. data/html/classes/MIDI/Start.src/M000098.html +18 -0
  179. data/html/classes/MIDI/Stop.html +156 -0
  180. data/html/classes/MIDI/Stop.src/M000095.html +18 -0
  181. data/html/classes/MIDI/Stop.src/M000096.html +18 -0
  182. data/html/classes/MIDI/SystemCommon.html +139 -0
  183. data/html/classes/MIDI/SystemCommon.src/M000144.html +19 -0
  184. data/html/classes/MIDI/SystemExclusive.html +184 -0
  185. data/html/classes/MIDI/SystemExclusive.src/M000141.html +19 -0
  186. data/html/classes/MIDI/SystemExclusive.src/M000142.html +23 -0
  187. data/html/classes/MIDI/SystemExclusive.src/M000143.html +18 -0
  188. data/html/classes/MIDI/SystemReset.html +156 -0
  189. data/html/classes/MIDI/SystemReset.src/M000081.html +18 -0
  190. data/html/classes/MIDI/SystemReset.src/M000082.html +18 -0
  191. data/html/classes/MIDI/Tempo.html +250 -0
  192. data/html/classes/MIDI/Tempo.src/M000158.html +18 -0
  193. data/html/classes/MIDI/Tempo.src/M000159.html +18 -0
  194. data/html/classes/MIDI/Tempo.src/M000160.html +18 -0
  195. data/html/classes/MIDI/Tempo.src/M000161.html +18 -0
  196. data/html/classes/MIDI/Tempo.src/M000162.html +18 -0
  197. data/html/classes/MIDI/Tempo.src/M000163.html +25 -0
  198. data/html/classes/MIDI/Tempo.src/M000164.html +18 -0
  199. data/html/classes/MIDI/Track.html +380 -0
  200. data/html/classes/MIDI/Track.src/M000071.html +23 -0
  201. data/html/classes/MIDI/Track.src/M000072.html +21 -0
  202. data/html/classes/MIDI/Track.src/M000073.html +26 -0
  203. data/html/classes/MIDI/Track.src/M000074.html +18 -0
  204. data/html/classes/MIDI/Track.src/M000075.html +22 -0
  205. data/html/classes/MIDI/Track.src/M000076.html +20 -0
  206. data/html/classes/MIDI/Track.src/M000077.html +22 -0
  207. data/html/classes/MIDI/Track.src/M000078.html +22 -0
  208. data/html/classes/MIDI/Track.src/M000079.html +18 -0
  209. data/html/classes/MIDI/Track.src/M000080.html +19 -0
  210. data/html/classes/MIDI/TuneRequest.html +171 -0
  211. data/html/classes/MIDI/TuneRequest.src/M000121.html +18 -0
  212. data/html/classes/MIDI/TuneRequest.src/M000122.html +20 -0
  213. data/html/classes/MIDI/TuneRequest.src/M000123.html +18 -0
  214. data/html/classes/MIDI/Utils.html +190 -0
  215. data/html/classes/MIDI/Utils.src/M000165.html +20 -0
  216. data/html/classes/MIDI/Utils.src/M000166.html +25 -0
  217. data/html/created.rid +1 -0
  218. data/html/files/README.html +599 -0
  219. data/html/files/TODO.html +142 -0
  220. data/html/files/lib/midilib/consts_rb.html +107 -0
  221. data/html/files/lib/midilib/event_rb.html +109 -0
  222. data/html/files/lib/midilib/info_rb.html +101 -0
  223. data/html/files/lib/midilib/io/midifile_rb.html +108 -0
  224. data/html/files/lib/midilib/io/seqreader_rb.html +110 -0
  225. data/html/files/lib/midilib/io/seqwriter_rb.html +115 -0
  226. data/html/files/lib/midilib/sequence_rb.html +109 -0
  227. data/html/files/lib/midilib/track_rb.html +108 -0
  228. data/html/files/lib/midilib/utils_rb.html +101 -0
  229. data/html/files/lib/midilib_rb.html +124 -0
  230. data/html/fr_class_index.html +59 -0
  231. data/html/fr_file_index.html +38 -0
  232. data/html/fr_method_index.html +199 -0
  233. data/html/index.html +24 -0
  234. data/html/rdoc-style.css +208 -0
  235. data/install.rb +57 -0
  236. data/lib/midilib.rb +16 -0
  237. data/lib/midilib/consts.rb +422 -0
  238. data/lib/midilib/event.rb +559 -0
  239. data/lib/midilib/info.rb +9 -0
  240. data/lib/midilib/io/midifile.rb +446 -0
  241. data/lib/midilib/io/seqreader.rb +198 -0
  242. data/lib/midilib/io/seqwriter.rb +151 -0
  243. data/lib/midilib/sequence.rb +144 -0
  244. data/lib/midilib/track.rb +115 -0
  245. data/lib/midilib/utils.rb +36 -0
  246. data/test/event_equality.rb +81 -0
  247. data/test/test_event.rb +116 -0
  248. data/test/test_io.rb +55 -0
  249. data/test/test_sequence.rb +68 -0
  250. data/test/test_track.rb +111 -0
  251. data/test/test_varlen.rb +40 -0
  252. metadata +330 -0
data/html/index.html ADDED
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ midilib
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>midilib</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README.html" name="docwin" />
23
+ </frameset>
24
+ </html>
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
data/install.rb ADDED
@@ -0,0 +1,57 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # usage: install.rb [(--install-dir | -i) install_directory]
4
+ #
5
+ # This script installs midilib into the Ruby site-local library directory.
6
+ #
7
+ # Author:: Jim Menard (mailto:jimm@io.com)
8
+ # Copyright:: Copyright (c) 2003-2004 by Jim Menard
9
+ # License:: Distributed under the same license as Ruby.
10
+ #
11
+
12
+ require 'getoptlong'
13
+ require 'ftools'
14
+ require 'find'
15
+
16
+ SOURCE_DIR = 'lib'
17
+ LIB_DIR = 'midilib'
18
+ IO_DIR = File.join(LIB_DIR, 'io')
19
+
20
+ def instdir
21
+ g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
22
+ g.each { | name, arg |
23
+ if name == '--install-dir'
24
+ return arg
25
+ else
26
+ $stderr.puts "usage: $0 [--install-dir dir]"
27
+ end
28
+ }
29
+
30
+ begin
31
+ require 'rbconfig'
32
+ libdir = Config::CONFIG['sitedir'] + "/" +
33
+ Config::CONFIG['MAJOR'] + "." +
34
+ Config::CONFIG['MINOR']
35
+ rescue ScriptError
36
+ $LOAD_PATH.each do |l|
37
+ if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
38
+ libdir = l
39
+ break
40
+ end
41
+ end
42
+ STDERR.puts "Can't find required file `rbconfig.rb'."
43
+ STDERR.puts "The `midilib' files need to be installed manually in" +
44
+ " #{libdir}"
45
+ end
46
+ return libdir
47
+ end
48
+
49
+ INSTALL_DIR = instdir()
50
+ files = Dir.chdir('lib') { Dir['**/*.rb'] }
51
+
52
+ files.each { | f |
53
+ dir = File.dirname(f)
54
+ target_dir = File.join(INSTALL_DIR, dir)
55
+ File.makedirs(target_dir) unless File.exist?(target_dir)
56
+ File.install(File.join('lib', f), File.join(INSTALL_DIR, f), 0644, true)
57
+ }
data/lib/midilib.rb ADDED
@@ -0,0 +1,16 @@
1
+ # = midilib
2
+ #
3
+ # This is the top-level include file for midilib. You can require this
4
+ # file or require individual files from the midilib directory.
5
+ #
6
+ # See the README file or http://midilib.rubyforge.org for details.
7
+
8
+ require 'midilib/info'
9
+ require 'midilib/sequence'
10
+ require 'midilib/track'
11
+ require 'midilib/io/seqreader'
12
+ require 'midilib/io/seqwriter'
13
+
14
+ # --
15
+ # consts.rb, utils.rb, and event.rb are included by these files.
16
+ # ++
@@ -0,0 +1,422 @@
1
+ # MIDI constants.
2
+ module MIDI
3
+
4
+ # Number of MIDI channels
5
+ MIDI_CHANNELS = 16
6
+ # Number of note per MIDI channel
7
+ NOTES_PER_CHANNEL = 128
8
+
9
+ #--
10
+ # Standard MIDI File meta event defs.
11
+ #++
12
+ META_EVENT = 0xff
13
+ META_SEQ_NUM = 0x00
14
+ META_TEXT = 0x01
15
+ META_COPYRIGHT = 0x02
16
+ META_SEQ_NAME = 0x03
17
+ META_INSTRUMENT = 0x04
18
+ META_LYRIC = 0x05
19
+ META_MARKER = 0x06
20
+ META_CUE = 0x07
21
+ META_TRACK_END = 0x2f
22
+ META_SET_TEMPO = 0x51
23
+ META_SMPTE = 0x53
24
+ META_TIME_SIG = 0x58
25
+ META_KEY_SIG = 0x59
26
+ META_SEQ_SPECIF = 0x7f
27
+
28
+ #--
29
+ # Channel messages
30
+ #++
31
+ # Note, val
32
+ NOTE_OFF = 0x80
33
+ # Note, val
34
+ NOTE_ON = 0x90
35
+ # Note, val
36
+ POLY_PRESSURE = 0xA0
37
+ # Controller #, val
38
+ CONTROLLER = 0xB0
39
+ # Program number
40
+ PROGRAM_CHANGE = 0xC0
41
+ # Channel pressure
42
+ CHANNEL_PRESSURE = 0xD0
43
+ # LSB, MSB
44
+ PITCH_BEND = 0xE0
45
+
46
+ #--
47
+ # System common messages
48
+ #++
49
+ # System exclusive start
50
+ SYSEX = 0xF0
51
+ # Beats from top: LSB/MSB 6 ticks = 1 beat
52
+ SONG_POINTER = 0xF2
53
+ # Val = number of song
54
+ SONG_SELECT = 0xF3
55
+ # Tune request
56
+ TUNE_REQUEST = 0xF6
57
+ # End of system exclusive
58
+ EOX = 0xF7
59
+
60
+ #--
61
+ # System realtime messages
62
+ #++
63
+ # MIDI clock (24 per quarter note)
64
+ CLOCK = 0xF8
65
+ # Sequence start
66
+ START = 0xFA
67
+ # Sequence continue
68
+ CONTINUE = 0xFB
69
+ # Sequence stop
70
+ STOP = 0xFC
71
+ # Active sensing (sent every 300 ms when nothing else being sent)
72
+ ACTIVE_SENSE = 0xFE
73
+ # System reset
74
+ SYSTEM_RESET = 0xFF
75
+
76
+ # Controller numbers
77
+ # = 0 - 31 = continuous, LSB
78
+ # = 32 - 63 = continuous, MSB
79
+ # = 64 - 97 = switches
80
+ CC_MOD_WHEEL = 1
81
+ CC_BREATH_CONTROLLER = 2
82
+ CC_FOOT_CONTROLLER = 4
83
+ CC_PORTAMENTO_TIME = 5
84
+ CC_DATA_ENTRY_MSB = 6
85
+ CC_VOLUME = 7
86
+ CC_BALANCE = 8
87
+ CC_PAN = 10
88
+ CC_EXPRESSION_CONTROLLER = 11
89
+ CC_GEN_PURPOSE_1 = 16
90
+ CC_GEN_PURPOSE_2 = 17
91
+ CC_GEN_PURPOSE_3 = 18
92
+ CC_GEN_PURPOSE_4 = 19
93
+ # [32 - 63] are LSB for [0 - 31]
94
+ #--
95
+ # Momentaries:
96
+ #++
97
+ CC_SUSTAIN = 64
98
+ CC_PORTAMENTO = 65
99
+ CC_SUSTENUTO = 66
100
+ CC_SOFT_PEDAL = 67
101
+ CC_HOLD_2 = 69
102
+ CC_GEN_PURPOSE_5 = 50
103
+ CC_GEN_PURPOSE_6 = 51
104
+ CC_GEN_PURPOSE_7 = 52
105
+ CC_GEN_PURPOSE_8 = 53
106
+ CC_TREMELO_DEPTH = 92
107
+ CC_CHORUS_DEPTH = 93
108
+ CC_DETUNE_DEPTH = 94
109
+ CC_PHASER_DEPTH = 95
110
+ CC_DATA_INCREMENT = 96
111
+ CC_DATA_DECREMENT = 97
112
+ CC_NREG_PARAM_LSB = 98
113
+ CC_NREG_PARAM_MSB = 99
114
+ CC_REG_PARAM_LSB = 100
115
+ CC_REG_PARAM_MSB = 101
116
+
117
+ #--
118
+ # Channel mode message values
119
+ #++
120
+ # Val 0 == off, 0x7f == on
121
+ CM_LOCAL_CONTROL = 0x7A
122
+ CM_ALL_NOTES_OFF = 0x7B # Val must be 0
123
+ CM_OMNI_MODE_OFF = 0x7C # Val must be 0
124
+ CM_OMNI_MODE_ON = 0x7D # Val must be 0
125
+ CM_MONO_MODE_ON = 0x7E # Val = # chans
126
+ CM_POLY_MODE_ON = 0x7F # Val must be 0
127
+
128
+ # Controller names
129
+ CONTROLLER_NAMES = [
130
+ "0",
131
+ "Modulation",
132
+ "Breath Control",
133
+ "3",
134
+ "Foot Controller",
135
+ "Portamento Time",
136
+ "Data Entry",
137
+ "Volume",
138
+ "Balance",
139
+ "9",
140
+ "Pan",
141
+ "Expression Control",
142
+ "12", "13", "14", "15",
143
+ "General Controller 1",
144
+ "General Controller 2",
145
+ "General Controller 3",
146
+ "General Controller 4",
147
+ "20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
148
+ "30", "31",
149
+ "32", "33", "34", "35", "36", "37", "38", "39", "40", "41",
150
+ "42", "43", "44", "45", "46", "47", "48", "49", "50", "51",
151
+ "52", "53", "54", "55", "56", "57", "58", "59", "60", "61",
152
+ "62", "63",
153
+ "Sustain Pedal",
154
+ "Portamento",
155
+ "Sostenuto",
156
+ "Soft Pedal",
157
+ "68",
158
+ "Hold 2",
159
+ "70", "71", "72", "73", "74", "75", "76", "77", "78", "79",
160
+ "General Controller 5",
161
+ "Tempo Change",
162
+ "General Controller 7",
163
+ "General Controller 8",
164
+ "84", "85", "86", "87", "88", "89", "90",
165
+ "External Effects Depth",
166
+ "Tremolo Depth",
167
+ "Chorus Depth",
168
+ "Detune (Celeste) Depth",
169
+ "Phaser Depth",
170
+ "Data Increment",
171
+ "Data Decrement",
172
+ "Non-Registered Param LSB",
173
+ "Non-Registered Param MSB",
174
+ "Registered Param LSB",
175
+ "Registered Param MSB",
176
+ "102", "103", "104", "105", "106", "107", "108", "109",
177
+ "110", "111", "112", "113", "114", "115", "116", "117",
178
+ "118", "119", "120",
179
+ "Reset All Controllers",
180
+ "Local Control",
181
+ "All Notes Off",
182
+ "Omni Mode Off",
183
+ "Omni Mode On",
184
+ "Mono Mode On",
185
+ "Poly Mode On"
186
+ ]
187
+
188
+ # General MIDI patch names
189
+ GM_PATCH_NAMES = [
190
+ #--
191
+ # Pianos
192
+ #++
193
+ "Acoustic Grand Piano",
194
+ "Bright Acoustic Piano",
195
+ "Electric Grand Piano",
196
+ "Honky-tonk Piano",
197
+ "Electric Piano 1",
198
+ "Electric Piano 2",
199
+ "Harpsichord",
200
+ "Clavichord",
201
+ #--
202
+ # Tuned Idiophones
203
+ #++
204
+ "Celesta",
205
+ "Glockenspiel",
206
+ "Music Box",
207
+ "Vibraphone",
208
+ "Marimba",
209
+ "Xylophone",
210
+ "Tubular Bells",
211
+ "Dulcimer",
212
+ #--
213
+ # Organs
214
+ #++
215
+ "Drawbar Organ",
216
+ "Percussive Organ",
217
+ "Rock Organ",
218
+ "Church Organ",
219
+ "Reed Organ",
220
+ "Accordion",
221
+ "Harmonica",
222
+ "Tango Accordion",
223
+ #--
224
+ # Guitars
225
+ #++
226
+ "Acoustic Guitar (nylon)",
227
+ "Acoustic Guitar (steel)",
228
+ "Electric Guitar (jazz)",
229
+ "Electric Guitar (clean)",
230
+ "Electric Guitar (muted)",
231
+ "Overdriven Guitar",
232
+ "Distortion Guitar",
233
+ "Guitar harmonics",
234
+ #--
235
+ # Basses
236
+ #++
237
+ "Acoustic Bass",
238
+ "Electric Bass (finger)",
239
+ "Electric Bass (pick)",
240
+ "Fretless Bass",
241
+ "Slap Bass 1",
242
+ "Slap Bass 2",
243
+ "Synth Bass 1",
244
+ "Synth Bass 2",
245
+ #--
246
+ # Strings
247
+ #++
248
+ "Violin",
249
+ "Viola",
250
+ "Cello",
251
+ "Contrabass",
252
+ "Tremolo Strings",
253
+ "Pizzicato Strings",
254
+ "Orchestral Harp",
255
+ "Timpani",
256
+ #--
257
+ # Ensemble strings and voices
258
+ #++
259
+ "String Ensemble 1",
260
+ "String Ensemble 2",
261
+ "SynthStrings 1",
262
+ "SynthStrings 2",
263
+ "Choir Aahs",
264
+ "Voice Oohs",
265
+ "Synth Voice",
266
+ "Orchestra Hit",
267
+ #--
268
+ # Brass
269
+ #++
270
+ "Trumpet",
271
+ "Trombone",
272
+ "Tuba",
273
+ "Muted Trumpet",
274
+ "French Horn",
275
+ "Brass Section",
276
+ "SynthBrass 1",
277
+ "SynthBrass 2",
278
+ #--
279
+ # Reeds
280
+ #++
281
+ "Soprano Sax", # 64
282
+ "Alto Sax",
283
+ "Tenor Sax",
284
+ "Baritone Sax",
285
+ "Oboe",
286
+ "English Horn",
287
+ "Bassoon",
288
+ "Clarinet",
289
+ #--
290
+ # Pipes
291
+ #++
292
+ "Piccolo",
293
+ "Flute",
294
+ "Recorder",
295
+ "Pan Flute",
296
+ "Blown Bottle",
297
+ "Shakuhachi",
298
+ "Whistle",
299
+ "Ocarina",
300
+ #--
301
+ # Synth Leads
302
+ #++
303
+ "Lead 1 (square)",
304
+ "Lead 2 (sawtooth)",
305
+ "Lead 3 (calliope)",
306
+ "Lead 4 (chiff)",
307
+ "Lead 5 (charang)",
308
+ "Lead 6 (voice)",
309
+ "Lead 7 (fifths)",
310
+ "Lead 8 (bass + lead)",
311
+ #--
312
+ # Synth Pads
313
+ #++
314
+ "Pad 1 (new age)",
315
+ "Pad 2 (warm)",
316
+ "Pad 3 (polysynth)",
317
+ "Pad 4 (choir)",
318
+ "Pad 5 (bowed)",
319
+ "Pad 6 (metallic)",
320
+ "Pad 7 (halo)",
321
+ "Pad 8 (sweep)",
322
+ #--
323
+ # Effects
324
+ #++
325
+ "FX 1 (rain)",
326
+ "FX 2 (soundtrack)",
327
+ "FX 3 (crystal)",
328
+ "FX 4 (atmosphere)",
329
+ "FX 5 (brightness)",
330
+ "FX 6 (goblins)",
331
+ "FX 7 (echoes)",
332
+ "FX 8 (sci-fi)",
333
+ #--
334
+ # Ethnic
335
+ #++
336
+ "Sitar",
337
+ "Banjo",
338
+ "Shamisen",
339
+ "Koto",
340
+ "Kalimba",
341
+ "Bag pipe",
342
+ "Fiddle",
343
+ "Shanai",
344
+ #--
345
+ # Percussion
346
+ #++
347
+ "Tinkle Bell",
348
+ "Agogo",
349
+ "Steel Drums",
350
+ "Woodblock",
351
+ "Taiko Drum",
352
+ "Melodic Tom",
353
+ "Synth Drum",
354
+ "Reverse Cymbal",
355
+ #--
356
+ # Sound Effects
357
+ #++
358
+ "Guitar Fret Noise",
359
+ "Breath Noise",
360
+ "Seashore",
361
+ "Bird Tweet",
362
+ "Telephone Ring",
363
+ "Helicopter",
364
+ "Applause",
365
+ "Gunshot"
366
+ ]
367
+
368
+ # GM drum notes start at 35 (C), so subtrack GM_DRUM_NOTE_LOWEST from your
369
+ # note number before using this array.
370
+ GM_DRUM_NOTE_LOWEST = 35
371
+ # General MIDI drum channel note names.
372
+ GM_DRUM_NOTE_NAMES = [
373
+ "Acoustic Bass Drum", # 35, C
374
+ "Bass Drum 1", # 36, C#
375
+ "Side Stick", # 37, D
376
+ "Acoustic Snare", # 38, D#
377
+ "Hand Clap", # 39, E
378
+ "Electric Snare", # 40, F
379
+ "Low Floor Tom", # 41, F#
380
+ "Closed Hi Hat", # 42, G
381
+ "High Floor Tom", # 43, G#
382
+ "Pedal Hi-Hat", # 44, A
383
+ "Low Tom", # 45, A#
384
+ "Open Hi-Hat", # 46, B
385
+ "Low-Mid Tom", # 47, C
386
+ "Hi Mid Tom", # 48, C#
387
+ "Crash Cymbal 1", # 49, D
388
+ "High Tom", # 50, D#
389
+ "Ride Cymbal 1", # 51, E
390
+ "Chinese Cymbal", # 52, F
391
+ "Ride Bell", # 53, F#
392
+ "Tambourine", # 54, G
393
+ "Splash Cymbal", # 55, G#
394
+ "Cowbell", # 56, A
395
+ "Crash Cymbal 2", # 57, A#
396
+ "Vibraslap", # 58, B
397
+ "Ride Cymbal 2", # 59, C
398
+ "Hi Bongo", # 60, C#
399
+ "Low Bongo", # 61, D
400
+ "Mute Hi Conga", # 62, D#
401
+ "Open Hi Conga", # 63, E
402
+ "Low Conga", # 64, F
403
+ "High Timbale", # 65, F#
404
+ "Low Timbale", # 66, G
405
+ "High Agogo", # 67, G#
406
+ "Low Agogo", # 68, A
407
+ "Cabasa", # 69, A#
408
+ "Maracas", # 70, B
409
+ "Short Whistle", # 71, C
410
+ "Long Whistle", # 72, C#
411
+ "Short Guiro", # 73, D
412
+ "Long Guiro", # 74, D#
413
+ "Claves", # 75, E
414
+ "Hi Wood Block", # 76, F
415
+ "Low Wood Block", # 77, F#
416
+ "Mute Cuica", # 78, G
417
+ "Open Cuica", # 79, G#
418
+ "Mute Triangle", # 80, A
419
+ "Open Triangle" # 81, A#
420
+ ]
421
+
422
+ end