Writing/reading a MIDI file with CC events

Sep 21, 2010 at 12:26am

Writing/reading a MIDI file with CC events

I’m hoping to be able to write and read a MIDI file with CC events, without having to record it in real time. In other words, I want to dump all of the data from a coll and use it to immediately write a MIDI file, and similarly to read a MIDI file and immediately dump all of the data into the coll.

[detonate] won’t work because I don’t think it supports MIDI CC. [seq] won’t work because when reading a MIDI file and stepping through the contents with the ticks message, the resolution is only 48 ticks per second according to the help file. The external object [midifile] might do the trick, but I can’t tell by looking at the help file whether or not MIDI CC events can be recorded via the dump method… i.e., it looks like they would need to be recorded in real time.

Perhaps a combination of [seq] and [midifile]? [seq] could be used to write MIDI files, and [midifile] could be used to read them. I’m not sure if a more elegant solution exists.

I’m also not sure if [seq]‘s low resolution is only when stepping through a MIDI file with the tick message, or if that’s how it writes them too.

Thanks.

#52411
Sep 21, 2010 at 3:07am

Check out the ‘read’ message to the seq object. (N.B. The manual lies a little; I think you need to end each line with a semicolon.) You can just generate a text file by whatever means you want, save it as .txt (not .mid, ’cause it won’t have a proper MIDI file header), and read that into seq to play it back.

#188444
Sep 21, 2010 at 3:58am

Thanks for your response. Assuming I understand you correctly, I think the problem with that is that once I read a file with [seq], I need to dump its contents into a coll right away. I can do this by using an [uzi] to rapidly send the “tick” message to [seq], but according to the docs, it results in a resolution of 48 ticks per second, which is just too low. :(

#188445
Sep 21, 2010 at 4:50am

If you want to come out of a coll, and then later put it back in a coll, why do you need MIDI files at all? Clearly I’m missing something.

#188446
Sep 21, 2010 at 6:10am

I’m working on (finished with, except for this part) a MIDI sequencer, which needs to be able to write/read MIDI files for/from other sequencers, and I have it set up so that the notes get stored in a coll. I could get rid of the coll, but I don’t think it would change anything. For example, if I were to use the external [midifile] to store notes instead of the coll, I would still need to be able to input notes and MIDI CC events not in real-time (the latter of which is not possible), and to be able to dump all of the notes and MIDI CC events at once in order to draw them.

#188447
Sep 21, 2010 at 3:58pm

Have you looked into this?
http://maxobjects.com/?v=objects&id_objet=4459&requested=MIDI&operateur=AND&id_plateforme=0&id_format=0
I don’t know anything about it, but there it is.

#188449
Sep 21, 2010 at 10:11pm

Thanks for the idea. I’ll keep it in mind for the future, but for now I don’t think it will work because it doesn’t seem to support more than one MIDI channel.

I’m actually trying to do what you suggested in this thread: http://cycling74.com/forums/topic.php?id=18202

I’ll keep posting on this thread though, because that one was solved with the [detonate] object, which doesn’t support MIDI CC.

I have what you suggested in the example below. It works beautifully for writing a MIDI file. Unfortunately, I tried to do the reverse as well (read a MIDI file with [seq] and dump its contents into [text] via an intermediary text file) and got stuck. Apparently when you send [seq] the message “write filename.txt,” it writes a MIDI file, except with a .txt extension. The only way to get [seq] to write a proper text file is to send it the “read” command, select “text” from the dropdown menu, and type the filename with a .txt extension. I wonder if this is a bug?

Thanks again for the help.

– Pasted Max Patch, click to expand. –
#188450
Sep 22, 2010 at 10:15am

only [detonate] can read files with more than 1 track i think

#188451
Sep 22, 2010 at 10:22pm

Yes, but I only need one track with multiple MIDI channels, which [seq] supports. Thanks though.

#188452
Sep 24, 2010 at 12:28am

If you can get Peter Swinnen to update his psw.midifile-parser to Max 5 then this might be what you’re looking for.

http://maxobjects.com/?v=objects&id_objet=1831&requested=parser&operateur=AND&id_plateforme=0&id_format=0

#188453

You must be logged in to reply to this topic.