2

I've been working on a PHP script that takes a word or phrase and converts it into ASCII tablature using a combination of Morse code rules and my own set of rules.

At this point, the program is nearly complete... all that's missing is the code to convert the ASCII tablature into a MIDI file.

The most recent version of the script can be found here:

Morse Code Machine

I found lots of resources for multiple languages, but still can't find any data definitions for MIDI files in XML or MF2T/T2MF formats. I can understand the ASCII format and adjust my script's output accordingly, but the closest tool that I could find that converts ASCII into MIDI is this Perl module. It seems the most promising tool/resource out of everything I've found so far, but I am looking for a PHP solution.

Does anyone have any suggestions as to how I might go about figuring out the "syntax" of an XML and/or MF2T/T2MF text format for tablature? It seems easy enough, but I'm just finding tools and scripts with little to no documentation on the file format used to create MIDI files from ASCII formatted tablature.

The ASCII Tablature will conform to these standards and I want to programmatically convert the ASCII tabs directly into MIDI files via PHP (or Perl if I have to)


EDIT:

Found another SO question that links to a bunch of sites that describe the technical details of the MIDI file format.

Here's the link: What is the structure of a MIDI file?

Another good resource for MIDI file format:

http://courses.cs.washington.edu/courses/cse466/03au/Labs/lab-5/Lab5_files/Standard%20MIDI%20file%20format,%20updated.pdf

Community
  • 1
  • 1
CheeseConQueso
  • 5,831
  • 29
  • 93
  • 126
  • You may be interested in: http://stackoverflow.com/questions/5751294/php-midi-generator – TonyWilk Mar 09 '14 at 18:46
  • Thanks, I've been through all that material.. It produces a text file in a format called mf2t (I'm guessing midi file 2 text) and I can't find any thorough documentation about how the file is set up – CheeseConQueso Mar 09 '14 at 18:55
  • 1
    Looks like you could modify midi.class.php from http://valentin.dasdeck.com/midi/downloads/ to do what you want ??? – TonyWilk Mar 09 '14 at 19:13
  • Yeah, it does seem like that - but like I was saying, I don't know enough about the MF2T/T2MF "syntax" to effectively modify that script. I can't make heads or tails of it even when I run simple midi files through the script to see how it looks in that text format. I found a small table that showed what certain portions of the text were for (header/footer) and also learned that it uses hexadecimal values extensively. – CheeseConQueso Mar 09 '14 at 20:17
  • Tabs really aren't precise enough to make a MIDI from — at least not without a lot of adjustment afterwards. They're meant to be read by someone who knows the timing of the song, or has a recording to work with. – hobbs Mar 09 '14 at 21:33
  • I agree with you, but the tabs I'm creating aren't complicated at all - what route do you think I should take if not ASCII tab -> MIDI? I have been looking for other ways, but I'm still having no luck. At this point, I wouldn't mind if I was able to convert to WAV or MP3 - anything that will play the supplied tabs will do. – CheeseConQueso Mar 09 '14 at 22:19

1 Answers1

0

I ended up changing my approach to the problem. I used the RTTTL format because it fulfills all my requirements. The format is limited to playing only one note at a time. That means chords (two or more notes &| string played simultaneously) aren't possible. I have only been testing the RTTTL conversion method for a short time so I could be wrong, but I couldn't find any way to accomplish chords with this protocol.

Since my program doesn't require that more than one note be played at the same time, I didn't end up sacrificing anything by using the RTTTL format.

I would still like to figure out ANY way to programmatically convert tablature in any type of structured text form into any type of audible file (MIDI, WAV, MP3, OGG, WMA, etc...)

For now, I'm closing this question because I've resolved my issue although not exactly the way I initially intended on doing so.

CheeseConQueso
  • 5,831
  • 29
  • 93
  • 126