1 | <?php |
---|
2 | ///////////////////////////////////////////////////////////////// |
---|
3 | /// getID3() by James Heinrich <info@getid3.org> // |
---|
4 | // available at http://getid3.sourceforge.net // |
---|
5 | // or http://www.getid3.org // |
---|
6 | ///////////////////////////////////////////////////////////////// |
---|
7 | // See readme.txt for more details // |
---|
8 | ///////////////////////////////////////////////////////////////// |
---|
9 | // // |
---|
10 | // module.audio.midi.php // |
---|
11 | // module for Midi Audio files // |
---|
12 | // dependencies: NONE // |
---|
13 | // /// |
---|
14 | ///////////////////////////////////////////////////////////////// |
---|
15 | |
---|
16 | |
---|
17 | class getid3_midi |
---|
18 | { |
---|
19 | |
---|
20 | function getid3_midi(&$fd, &$ThisFileInfo, $scanwholefile=true) { |
---|
21 | |
---|
22 | // shortcut |
---|
23 | $ThisFileInfo['midi']['raw'] = array(); |
---|
24 | $thisfile_midi = &$ThisFileInfo['midi']; |
---|
25 | $thisfile_midi_raw = &$thisfile_midi['raw']; |
---|
26 | |
---|
27 | $ThisFileInfo['fileformat'] = 'midi'; |
---|
28 | $ThisFileInfo['audio']['dataformat'] = 'midi'; |
---|
29 | |
---|
30 | fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); |
---|
31 | $MIDIdata = fread($fd, GETID3_FREAD_BUFFER_SIZE); |
---|
32 | $offset = 0; |
---|
33 | $MIDIheaderID = substr($MIDIdata, $offset, 4); // 'MThd' |
---|
34 | if ($MIDIheaderID != 'MThd') { |
---|
35 | $ThisFileInfo['error'][] = 'Expecting "MThd" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$MIDIheaderID.'"'; |
---|
36 | unset($ThisFileInfo['fileformat']); |
---|
37 | return false; |
---|
38 | } |
---|
39 | $offset += 4; |
---|
40 | $thisfile_midi_raw['headersize'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4)); |
---|
41 | $offset += 4; |
---|
42 | $thisfile_midi_raw['fileformat'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); |
---|
43 | $offset += 2; |
---|
44 | $thisfile_midi_raw['tracks'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); |
---|
45 | $offset += 2; |
---|
46 | $thisfile_midi_raw['ticksperqnote'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); |
---|
47 | $offset += 2; |
---|
48 | |
---|
49 | for ($i = 0; $i < $thisfile_midi_raw['tracks']; $i++) { |
---|
50 | if ((strlen($MIDIdata) - $offset) < 8) { |
---|
51 | $MIDIdata .= fread($fd, GETID3_FREAD_BUFFER_SIZE); |
---|
52 | } |
---|
53 | $trackID = substr($MIDIdata, $offset, 4); |
---|
54 | $offset += 4; |
---|
55 | if ($trackID == 'MTrk') { |
---|
56 | $tracksize = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4)); |
---|
57 | $offset += 4; |
---|
58 | // $thisfile_midi['tracks'][$i]['size'] = $tracksize; |
---|
59 | $trackdataarray[$i] = substr($MIDIdata, $offset, $tracksize); |
---|
60 | $offset += $tracksize; |
---|
61 | } else { |
---|
62 | $ThisFileInfo['error'][] = 'Expecting "MTrk" at '.$offset.', found '.$trackID.' instead'; |
---|
63 | return false; |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | if (!isset($trackdataarray) || !is_array($trackdataarray)) { |
---|
68 | $ThisFileInfo['error'][] = 'Cannot find MIDI track information'; |
---|
69 | unset($thisfile_midi); |
---|
70 | unset($ThisFileInfo['fileformat']); |
---|
71 | return false; |
---|
72 | } |
---|
73 | |
---|
74 | if ($scanwholefile) { // this can take quite a long time, so have the option to bypass it if speed is very important |
---|
75 | $thisfile_midi['totalticks'] = 0; |
---|
76 | $ThisFileInfo['playtime_seconds'] = 0; |
---|
77 | $CurrentMicroSecondsPerBeat = 500000; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat |
---|
78 | $CurrentBeatsPerMinute = 120; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat |
---|
79 | $MicroSecondsPerQuarterNoteAfter = array (); |
---|
80 | |
---|
81 | foreach ($trackdataarray as $tracknumber => $trackdata) { |
---|
82 | |
---|
83 | $eventsoffset = 0; |
---|
84 | $LastIssuedMIDIcommand = 0; |
---|
85 | $LastIssuedMIDIchannel = 0; |
---|
86 | $CumulativeDeltaTime = 0; |
---|
87 | $TicksAtCurrentBPM = 0; |
---|
88 | while ($eventsoffset < strlen($trackdata)) { |
---|
89 | $eventid = 0; |
---|
90 | if (isset($MIDIevents[$tracknumber]) && is_array($MIDIevents[$tracknumber])) { |
---|
91 | $eventid = count($MIDIevents[$tracknumber]); |
---|
92 | } |
---|
93 | $deltatime = 0; |
---|
94 | for ($i = 0; $i < 4; $i++) { |
---|
95 | $deltatimebyte = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
96 | $deltatime = ($deltatime << 7) + ($deltatimebyte & 0x7F); |
---|
97 | if ($deltatimebyte & 0x80) { |
---|
98 | // another byte follows |
---|
99 | } else { |
---|
100 | break; |
---|
101 | } |
---|
102 | } |
---|
103 | $CumulativeDeltaTime += $deltatime; |
---|
104 | $TicksAtCurrentBPM += $deltatime; |
---|
105 | $MIDIevents[$tracknumber][$eventid]['deltatime'] = $deltatime; |
---|
106 | $MIDI_event_channel = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
107 | if ($MIDI_event_channel & 0x80) { |
---|
108 | // OK, normal event - MIDI command has MSB set |
---|
109 | $LastIssuedMIDIcommand = $MIDI_event_channel >> 4; |
---|
110 | $LastIssuedMIDIchannel = $MIDI_event_channel & 0x0F; |
---|
111 | } else { |
---|
112 | // running event - assume last command |
---|
113 | $eventsoffset--; |
---|
114 | } |
---|
115 | $MIDIevents[$tracknumber][$eventid]['eventid'] = $LastIssuedMIDIcommand; |
---|
116 | $MIDIevents[$tracknumber][$eventid]['channel'] = $LastIssuedMIDIchannel; |
---|
117 | if ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x08) { // Note off (key is released) |
---|
118 | |
---|
119 | $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
120 | $velocity = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
121 | |
---|
122 | } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x09) { // Note on (key is pressed) |
---|
123 | |
---|
124 | $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
125 | $velocity = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
126 | |
---|
127 | } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0A) { // Key after-touch |
---|
128 | |
---|
129 | $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
130 | $velocity = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
131 | |
---|
132 | } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0B) { // Control Change |
---|
133 | |
---|
134 | $controllernum = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
135 | $newvalue = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
136 | |
---|
137 | } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0C) { // Program (patch) change |
---|
138 | |
---|
139 | $newprogramnum = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
140 | |
---|
141 | $thisfile_midi_raw['track'][$tracknumber]['instrumentid'] = $newprogramnum; |
---|
142 | if ($tracknumber == 10) { |
---|
143 | $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIpercussionLookup($newprogramnum); |
---|
144 | } else { |
---|
145 | $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIinstrumentLookup($newprogramnum); |
---|
146 | } |
---|
147 | |
---|
148 | } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0D) { // Channel after-touch |
---|
149 | |
---|
150 | $channelnumber = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
151 | |
---|
152 | } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0E) { // Pitch wheel change (2000H is normal or no change) |
---|
153 | |
---|
154 | $changeLSB = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
155 | $changeMSB = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
156 | $pitchwheelchange = (($changeMSB & 0x7F) << 7) & ($changeLSB & 0x7F); |
---|
157 | |
---|
158 | } elseif (($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0F) && ($MIDIevents[$tracknumber][$eventid]['channel'] == 0x0F)) { |
---|
159 | |
---|
160 | $METAeventCommand = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
161 | $METAeventLength = ord(substr($trackdata, $eventsoffset++, 1)); |
---|
162 | $METAeventData = substr($trackdata, $eventsoffset, $METAeventLength); |
---|
163 | $eventsoffset += $METAeventLength; |
---|
164 | switch ($METAeventCommand) { |
---|
165 | case 0x00: // Set track sequence number |
---|
166 | $track_sequence_number = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength)); |
---|
167 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['seqno'] = $track_sequence_number; |
---|
168 | break; |
---|
169 | |
---|
170 | case 0x01: // Text: generic |
---|
171 | $text_generic = substr($METAeventData, 0, $METAeventLength); |
---|
172 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['text'] = $text_generic; |
---|
173 | $thisfile_midi['comments']['comment'][] = $text_generic; |
---|
174 | break; |
---|
175 | |
---|
176 | case 0x02: // Text: copyright |
---|
177 | $text_copyright = substr($METAeventData, 0, $METAeventLength); |
---|
178 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['copyright'] = $text_copyright; |
---|
179 | $thisfile_midi['comments']['copyright'][] = $text_copyright; |
---|
180 | break; |
---|
181 | |
---|
182 | case 0x03: // Text: track name |
---|
183 | $text_trackname = substr($METAeventData, 0, $METAeventLength); |
---|
184 | $thisfile_midi_raw['track'][$tracknumber]['name'] = $text_trackname; |
---|
185 | break; |
---|
186 | |
---|
187 | case 0x04: // Text: track instrument name |
---|
188 | $text_instrument = substr($METAeventData, 0, $METAeventLength); |
---|
189 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['instrument'] = $text_instrument; |
---|
190 | break; |
---|
191 | |
---|
192 | case 0x05: // Text: lyrics |
---|
193 | $text_lyrics = substr($METAeventData, 0, $METAeventLength); |
---|
194 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['lyrics'] = $text_lyrics; |
---|
195 | if (!isset($thisfile_midi['lyrics'])) { |
---|
196 | $thisfile_midi['lyrics'] = ''; |
---|
197 | } |
---|
198 | $thisfile_midi['lyrics'] .= $text_lyrics."\n"; |
---|
199 | break; |
---|
200 | |
---|
201 | case 0x06: // Text: marker |
---|
202 | $text_marker = substr($METAeventData, 0, $METAeventLength); |
---|
203 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['marker'] = $text_marker; |
---|
204 | break; |
---|
205 | |
---|
206 | case 0x07: // Text: cue point |
---|
207 | $text_cuepoint = substr($METAeventData, 0, $METAeventLength); |
---|
208 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['cuepoint'] = $text_cuepoint; |
---|
209 | break; |
---|
210 | |
---|
211 | case 0x2F: // End Of Track |
---|
212 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['EOT'] = $CumulativeDeltaTime; |
---|
213 | break; |
---|
214 | |
---|
215 | case 0x51: // Tempo: microseconds / quarter note |
---|
216 | $CurrentMicroSecondsPerBeat = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength)); |
---|
217 | if ($CurrentMicroSecondsPerBeat == 0) { |
---|
218 | $ThisFileInfo['error'][] = 'Corrupt MIDI file: CurrentMicroSecondsPerBeat == zero'; |
---|
219 | return false; |
---|
220 | } |
---|
221 | $thisfile_midi_raw['events'][$tracknumber][$CumulativeDeltaTime]['us_qnote'] = $CurrentMicroSecondsPerBeat; |
---|
222 | $CurrentBeatsPerMinute = (1000000 / $CurrentMicroSecondsPerBeat) * 60; |
---|
223 | $MicroSecondsPerQuarterNoteAfter[$CumulativeDeltaTime] = $CurrentMicroSecondsPerBeat; |
---|
224 | $TicksAtCurrentBPM = 0; |
---|
225 | break; |
---|
226 | |
---|
227 | case 0x58: // Time signature |
---|
228 | $timesig_numerator = getid3_lib::BigEndian2Int($METAeventData{0}); |
---|
229 | $timesig_denominator = pow(2, getid3_lib::BigEndian2Int($METAeventData{1})); // $02 -> x/4, $03 -> x/8, etc |
---|
230 | $timesig_32inqnote = getid3_lib::BigEndian2Int($METAeventData{2}); // number of 32nd notes to the quarter note |
---|
231 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_32inqnote'] = $timesig_32inqnote; |
---|
232 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_numerator'] = $timesig_numerator; |
---|
233 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_denominator'] = $timesig_denominator; |
---|
234 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_text'] = $timesig_numerator.'/'.$timesig_denominator; |
---|
235 | $thisfile_midi['timesignature'][] = $timesig_numerator.'/'.$timesig_denominator; |
---|
236 | break; |
---|
237 | |
---|
238 | case 0x59: // Keysignature |
---|
239 | $keysig_sharpsflats = getid3_lib::BigEndian2Int($METAeventData{0}); |
---|
240 | if ($keysig_sharpsflats & 0x80) { |
---|
241 | // (-7 -> 7 flats, 0 ->key of C, 7 -> 7 sharps) |
---|
242 | $keysig_sharpsflats -= 256; |
---|
243 | } |
---|
244 | |
---|
245 | $keysig_majorminor = getid3_lib::BigEndian2Int($METAeventData{1}); // 0 -> major, 1 -> minor |
---|
246 | $keysigs = array(-7=>'Cb', -6=>'Gb', -5=>'Db', -4=>'Ab', -3=>'Eb', -2=>'Bb', -1=>'F', 0=>'C', 1=>'G', 2=>'D', 3=>'A', 4=>'E', 5=>'B', 6=>'F#', 7=>'C#'); |
---|
247 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_sharps'] = (($keysig_sharpsflats > 0) ? abs($keysig_sharpsflats) : 0); |
---|
248 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_flats'] = (($keysig_sharpsflats < 0) ? abs($keysig_sharpsflats) : 0); |
---|
249 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] = (bool) $keysig_majorminor; |
---|
250 | //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_text'] = $keysigs[$keysig_sharpsflats].' '.($thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] ? 'minor' : 'major'); |
---|
251 | |
---|
252 | // $keysigs[$keysig_sharpsflats] gets an int key (correct) - $keysigs["$keysig_sharpsflats"] gets a string key (incorrect) |
---|
253 | $thisfile_midi['keysignature'][] = $keysigs[$keysig_sharpsflats].' '.((bool) $keysig_majorminor ? 'minor' : 'major'); |
---|
254 | break; |
---|
255 | |
---|
256 | case 0x7F: // Sequencer specific information |
---|
257 | $custom_data = substr($METAeventData, 0, $METAeventLength); |
---|
258 | break; |
---|
259 | |
---|
260 | default: |
---|
261 | $ThisFileInfo['warning'][] = 'Unhandled META Event Command: '.$METAeventCommand; |
---|
262 | break; |
---|
263 | } |
---|
264 | |
---|
265 | } else { |
---|
266 | |
---|
267 | $ThisFileInfo['warning'][] = 'Unhandled MIDI Event ID: '.$MIDIevents[$tracknumber][$eventid]['eventid'].' + Channel ID: '.$MIDIevents[$tracknumber][$eventid]['channel']; |
---|
268 | |
---|
269 | } |
---|
270 | } |
---|
271 | if (($tracknumber > 0) || (count($trackdataarray) == 1)) { |
---|
272 | $thisfile_midi['totalticks'] = max($thisfile_midi['totalticks'], $CumulativeDeltaTime); |
---|
273 | } |
---|
274 | } |
---|
275 | $previoustickoffset = null; |
---|
276 | |
---|
277 | ksort($MicroSecondsPerQuarterNoteAfter); |
---|
278 | foreach ($MicroSecondsPerQuarterNoteAfter as $tickoffset => $microsecondsperbeat) { |
---|
279 | if (is_null($previoustickoffset)) { |
---|
280 | $prevmicrosecondsperbeat = $microsecondsperbeat; |
---|
281 | $previoustickoffset = $tickoffset; |
---|
282 | continue; |
---|
283 | } |
---|
284 | if ($thisfile_midi['totalticks'] > $tickoffset) { |
---|
285 | |
---|
286 | if ($thisfile_midi_raw['ticksperqnote'] == 0) { |
---|
287 | $ThisFileInfo['error'][] = 'Corrupt MIDI file: ticksperqnote == zero'; |
---|
288 | return false; |
---|
289 | } |
---|
290 | |
---|
291 | $ThisFileInfo['playtime_seconds'] += (($tickoffset - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($prevmicrosecondsperbeat / 1000000); |
---|
292 | |
---|
293 | $prevmicrosecondsperbeat = $microsecondsperbeat; |
---|
294 | $previoustickoffset = $tickoffset; |
---|
295 | } |
---|
296 | } |
---|
297 | if ($thisfile_midi['totalticks'] > $previoustickoffset) { |
---|
298 | |
---|
299 | if ($thisfile_midi_raw['ticksperqnote'] == 0) { |
---|
300 | $ThisFileInfo['error'][] = 'Corrupt MIDI file: ticksperqnote == zero'; |
---|
301 | return false; |
---|
302 | } |
---|
303 | |
---|
304 | $ThisFileInfo['playtime_seconds'] += (($thisfile_midi['totalticks'] - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($microsecondsperbeat / 1000000); |
---|
305 | |
---|
306 | } |
---|
307 | } |
---|
308 | |
---|
309 | |
---|
310 | if (@$ThisFileInfo['playtime_seconds'] > 0) { |
---|
311 | $ThisFileInfo['bitrate'] = (($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8) / $ThisFileInfo['playtime_seconds']; |
---|
312 | } |
---|
313 | |
---|
314 | if (!empty($thisfile_midi['lyrics'])) { |
---|
315 | $thisfile_midi['comments']['lyrics'][] = $thisfile_midi['lyrics']; |
---|
316 | } |
---|
317 | |
---|
318 | return true; |
---|
319 | } |
---|
320 | |
---|
321 | function GeneralMIDIinstrumentLookup($instrumentid) { |
---|
322 | |
---|
323 | $begin = __LINE__; |
---|
324 | |
---|
325 | /** This is not a comment! |
---|
326 | |
---|
327 | 0 Acoustic Grand |
---|
328 | 1 Bright Acoustic |
---|
329 | 2 Electric Grand |
---|
330 | 3 Honky-Tonk |
---|
331 | 4 Electric Piano 1 |
---|
332 | 5 Electric Piano 2 |
---|
333 | 6 Harpsichord |
---|
334 | 7 Clavier |
---|
335 | 8 Celesta |
---|
336 | 9 Glockenspiel |
---|
337 | 10 Music Box |
---|
338 | 11 Vibraphone |
---|
339 | 12 Marimba |
---|
340 | 13 Xylophone |
---|
341 | 14 Tubular Bells |
---|
342 | 15 Dulcimer |
---|
343 | 16 Drawbar Organ |
---|
344 | 17 Percussive Organ |
---|
345 | 18 Rock Organ |
---|
346 | 19 Church Organ |
---|
347 | 20 Reed Organ |
---|
348 | 21 Accordian |
---|
349 | 22 Harmonica |
---|
350 | 23 Tango Accordian |
---|
351 | 24 Acoustic Guitar (nylon) |
---|
352 | 25 Acoustic Guitar (steel) |
---|
353 | 26 Electric Guitar (jazz) |
---|
354 | 27 Electric Guitar (clean) |
---|
355 | 28 Electric Guitar (muted) |
---|
356 | 29 Overdriven Guitar |
---|
357 | 30 Distortion Guitar |
---|
358 | 31 Guitar Harmonics |
---|
359 | 32 Acoustic Bass |
---|
360 | 33 Electric Bass (finger) |
---|
361 | 34 Electric Bass (pick) |
---|
362 | 35 Fretless Bass |
---|
363 | 36 Slap Bass 1 |
---|
364 | 37 Slap Bass 2 |
---|
365 | 38 Synth Bass 1 |
---|
366 | 39 Synth Bass 2 |
---|
367 | 40 Violin |
---|
368 | 41 Viola |
---|
369 | 42 Cello |
---|
370 | 43 Contrabass |
---|
371 | 44 Tremolo Strings |
---|
372 | 45 Pizzicato Strings |
---|
373 | 46 Orchestral Strings |
---|
374 | 47 Timpani |
---|
375 | 48 String Ensemble 1 |
---|
376 | 49 String Ensemble 2 |
---|
377 | 50 SynthStrings 1 |
---|
378 | 51 SynthStrings 2 |
---|
379 | 52 Choir Aahs |
---|
380 | 53 Voice Oohs |
---|
381 | 54 Synth Voice |
---|
382 | 55 Orchestra Hit |
---|
383 | 56 Trumpet |
---|
384 | 57 Trombone |
---|
385 | 58 Tuba |
---|
386 | 59 Muted Trumpet |
---|
387 | 60 French Horn |
---|
388 | 61 Brass Section |
---|
389 | 62 SynthBrass 1 |
---|
390 | 63 SynthBrass 2 |
---|
391 | 64 Soprano Sax |
---|
392 | 65 Alto Sax |
---|
393 | 66 Tenor Sax |
---|
394 | 67 Baritone Sax |
---|
395 | 68 Oboe |
---|
396 | 69 English Horn |
---|
397 | 70 Bassoon |
---|
398 | 71 Clarinet |
---|
399 | 72 Piccolo |
---|
400 | 73 Flute |
---|
401 | 74 Recorder |
---|
402 | 75 Pan Flute |
---|
403 | 76 Blown Bottle |
---|
404 | 77 Shakuhachi |
---|
405 | 78 Whistle |
---|
406 | 79 Ocarina |
---|
407 | 80 Lead 1 (square) |
---|
408 | 81 Lead 2 (sawtooth) |
---|
409 | 82 Lead 3 (calliope) |
---|
410 | 83 Lead 4 (chiff) |
---|
411 | 84 Lead 5 (charang) |
---|
412 | 85 Lead 6 (voice) |
---|
413 | 86 Lead 7 (fifths) |
---|
414 | 87 Lead 8 (bass + lead) |
---|
415 | 88 Pad 1 (new age) |
---|
416 | 89 Pad 2 (warm) |
---|
417 | 90 Pad 3 (polysynth) |
---|
418 | 91 Pad 4 (choir) |
---|
419 | 92 Pad 5 (bowed) |
---|
420 | 93 Pad 6 (metallic) |
---|
421 | 94 Pad 7 (halo) |
---|
422 | 95 Pad 8 (sweep) |
---|
423 | 96 FX 1 (rain) |
---|
424 | 97 FX 2 (soundtrack) |
---|
425 | 98 FX 3 (crystal) |
---|
426 | 99 FX 4 (atmosphere) |
---|
427 | 100 FX 5 (brightness) |
---|
428 | 101 FX 6 (goblins) |
---|
429 | 102 FX 7 (echoes) |
---|
430 | 103 FX 8 (sci-fi) |
---|
431 | 104 Sitar |
---|
432 | 105 Banjo |
---|
433 | 106 Shamisen |
---|
434 | 107 Koto |
---|
435 | 108 Kalimba |
---|
436 | 109 Bagpipe |
---|
437 | 110 Fiddle |
---|
438 | 111 Shanai |
---|
439 | 112 Tinkle Bell |
---|
440 | 113 Agogo |
---|
441 | 114 Steel Drums |
---|
442 | 115 Woodblock |
---|
443 | 116 Taiko Drum |
---|
444 | 117 Melodic Tom |
---|
445 | 118 Synth Drum |
---|
446 | 119 Reverse Cymbal |
---|
447 | 120 Guitar Fret Noise |
---|
448 | 121 Breath Noise |
---|
449 | 122 Seashore |
---|
450 | 123 Bird Tweet |
---|
451 | 124 Telephone Ring |
---|
452 | 125 Helicopter |
---|
453 | 126 Applause |
---|
454 | 127 Gunshot |
---|
455 | |
---|
456 | */ |
---|
457 | |
---|
458 | return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIinstrument'); |
---|
459 | } |
---|
460 | |
---|
461 | function GeneralMIDIpercussionLookup($instrumentid) { |
---|
462 | |
---|
463 | $begin = __LINE__; |
---|
464 | |
---|
465 | /** This is not a comment! |
---|
466 | |
---|
467 | 35 Acoustic Bass Drum |
---|
468 | 36 Bass Drum 1 |
---|
469 | 37 Side Stick |
---|
470 | 38 Acoustic Snare |
---|
471 | 39 Hand Clap |
---|
472 | 40 Electric Snare |
---|
473 | 41 Low Floor Tom |
---|
474 | 42 Closed Hi-Hat |
---|
475 | 43 High Floor Tom |
---|
476 | 44 Pedal Hi-Hat |
---|
477 | 45 Low Tom |
---|
478 | 46 Open Hi-Hat |
---|
479 | 47 Low-Mid Tom |
---|
480 | 48 Hi-Mid Tom |
---|
481 | 49 Crash Cymbal 1 |
---|
482 | 50 High Tom |
---|
483 | 51 Ride Cymbal 1 |
---|
484 | 52 Chinese Cymbal |
---|
485 | 53 Ride Bell |
---|
486 | 54 Tambourine |
---|
487 | 55 Splash Cymbal |
---|
488 | 56 Cowbell |
---|
489 | 57 Crash Cymbal 2 |
---|
490 | 59 Ride Cymbal 2 |
---|
491 | 60 Hi Bongo |
---|
492 | 61 Low Bongo |
---|
493 | 62 Mute Hi Conga |
---|
494 | 63 Open Hi Conga |
---|
495 | 64 Low Conga |
---|
496 | 65 High Timbale |
---|
497 | 66 Low Timbale |
---|
498 | 67 High Agogo |
---|
499 | 68 Low Agogo |
---|
500 | 69 Cabasa |
---|
501 | 70 Maracas |
---|
502 | 71 Short Whistle |
---|
503 | 72 Long Whistle |
---|
504 | 73 Short Guiro |
---|
505 | 74 Long Guiro |
---|
506 | 75 Claves |
---|
507 | 76 Hi Wood Block |
---|
508 | 77 Low Wood Block |
---|
509 | 78 Mute Cuica |
---|
510 | 79 Open Cuica |
---|
511 | 80 Mute Triangle |
---|
512 | 81 Open Triangle |
---|
513 | |
---|
514 | */ |
---|
515 | |
---|
516 | return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIpercussion'); |
---|
517 | } |
---|
518 | |
---|
519 | } |
---|
520 | |
---|
521 | |
---|
522 | ?> |
---|