Convert MIDI Type 0 file to .txt file

stanrad's icon

I've been trying to wrap my head around a solution for converting a midi file type 0 file to a text file in the following format.

"song.mid"---->"song.txt"

See example .txt file:

Screen Shot 2019-07-30 at 9.10.35 PM.png

For each note on, I'll need the pitch number followed by a semicolon.

For multiple note ons, (polyphony) the pitch numbers should be grouped on the same line.

I don't need velocity, ticks, channel numbers or timing data, just note-ons.

The purpose is to create a text file that can be read and played back via drum triggers-so timing will be dictated by "human" rhythmic hits on a drum. (It should be a .txt file due to certain limitations)

I've tried the seq object with midparse but the major issue i'm experiencing is how to parse the data into a this specific simple stripped down readable text format.

I'd prefer not to go to 3rd party solutions. (On a Mac)

Would be great to hear your thoughts, feedback, solutions.

Sincerely,

Simon

Roman Thilenius's icon

[detonate] is perfect for this. use its text export, then check how to convert the textfile it produces.

if you think you dont get it to work using [text] and [sprintf], bbedit.app should also be enough.

Source Audio's icon

If You want to keep seq - midiparse way:

Max Patch
Copy patch and select New From Clipboard in Max.

It also depends on the midi file.
If it does not contain anything other than notes,
converting to text and then trying to parse it, could work,
but otherwise one would have to remove all other midi data
and so at the end still spend time manually editing the whole thing,
removing note offs, trying to group notes for polyphony and so
it might be just faster to capture it as in example above.

stanrad's icon

Thanks. The midiparse way seemed to do the trick!