How to load arbitrary data into a buffer~?

Mar 8, 2012 at 10:45pm

How to load arbitrary data into a buffer~?

Howdy, all!

I’m a newbie to Max/MSP, so please bear with me…

I have an external object that is generating chunks of data in near-real-time. In my patcher I’d like to import that data directly into a buffer~ . Is this possible? Yes, I could make my extern first write the data to an audio file for buffer~ then to read, but that is (a) inelegant, (b) inefficient, and (c) a potential source of thorny timing problems. I’m looking for a way to get the data directly into buffer~.

Any suggestions?


– jt

Mar 9, 2012 at 5:04am

what’s the format? if you have it as a text file, with one data point per line, with the data between -1.0 and 1.0, you’re all set, you can use [text] to read it in and then peek~ to bring it into buffer~. If the data is out of this range, use [scale]. If your object is just spitting out data, you can still use peek~, just decide when you want to start the data and use a [trigger] to [counter] to create indices for peek~.

If it’s chunks of data as you say, look to [iter] or [listfunnel], these can make it really easy to take a list and get it into another place via their indices. AFAIK there’s no way to write *chunks* or lists of data points to buffer~ all at once, it’s sample-by-sample. But you can do it really fast.

It seems like it would be really slow to do it with a text file, but it will probably be OK with [uzi]. See how many lines of data/text you have with the “query” message to [text] and you’re good to go!

Mar 9, 2012 at 11:55am

Thank you, seejayjames. This is very helpful. It looks like peek~ (or possibly jit.peek~) is the way to go. I’ll play with the other objects you mentioned, too.

Many thanks for steering me in the right direction!


You must be logged in to reply to this topic.