recording in a buffer which size grows as the recording lasts

Mar 11, 2013 at 5:12pm

recording in a buffer which size grows as the recording lasts

Hello,

it’s all in the title.
I don’t know how to do this, and it’s a little bothering me ; the buffer~ seems too rigid with its size, especially when accessed through a record~. Can’t i, like, start a record~, let it flow, and when i want to stop it i press the stop button of the record~, well – the buffer stops to expand, and is full ? I know i can do this with sfrecord, but it’s not the same thing especially if you want to reuse on the fly your newly recorded sample.

#67003
Mar 11, 2013 at 5:18pm

sfrecord~???

#241178
Mar 11, 2013 at 5:37pm

yes, just as i said, i can do this with sfrecord, but it’s not in a buffer, it’s direct-to-disk, and the generated file is a little more complicated to access. I’ll use it if there is no other solution, but it’s not ideal.

#241179
Mar 11, 2013 at 5:48pm

unless you create a buffer~ that has enough memory to hold the max amount of time you would ever want to record… no there isn’t a way. use sfrecord~, when you stop recording use the filename to load it into buffer~ if you need it in a buffer. It’s not overly complicated.

#241180
Mar 11, 2013 at 6:34pm

Ok. Not overly complicated, yes, but…

#241181
Mar 11, 2013 at 8:21pm

Here’s a patch someone posted to the forum a while back– it trims a buffer length to the amount of time you activate recording.

– Pasted Max Patch, click to expand. –
#241182
Mar 12, 2013 at 3:24am

I’m not quie sure what you’re aiming for, but you could just use the endpoint of your record to set you max duration in a playback object:

M

– Pasted Max Patch, click to expand. –
#241183
Mar 12, 2013 at 10:11am

@antialias and @mattyo : those don’t really help, as in both case the size of the buffer is fixed before recording has started. Sure there is a lot to do after, and you can as MIB said use a buffer long enough so that you never use more than its size. Maybe an expanding, non-initially-fixed allocation of RAM at a single adress is just not possible.

#241184
Mar 12, 2013 at 4:00pm

See if the example posted in this thread satisfies you.
http://cycling74.com/forums/topic.php?id=23259
The example sets a maximum recording duration of one minute, but there’s no reason you couldn’t set a much longer time. 45 minutes of stereo audio (taking into account that Max stores the samples as 32-bit numbers) is still less than 1 GB of RAM.

MIB’s suggestion to record to disk and then load it into a buffer~ is entirely reasonable, and can be easily automated, too.

– Pasted Max Patch, click to expand. –
#241185

You must be logged in to reply to this topic.