Set size of a buffer without erase it

Bruno Zamborlin's icon

Dear all, I'm writing a patch that use record~ object to record many times into a buffer~.
How can I set the correct size of the buffer?
If I send "size" message to buffer~, it also erases it (see patch below).

Now I'm solving writing to hardisk using static "write temp.aiff" , "size LENGTH" and "read temp.aiff 0 LENGTH" messages.
Of course it's not cheapest solution.
And peek~ / poke~ objects work even slower...

Thank you,
Bruno

Max Patch
Copy patch and select New From Clipboard in Max.


Andrew Benson's icon

If you have Jitter 1.5, you can use jit.buffer~ for this. See patch below.

Andrew B.

Max Patch
Copy patch and select New From Clipboard in Max.

Bruno Zamborlin's icon

Thank you very much. Yes, I have Jitter 1.5.

I'm trying to use your patch but when I send a message to trigger I receive the following error:
"• error: jit.buffer~: input matrix too wide"

and buffer is still resetted.

Sorry for my idiocy :-)

Bruno

Stefan Tiedje's icon

Bruno Zamborlin wrote:
> Dear all, I'm writing a patch that use record~ object to record many times into a buffer~.
> How can I set the correct size of the buffer?
> If I send "size" message to buffer~, it also erases it (see patch below).

There is a crop message to waveform~ which does this...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

goodparleyandorfing's icon

the crop message can only make it smaller though, right?
is there a way to also make the buffer longer?
(without using jitter)
sorry to hijack bruno's thread but this is something i've also thought about in the past..

Stefan Tiedje's icon

ol wrote:
> the crop message can only make it smaller though, right? is there a
> way to also make the buffer longer? (without using jitter) sorry to
> hijack bruno's thread but this is something i've also thought about
> in the past..

copy the content into a bigger buffer~. I think the crop message does
that under the hood.
In the end it depends what you want to do, you can easily just use a big
enough buffer~ and play the part you want. Or create new buffers and
play across multiple buffers... Both would be more efficient than
copying or cropping.

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

FP's icon

here's a try to record (& play) live recording.
i don't know before the length of this recording.
i don't want to initalize a huge buffer.
for that matter initialize a huge buffer does it take ram of its size ?
is there a better way to do it ?

Max Patch
Copy patch and select New From Clipboard in Max.

pdelges's icon

On 10 janv. 07, at 22:39, fp wrote:

> i don't want initalize a huge buffer.
> for that matter initialize a huge buffer does it take ram of its size ?

Buffers store 32 bits values, so a [buffer~] will take twice the space
in RAM as the size of a soundfile with a 16bits resolution.

Don't forget to delete your tmp soundfile when you quit Max.

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl
http://users.skynet.be/crfmw/max

FP's icon

thx patrick.

i suppose it's already said but i didn't find it.
how to erase a those files ?

with shell ?

thx.

pdelges's icon

On 11 janv. 07, at 12:15, fp wrote:

> thx patrick.
>
> i suppose it's already said but i didn't find it.
> how to erase a those files ?
>
> with shell ?

I recently posted on the javascript-dev list a small java source to do
that. Look for filesys in the forum. Beware, these are the only lines
of java I coded so far, I'm open to any comment.

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl
http://users.skynet.be/crfmw/max

Stefan Tiedje's icon

fp wrote:
> here's a try to record (& play) live recording.
> i don't know before the length of this recording.
> i don't want initalize a huge buffer.
> for that matter initialize a huge buffer does it take ram of its size ?
> is there a better to do it ?

I didn't test your patch, but recording to a soundfile and then loading
it into a buffer seems a good solution as long you don't need to play
while recording. I'd use the replace message to buffer~ though, which
automatically resizes...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com