Inserting Data into buffer~ at Signal Rate
Hi all! I'm gathering some data from an accelerometer via Arduino, sending it to Max via OSC, and trying to insert it into a buffer~ in real time so that I can continuously play back the waveform that the accelerometer produces. The problem is that no matter how fast I can produce data--even using not Arduino but a random number generator banged by a phasor~ that then gets inserted into the buffer~ via peek~--I can't fill the buffer~ fast enough to continuously have a stream of audio going. It usually fetches and consumes about 12 or 13 samples before it's already time to fetch new material (which somehow doesn't exist yet, so it can't be used to fill the buffer).
Is there any way to produce/route data fast enough to keep the buffer~ playing continuously in real time? I think the biggest challenge here is converting data-rate values into signal-rate audio when there's not enough data to match the demand. Thanks!
Try to convert your data to signal rate with [sig~] and use [poke~] or [record~] instead of [peek~].
Thank you! Gave that a shot. But sadly still couldn't get the speed I need. I may still be doing something wrong. I'm attaching the patch here. Thoughts on how to fix it?
You should use "copy compressed" to send patches.
Here is an exemple using record~/play~ quick and dirty, it may gives you some ideas…
Thank you! I still don't think this is quite doing what I need it to, though. I was hoping to fill one buffer, play it, and while it's playing, fill another fast enough to have more data ready by the time the first buffer is done playing. Here, there seems to be a continuous stream of data, but resetting would take too long before the next data is captured and played back.