Forums > MaxMSP

recording to a buffer that resizes to the recording

October 31, 2007 | 3:07 am

I can’t figure out how to resize a buffer after recording onto it. I want to be able load different live recordings onto a buffer that resizes to the length of the recording. I’ve created a patch that shows the workflow I’m trying to get:

#P window setfont Arial 14.;
#P window linecount 1;
#P message 281 181 16 131137550 0;
#P message 161 181 16 131137550 1;
#P window setfont "Sans Serif" 9.;
#P user number~ 203 361 242 376 9 3 3 2 0. 0. 0 0. 50 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 753 104 30 196617 line~;
#P message 431 293 32 196617 reset;
#P message 702 80 27 196617 stop;
#P message 633 80 65 196617 startwindow;
#P message 753 80 72 196617 0 , 1000 1000;
#P newex 727 161 67 196617 dac~;
#P newex 753 127 64 196617 play~ recme;
#P newex 96 258 70 196617 adc~;
#P flonum 379 293 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 291 292 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 602 254 100 196617 buffer~ recme 1000;
#P newex 203 336 186 196617 record~ recme;
#B color 5;
#P comment 746 63 100 196617 • play sample back;
#P comment 641 64 69 196617 • start audio;
#P user panel 619 58 123 43;
#X brgb 255 255 255;
#X frgb 100 202 30;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P button 306 128 15 0;
#P button 111 130 15 0;
#P window setfont Arial 14.;
#P newex 306 103 75 131137550 select 120;
#P window setfont Arial 20.;
#P comment 294 75 100 131137556 X pressed;
#P window setfont Arial 14.;
#P number 218 81 35 14 0 0 160 2001 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 213 40 40 131137550 key;
#P newex 111 105 75 131137550 select 122;
#P window setfont Arial 20.;
#P comment 99 77 100 131137556 Z pressed;
#P window setfont Arial 14.;
#P window linecount 2;
#P comment 6 125 100 131137550 start recording to the buffer;
#P window linecount 3;
#P comment 390 111 176 131137550 stop recording and shrink the buffer to the length of the the recording;
#P connect 4 0 3 0;
#P connect 3 0 8 0;
#P connect 8 0 26 0;
#P connect 26 0 13 0;
#P connect 27 0 13 0;
#P fasten 23 0 13 0 436 321 208 321;
#P connect 17 1 13 0;
#P connect 17 0 13 0;
#P connect 13 0 25 0;
#P connect 4 0 5 0;
#P connect 9 0 27 0;
#P connect 15 0 13 1;
#P connect 4 0 7 0;
#P connect 7 0 9 0;
#P connect 16 0 13 2;
#P connect 18 0 19 0;
#P fasten 22 0 19 0 707 119 732 119;
#P fasten 21 0 19 0 638 119 732 119;
#P connect 20 0 24 0;
#P connect 24 0 18 0;
#P connect 18 0 19 1;
#P window clipboard copycount 28;

Any help is much appreciated.


October 31, 2007 | 10:04 am

Hello,

Here is one possible crappy but working solution, using the [waveform~] interface object

1. You know that you won’t record more than one minute (for example, please adapt to your own limit), so before recording send a [size 60000( message to the buffer

2. Start recording, then stop; calculate the time between start and stop with [timer] or such

3. In the [waveform~], select the portion from 0 ms to the time you calculated with the timer (there are inlets for selecting in [waveform~])

4. Send a [crop( message to the [waveform~]


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