Monday, November 12, 2007

RE: Extracting Song Information With The Parser

This is in response to a comment left about the php ptparser. Parsing power tab song info and displaying it is pretty easy. See the following code below for example.




<?php

require_once "powertabdocument.php";

$ptb = new PowerTabDocument ();

$ptb->Load ("powertabfile.ptb");

// Example see more functions below:
$ptb->GetHeader()->GetSongArtist();

// GetLessonAuthor()
// GetLessonCopyright()
// GetLessonLevel()
// GetLessonMusicStyle()
// GetLessonNotes()
// GetLessonSubtitle()
// GetLessonTitle()
// GetSongArranger()
// GetSongArtist()
// GetSongAudioReleaseTitle()
// GetSongAudioReleaseType()
// GetSongAudioReleaseYear()
// GetSongAuthorType()
// GetSongBassScoreNotes()
// GetSongBassScoreTranscriber()
// GetSongBootlegDate()
// GetSongBootlegTitle()
// GetSongComposer()
// GetSongContentType()
// GetSongCopyright()
// GetSongGuitarScoreNotes()
// GetSongGuitarScoreTranscriber()
// GetSongLyricist()
// GetSongLyrics()
// GetSongReleaseTitle()
// GetSongReleaseType()
// GetSongTitle()

?>

2 comments:

Nazgyl said...

Thanks a million, it worked like a charm!!
i think there is a problem with generalmidi.php when i use your code i get the results fine however the php dumps code from generalmidi.php
i redownloaded the parser to check if i messed up! but the code throws the same code...this is the code i see on the php page..

MAX_MIDI_NOTE) $temp = MAX_MIDI_NOTE; return $temp; } /// Determines if a MIDI note key is valid /// @param key MIDI note key to validate /// @return True if the MIDI note key is valid, false if not function wxIsValidMidiNoteKey($key) { //------Last Checked------// // - Dec 9, 2004 return ($key <= MAX_MIDI_NOTE_KEY); } /// Gets the pitch value for a MIDI note /// @param note MIDI note to get the pitch value for /// @return The pitch value for the MIDI note function wxGetMidiNotePitch($note) { //------Last Checked------// // - Dec 9, 2004 return ($note % 12); } /// Gets the octave value for a MIDI note /// @param note MIDI note to get the octave value for /// @return The octave value for the MIDI note function wxGetMidiNoteOctave($note) { //------Last Checked------// // - Dec 9, 2004 return (($note / 12) - 1); } /// Determines if a MIDI note volume is valid /// @param volume MIDI note volume to validate /// @return True if the MIDI note volume is valid, false if not function wxIsValidMidiNoteVolume($volume) { //------Last Checked------// // - Dec 9, 2004 return ($volume <= MAX_MIDI_NOTE_VOLUME); } // MIDI Preset Functions /// Determines if a MIDI preset is valid /// @param preset MIDI preset to validate /// @return True if the MIDI preset is valid, false if not function wxIsValidMidiPreset($preset) { //------Last Checked------// // - Dec 9, 2004 return ($preset <= LAST_MIDI_PRESET); } // MIDI Percussion Preset Functions /// Determines if a MIDI percussion preset is valid /// @param preset MIDI percussion preset to validate /// @return True if the MIDI percussion preset is valid, false if not function wxIsValidMidiPercussionPreset($preset) { //------Last Checked------// // - Dec 9, 2004 return ($preset <= LAST_MIDI_PERCUSSION_PRESET); } ?>

Nazgyl said...

Hello again, im such a pain in the ass, i have a question, i scanned the phpparser files, but i dont see any functionality for exporting the file to ascii, is there such an option?

Music Headlines

Loading...