Forums > MaxMSP

copying between buffers

October 16, 2006 | 2:07 pm

i want to be able to copy data from one buffer~ into another and I would also like to specify which section gets copied. For example I record 30 seconds of audio into buffer A but I might only want the first 10 seconds to get moved over to buffer B. I also want the transfer of data to be fairly instantanious i.e I don’t want to have to play the audio into the second buffer. I have already looked at the "mxj buf.Op" object and even though the "copyInto" command moves audio from one buffer to another it seems that you can’t specify a length. Any ideas? Many thanks… :)


October 16, 2006 | 2:34 pm


October 16, 2006 | 2:51 pm

I’m not using jitter, only max/MSP.


October 16, 2006 | 3:32 pm

Here is my quick fix using Uzi and Peek~.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 232 276 39 196617 set $1;
#P comment 70 354 119 196617 Write values to buffer B;
#P comment 313 70 59 196617 Length (ms);
#P message 183 407 43 196617 replace;
#P button 161 125 15 0;
#P newex 189 352 63 196617 peek~ buffB;
#P newex 189 305 46 196617 pak 0 0.;
#P newex 191 180 51 196617 t i i;
#P newex 565 110 31 196617 t b f;
#P newex 565 143 31 196617 + 0.;
#P message 264 407 43 196617 size $1;
#P button 396 96 15 0;
#P newex 191 219 67 196617 + 1;
#P newex 161 148 40 196617 uzi;
#P newex 191 252 64 196617 peek~ buffA;
#P flonum 264 68 48 9 0. 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 192 68 59 9 0. 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 396 121 48 196617 loadbang;
#P message 424 264 51 196617 set buffB;
#P user waveform~ 424 290 200 74 3 9;
#W mode select;
#W mouseoutput continuous;
#W unit ms;
#W grid 1000.;
#W ticks 0;
#W labels 1;
#W vlabels 0;
#W vticks 1;
#W bpm 120. 4.;
#W frgb 33 0 0;
#W brgb 60 178 173;
#W rgb2 0 95 255;
#W rgb3 0 0 0;
#W rgb4 0 0 0;
#W rgb5 190 137 255;
#W rgb6 100 100 100;
#W rgb7 100 100 100;
#P message 424 150 52 196617 set buffA;
#P user waveform~ 424 176 200 74 3 9;
#W mode select;
#W mouseoutput continuous;
#W unit ms;
#W grid 1000.;
#W ticks 0;
#W labels 1;
#W vlabels 0;
#W vticks 1;
#W bpm 120. 4.;
#W frgb 33 0 0;
#W brgb 60 178 173;
#W rgb2 0 95 255;
#W rgb3 0 0 0;
#W rgb4 0 0 0;
#W rgb5 190 137 255;
#W rgb6 100 100 100;
#W rgb7 100 100 100;
#P newex 192 100 66 196617 mstosamps~;
#P newex 264 100 66 196617 mstosamps~;
#P newex 264 435 71 196617 buffer~ buffB;
#P newex 183 435 72 196617 buffer~ buffA;
#P window linecount 2;
#P comment 101 69 86 196617 Start Position in buffer A (ms);
#P comment 109 246 82 196617 Get values from buffer A;
#P comment 76 409 100 196617 Load a short sound here first!;
#P user panel 67 395 194 73;
#X brgb 198 164 175;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 92 56 289 62;
#X brgb 205 215 224;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 1;
#P comment 214 44 169 196617 Set portion of buffer A to be copied;
#P window linecount 2;
#P comment 271 215 100 196617 Some accuracy lost to truncation….;
#P window linecount 1;
#P comment 90 126 68 196617 Click to copy;
#P fasten 10 1 20 1 325 138 196 138;
#P connect 18 0 10 0;
#P connect 18 0 23 0;
#P fasten 18 0 25 0 269 86 570 86;
#P fasten 17 0 11 0 197 90 197 90;
#P fasten 17 0 12 2 197 92 523 92;
#P lcolor 8;
#P fasten 17 0 24 0 197 92 570 92;
#P lcolor 8;
#P connect 13 0 12 0;
#P connect 15 0 14 0;
#P connect 22 0 16 0;
#P connect 23 0 9 0;
#P fasten 11 1 21 1 253 151 253 151;
#P lcolor 7;
#P connect 21 0 19 0;
#P connect 20 2 26 0;
#P connect 26 0 21 0;
#P connect 29 0 20 0;
#P connect 25 0 24 0;
#P connect 25 1 24 1;
#P connect 30 0 8 0;
#P connect 24 0 12 3;
#P fasten 16 0 15 0 401 263 429 263;
#P fasten 16 0 13 0 401 144 429 144;
#P connect 26 1 33 0;
#P lcolor 10;
#P fasten 33 0 27 0 237 298 194 298;
#P lcolor 10;
#P fasten 19 0 27 1 196 287 230 287;
#P connect 27 0 28 0;
#P window clipboard copycount 34;


October 16, 2006 | 3:54 pm

Hi Barry,

There is an external called bufcpy~ which I use a lot. I think this is
what you need. I use it in conjunction with the "max.externals" by
maximilian Marcoll

Falk
Am 16.10.2006 um 16:08 schrieb Barry Farrimond:

>
> i want to be able to copy data from one buffer~ into another and I
> would also like to specify which section gets copied. For example I
> record 30 seconds of audio into buffer A but I might only want the
> first 10 seconds to get moved over to buffer B. I also want the
> transfer of data to be fairly instantanious i.e I don’t want to have
> to play the audio into the second buffer. I have already looked at the
> "mxj buf.Op" object and even though the "copyInto" command moves audio
> from one buffer to another it seems that you can’t specify a length.
> Any ideas? Many thanks… :)
>
>


October 16, 2006 | 5:32 pm

sadly I am on an intel mac and there doesn’t seem to be a version of bufcpy~ available for this platform. Many thanks though!


October 16, 2006 | 5:46 pm

Quote: Nick Inhofe wrote on Mon, 16 October 2006 09:32
—————————————————-
> Here is my quick fix using Uzi and Peek~.
—————————————————-

Many thanks Nick I think thats sorted it!!


October 16, 2006 | 6:02 pm


October 16, 2006 | 11:50 pm

check out Fredrik Olofssons hack for mxj buf.Op. it does what you want
and is faster than the peek~/uzi method.
http://www.fredrikolofsson.com/pages/code-max.html
/m

2006-10-16 kl. 16.08 skrev Barry Farrimond:

>
> i want to be able to copy data from one buffer~ into another and I
> would also like to specify which section gets copied. For example I
> record 30 seconds of audio into buffer A but I might only want the
> first 10 seconds to get moved over to buffer B. I also want the
> transfer of data to be fairly instantanious i.e I don’t want to have
> to play the audio into the second buffer. I have already looked at the
> "mxj buf.Op" object and even though the "copyInto" command moves audio
> from one buffer to another it seems that you can’t specify a length.
> Any ideas? Many thanks… :)
>


August 31, 2013 | 3:40 pm

Belated thank you, Nick Inhofe, for the buffer copy patch.

Here’s an updated Max 6 version (probably works in 5 as well), which allows for using the mouse in the waveform window of buffer A to select the bits to be copied – in favor of dialing in number fields.

– Pasted Max Patch, click to expand. –

August 31, 2013 | 8:57 pm

this thread is really old.. but for the sake of completeness:
There is the duplicate message, followed by crop. (maybe not the most efficient in some cases but really simple and for many cases the most appropriate I think)


Viewing 11 posts - 1 through 11 (of 11 total)