Buffering note outputs from midiparse.
I've only been looking at Max/MSP for a day now but I'm getting to grips with it but I do have a question which I hope will allow me to get ahead more quickly if answered by you resident geniuses.
I had note data dripping out of the first output on a midiparse object which I'm currently just feeding into noteout.
It all sounds as expected - it's playing chords but what I'd really like to do is grab all those notes from each chord into something like an array or buffer, sort them into order of frequency and then compare each to a frequency that's being emitted from an fzero object.
Then when another chord is played the buffer is flushed and filled with the new note data from the new chord.
What components should I be looking at which will make this functionality most simple?
Thanks in advance guys!
As the chords always contain a fixed number of notes - 7 - I was thinking of perhaps having 7 buckets tacked onto the first out of midiparse which would act as a FIFO.
I'm a bit concerned though that as this output is also sending note-off and pitch/velocity data ( which is hopefully getting filtered out by the noteout object I was previously using, I'll more than likely have to introduce a manual filter to make sure I only get the note-on data I need.
Also, as I wish to compare midi notes with frequency, I'm obviously going to have to run through a conversion prior to comparison but I'm getting ahead of myself here somewhat.
Anyway, any suggestions would be most welcome.
you need to introduce yourself to a few objects-- this patch is adapted from the thresh help file
It should set you on the right track
Amazingly helpful Terry! I'm going to make myself a cup of tea and check this out.
Cheers.
That's really cool Terry. I've totally figured out what that's doing.
My seven notes appear in the message box in ascending order of pitch when a chord plays.
I need now to access these seven values in a meaningful way to compare against a frequency being delivered by fzero. I guess I'll look at zl.reg and see what's happening there.
Just while I'm here, what's the best way of smoothing the output of fzero so it's not quite so jumpy?
Thanks again for the help guys.
Rob.
have a look at the zl help file-- it has different modes for list operations such as grouping and getting the median value of a list for data smoothing. there's also some comparison functions as well
btw the reason why the notes appear in ascending order is only coincidence-- the list isn't being sorted, but you can do that if you need to using a zl mode