/** * @since 1.0 * @uses Note::getNoteName() * * @return string */ public function getParamDescription() { return \Midi\Util\Note::getNoteName($this->param1) . ' with velocity ' . $this->param2; }
while ($chunk = $parser->parse()) { if ($chunk instanceof Delta) { $a = $chunk->getData(); $time = $time + $a[0]; } else { if ($chunk instanceof SetTempoEvent) { $bpm = $chunk->bpm; } else { if ($chunk instanceof NoteOnEvent) { if ($currentTrack == -1) { $currentTrack++; $tracks[$currentTrack] = '[Untitled Track]'; $trackNoteCount[$currentTrack] = 0; } $noteTime = $time / ($timeDivision / 4); $noteArray[] = array((int) $noteTime, str_replace(array("7", "8"), "6", \Midi\Util\Note::getNoteName($chunk->param1 + 12)), 1); $trackNoteCount[$currentTrack]++; } else { if ($chunk instanceof EndOfTrackEvent) { if ($time > $maxTime) { $maxTime = $time; } $time = 0; $currentTrack++; $trackNoteCount[$currentTrack] = 0; $tracks[$currentTrack] = '[Untitled Track]'; } else { if ($chunk instanceof TrackNameEvent) { $track = $chunk->getData(); $track = $track[2]; $tracks[$currentTrack] = $track;
if ($currentTrack == -1) { $currentTrack++; } $noteTime = round($time / ($timeDivision / 4), 2); if (isset($_GET['trackInstruments'][$currentTrack]) && is_numeric($_GET['trackInstruments'][$currentTrack])) { $instrument = $_GET['trackInstruments'][$currentTrack]; } else { $instrument = 1; } if (isset($_GET['trackTranspose'][$currentTrack]) && is_numeric($_GET['trackTranspose'][$currentTrack])) { $transpose = $_GET['trackTranspose'][$currentTrack]; } else { $transpose = 0; } if ($instrument != -1) { $noteArray[] = array($startTime[$chunk->param1], str_replace(array("0", "1"), "2", str_replace(array("8", "9", "10"), "7", \Midi\Util\Note::getNoteName($chunk->param1 + 12 + 12 * $transpose))), round($noteTime - $startTime[$chunk->param1]), $instrument); } } else { if ($chunk instanceof NoteOnEvent) { $noteTime = round($time / ($timeDivision / 4), 2); $startTime[$chunk->param1] = $noteTime; } else { if ($chunk instanceof EndOfTrackEvent) { if ($time > $maxTime) { $maxTime = $time; } $time = 0; $currentTrack++; } else { if ($chunk instanceof FileHeader) { $a = $chunk->getData();