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
----------begin_max5_patcher---------- 882.3ocyXtrbaBCEFds8SgF1z1YHLHAhKcWd.5ptrsSGLHrUGPxEIhcRlLSe V5iVeRpjvWS.LI1k5MwCGIqyQe9W+GQdb5DqY70DgE3ifu.lL4woSlXBoCLY yySrJSVmVjHLSyJkWVRXRK6lwjj0RSbgjWQ.ETwtgVlHSWPYy+dEIU1jhHeG renWruM.EAc7vnf.nMHHxwUEw0wE7sMeYZlYU4y9wMwaWvbNSJnOPzi.gN3X LLJbaxpHBUYkHob1AIDGtOgg96RnqNeGlNVcIkUPjl8HbePdsbaT2CpBVRoo JrtshlTXoG3ooS0+w9Lw3rZVVAAjVvED.4N0TD.JSxAIGw1BJijxqYluDpaf Cci1C.WWC.7CrUwMHvyqcjGcFHuqTd8xbgrhtDnRKfwkja344Bq9P5dMU7KH ZWh3vyhnslwqWflxY2Qpj.krMuh7SqgoOg9gCklAmAMiiOHiwWQzrjHDIyI8 PKDx2PEeieomOT+ALrcFg2tPMEr79kjlUwxZ2zeF9baaqiZcqCunacFYkpje gNpTxy6CGvXC.1fCj4g31og2EhFv+ez3gBPEYdeGlBaNzD03sG1GOPcyC6Ki BAMJVM+4W+FrrH4dU+wzE7pLPBKCHTbQ0DU6lKrMQVooEPtf.xn44jJBKkn5 qZh7oj0fUTVFeUqcW86F3dPOm.nK1CaCThPbXTrerh4v.M5C5v7B5MD2qQ29 oCUmo4nljm9fXDdmaJF2m8MzuS0GU+abyGcoA6FSigPrCLoIDkcZFgaXjWjo UtKJJVeezNAEdHf5Myq1kUdiAujKTcmWn13mFYHWnCLJHRcxJHvI1UQO+tQF 5M3z+ZUTWX695xYjp93PPiUNb+8iv8d8HzIOeMKgM+hIXFGm9OSTWnznZ3EY Zu6RZg5UhTF0rLAXgxS+09xQdv82qFprxG3KGgvWk92cwsaqlWqG.HTosoEH IOot3.Z9U16wfREJAzbv87ZPFm8N03JYip6IHYyJ7gWKfQQAM2AQwVOTrGRI Yg9NPDzUy7NAbvnBXSIX1SO6eDhYGoieL0E75pzsmm1Z4.1uSxHBIkYdsiCm jZNvcyYAMKivNrFKoYK4pSmapAv2ZUBbQKI7nVRCBRGOo+0kj9dHmrlF4R53 eTZujL0MbbqI2gTSiGmP9CUN8V4j5gml9WfCTYe. -----------end_max5_patcher-----------
Amazingly helpful Terry! I’m going to make myself a cup of tea and check this out.
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.
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