Loading MIDI file in a table or multislider...
I was wondering if anyone out there had a patch that loads
a MIDI file into a table or multislider. I have always
been amazed that Max does not come with something that does such
a basic function.
I assume I would have to use [seq] and then play the file,
parsing the output of that into the table. I guess the only
tricky part is quantizing note durations to fit in a fixed table
size.
Any one have any suggestions or a starting point/patch to
begin from?
Quote: Anthony Palomba wrote on Mon, 17 November 2008 09:04
----------------------------------------------------
> I was wondering if anyone out there had a patch that loads
> a MIDI file into a table or multislider. I have always
> been amazed that Max does not come with something that does such
> a basic function.
>
> I assume I would have to use [seq] and then play the file,
> parsing the output of that into the table. I guess the only
> tricky part is quantizing note durations to fit in a fixed table
> size.
>
> Any one have any suggestions or a starting point/patch to
> begin from?
----------------------------------------------------
I have an object that can load a MIDI file into a coll for use with Max 5's transport. I use the format:
bars.beats.ticks, pitch velocity duration
So the coll looks like:
1.1.0, 60 80 500;
And then a transport-synced [metro] can play back the MIDI at any rate by sending the values to a [makenote].
I guess you want to make each slider a certain note division, like 16th, and then store the pitches in the multislider? I could adapt my stuff to do something like that.
If you are interested in this, I can share it. But I am using a Ruby midi library to parse the MIDI file, so you would need to install my ajm objects to use my solution.
If you are ok with that, let me know. I don't mind trying to support the multislider approach, just let me know more specifically how it should work. And I still need to add some features: it doesn't quantize the MIDI but that should be easy. It also only uses the first track, but it should also be easy to support multiple tracks if needed (although I'm not sure if it should just merge all the events or prepend the track number when dumping out the midi data).
I was going to include this in the next release of ajm objects, but that's still a ways off so I could release this midi parser object later this week if there's interest. I understand if you'd prefer a pure Max solution.
And I agree something like this should be part of Max.
Interesting, I am curious to know is there any benefit to
using a col versus a table (or multislider)?
I do not use Ruby/Java much, although having a MIDI parser
sounds very attractive. I have been using seq to load MIDI
files and playback the data. Pretty clumsy but it works.
Quote: Anthony Palomba wrote on Mon, 17 November 2008 12:55
----------------------------------------------------
> Interesting, I am curious to know is there any benefit to
> using a col versus a table (or multislider)?
>
The benefit is a coll can store a list of values. So I can store pitch, velocity, and duration under a single entry. With a table/multislider, we could only store one of those attributes. I suppose you could split it up and use separate tables, one for pitch, one for velocity, one for duration.
The other benefit is coll only stores an entry when there is actually a note. So you could have a very long song stored in a coll with only one entry per note. In a table if there is a rest, you'd need to have a slider with a value 0, right? It takes up space to store all those rests, so there ends up being a practical limitation on the length of the MIDI you can represent this way.
table/multislider have some definite benefits though: you can easily draw on it to change the data, you can store it in pattrstorage and save presets, interpolate presets...
I like the idea of having each note as a list and stored in
compact format inside the col. I think I will go that route for
storing data, but ultimately I do want to be able to interpolate
aspects of the notes. As soon as I have something I will post it.
Quote: Anthony Palomba wrote on Mon, 17 November 2008 13:24
----------------------------------------------------
> I like the idea of having each note as a list and stored in
> compact format inside the col. I think I will go that route for
> storing data, but ultimately I do want to be able to interpolate
> aspects of the notes.
Maybe this will help:
https://cycling74.com/forums/index.php?t=msg&th=36620
>> I was wondering if anyone out there had a patch that loads
>> a MIDI file into a table or multislider. I have always
>> been amazed that Max does not come with something that does such
>> a basic function.
Don't know if this helps you, but I've had good luck with the John
MacCallum's Java-based midifile object:
Dan
Adam, While we're on this topic- I was wondering if you ever implemented the dropfile thing for midi file conversion.
Quote: Nick Inhofe wrote on Mon, 17 November 2008 20:13
----------------------------------------------------
> Adam, While we're on this topic- I was wondering if you ever implemented the dropfile thing for midi file conversion.
----------------------------------------------------
Hmm, you mean drag and drop into a [dropfile] object? I remember initially I had showed you just the Ruby part, but later I packaged it up into an abstraction called midi2coll which easily hooks up to a dropfile. I thought I emailed that to you at one point? That's the "object" I was refering to in this thread.
hmmm.. you know what I do have it. The weird thing is I just realized that I don't have a copy of ajm.ruby. It doesn't seem to be in the zip file from your site either. The help file is there, not not the actual patch.
ah. got it. I forgot that I haven't re-installed Ruby after doing a clean install of Leopard. Thats what I get for patching while half-awake
Quote: Nick Inhofe wrote on Tue, 18 November 2008 14:35
----------------------------------------------------
> ah. got it. I forgot that I haven't re-installed Ruby after doing a clean install of Leopard. Thats what I get for patching while half-awake
----------------------------------------------------
Sorry, was going to reply but I am really swamped with work right now.
If you did a clean install, there is a missing dependency for the midi support so the midi2coll stuff won't work. You need to unpack http://compusition.com/ajm-objects/jruby-1.1.2-gems-midilib.zip
under Cycling '74/java/lib/ruby
If you have any problems and can wait a bit, I want to pack all this stuff up into a new ajm objects zip on my website. Probably have time this weekend.