Record into a buffer without knowing how long it is going to be


    Apr 04 2008 | 5:50 am
    dear Reader,
    I wonder how it is possible to record live into a buffer~ without adjusting the buffers length (like buffer~ rec 2000)... as I do not know how long the recording is going to be, and I want to make sure the buffer~ starts when I start recording and ends when I stop.
    All help appreciated, Krisztian

    • Apr 04 2008 | 12:55 pm
      Moving this thread to the MaxMSP forum.
    • Apr 04 2008 | 1:20 pm
      hi
      you can do this by using sfrecord~ and buffer~. sfrecord~ creates an aiff file on the disk load the recorded sound in the buffer as soon as you press the stop button. that's what i do in my sample recorder... works fine
      cheers
      g
    • Apr 04 2008 | 1:43 pm
      sfrecord~
      It works, thank you G.
      tEd
    • Apr 11 2008 | 10:03 am
      Hello
      Im fairly new to this, I'm trying a similar thing where I want the buffer size to be governed by the length of time the record button is depressed. I also want this to be automated so i don't have to be clicking around dialog boxes when I'm performing. Ideally I'd like the 'open' message controlling sfrecord~ to occur automatically each time I want to record a file. I cant seem to be able to make this work without having to specify a new filename each time or overwriting the previous one which Max doesn't want to do.
      Any ideas?
      thanks
      Phil
    • Apr 11 2008 | 10:37 am
      >Ideally I'd like the 'open' message controlling sfrecord~ to occur >automatically each time I want to record a file. I cant seem to be able >to make this work without having to specify a new filename each time or >overwriting the previous one which Max doesn't want to do.
      This could be automated. Have a look at Quickrecord in the Extras menu to get an idea how! Then trigger a "replace " message to the buffer~ when you stop the recording.
      /J
    • Apr 11 2008 | 11:54 am
      Thanks alot J
      That seems to work well but i still have to specify the "replace" file in the buffer`.
      I'd imagine i'd need to try and re-write the quickie so it automatically looks for the file ive just recorded. Any ideas how i might do that?
      CHEERS
      Phil
    • Apr 11 2008 | 12:26 pm
      when using buffers and grooves, what is the object used to stop clicking at random playback of the buffer?
    • Apr 11 2008 | 1:23 pm
      you could use the 'clocker' object in conjunction with buffer~
      clocker counts time since it was started; you can send this figure to the "size $1" command for buffer~'s length. so when you start the counter the buffer is being extended until you send a message to counter to stop. how you then control that live is up to you.
      it works; it just crashed my maxmsp, but my pc's a piece of tat. hope that helps.
    • Apr 11 2008 | 1:53 pm
      Thanks for that
      One question though- i cant decode your text scematics.
      How is this actually implemeted? Im struggling to get the buffer to acknowledge the value of the clocker and resize each time I cease recording.
      CHeers
    • Apr 11 2008 | 2:08 pm
      i hope this isn't coming through garbled too.
      insert clocker link it to a message with the words "size $1" link that message to the buffer object. make sure the buffer object has a default size i.e. buffer~ test 100
      now if you connect the message to start your recording, and stop respectively to clocker, or just use the on off switch, when u start recording, the clocker will start counting, sending this value to the buffer, resizeing as it goes. when u stop recording, the buffer will sotp expaning. there may be prettier ways of doin g this, but i did something similar by the sounds of it, to what your doing, and i am to understand this is the best way of getting round it. if you try to devise your own method (through maths etc) the scheduler may get in your way.....
      hope all goes well. jb
    • Apr 11 2008 | 2:19 pm
      >One question though- i cant decode your text scematics.
      >From the "WhatsNewInMaxMSP455.pdf
      "Has someone ever sent you (or posted) a patch as text you wanted to try? Previously you had to copy the text, paste it into a file, save the file, switch to Max, locate the file, and open it. Now the procedure is simpler: ? Copy the text in your e-mail program ? Switch to (or launch) Max ? Choose New from Clipboard from the File menu Voila, there's your patch in an untitled window. A window created via New from Clipboard is set as modified, so you will be reminded to save it when you close it or quit Max."
      :-) J
    • Apr 11 2008 | 2:37 pm
      THanks for your help mate unfortunately its still not working.
      I was under the impression you had to trigger a message like that to get it to work but even with a bang connected to my record button doesnt get it going.
      Im gonna upload a screen print of how its set up. maybe you could scrutinise it for me
      Thanks again
    • Apr 11 2008 | 3:18 pm
      Every time you resize buffer~ you clear it, so this approach will never work.
      Two options: - Pre-allocate a buffer to a determined maximum length, and track how much was recorded using the output of record~ - Use sfrecord~
      -- Owen
      Phil wrote: > Im gonna upload a screen print of how its set up. maybe you could > scrutinise it for me
    • Apr 11 2008 | 5:43 pm
      this is how I approached it, might helps..
      All the best,
    • Apr 11 2008 | 6:39 pm
      Interesting to see one of my patches in this play+gizmo~ I posted a package recently with this and a help file. You can find it in the forum archive. I wrote this generic version to post to the list. Funny, I hadn't put it in my own search path.
      Recording with sfrecord~ does not require advance specification of the file length but sometimes recording is interrupted.
      You can automate the buffer~ read like this...
      Info~ can tell you the length of the buffer~ after it finishes reading.
      Cheers Gary Lee Nelson Oberlin College www.timara.oberlin.edu/GaryLeeNelson
      > From: tedor > Organization: Cycling '74 > Reply-To: > Date: Fri, 11 Apr 2008 19:43:36 +0200 > To: > Subject: [maxmsp] Re: Record into a buffer without knowing how long it is > going to be > > > this is how I approached it, might helps.. > > All the best, > > max v2; > #N vpatcher 14 59 1050 800; > #P user ezdac~ 35 37 79 70 0; > #P window setfont "Sans Serif" 9.; > #N vpatcher 412 44 1068 737; > #N comlet signal end; > #P outlet 557 511 15 0; > #P window setfont "Sans Serif" 9.; > #P newex 347 39 48 196617 loadbang; > #P newex 507 78 38 196617 r vol1; > #P flonum 507 108 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P window linecount 1; > #P newex 398 411 93 196617 scale 0. 1. 0. 0.17; > #P window linecount 0; > #P newex 240 411 93 196617 scale 0. 1. 0. 0.17; > #P window linecount 1; > #P message 311 116 17 196617 1.; > #P window linecount 0; > #P message 261 118 17 196617 1.; > #P window linecount 1; > #P newex 146 74 59 196617 r bangpan1; > #P window linecount 0; > #P newex 240 25 49 196617 r evorod; > #P window linecount 1; > #P message 290 115 17 196617 0.; > #P window linecount 0; > #P message 240 118 17 196617 0.; > #P button 276 86 15 0; > #P button 240 87 15 0; > #P window linecount 1; > #P newex 240 66 46 196617 select 1; > #P toggle 240 49 15 0; > #P outlet 367 515 15 0; > #P outlet 208 516 15 0; > #P inlet 2 78 15 0; > #P newex 321 439 41 196617 * 127.; > #P user hslider 321 471 18 102 128 1 0 0; > #P newex 398 344 79 196617 scale 1. 0.; > #P flonum 398 378 35 9 0. 1.2 3 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 367 440 41 196617 *~ 0.2; > #P newex 162 440 41 196617 * 127.; > #P user hslider 162 472 17 95 128 1 0 0; > #P newex 240 247 62 196617 prepend set; > #P message 240 272 79 196617 0. , 1. 5000; > #P flonum 264 150 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 288 174 39 196617 r dur1; > #P flonum 240 172 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 240 198 58 196617 pak 0. 0. 0; > #P message 240 225 65 196617 $1 \, $2 $3; > #P newex 240 296 50 196617 line 0. 1.; > #P flonum 240 379 35 9 0. 1.2 3 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 209 439 41 196617 *~ 0.2; > #P window linecount 0; > #P comment 309 650 100 196617 Thank you Richard:); > #P comment 549 109 100 196617 Adjust volume; > #P connect 3 0 13 0; > #P connect 13 0 12 0; > #P connect 2 0 20 0; > #P connect 19 0 2 0; > #P connect 28 0 22 0; > #P connect 22 0 23 0; > #P connect 23 0 24 0; > #P connect 36 0 24 0; > #P connect 24 0 26 0; > #P connect 31 0 7 0; > #P connect 26 0 7 0; > #P lcolor 4; > #P connect 7 0 6 0; > #P connect 6 0 5 0; > #P connect 5 0 11 0; > #P connect 29 0 10 0; > #P connect 11 0 10 0; > #P connect 10 0 4 0; > #P connect 4 0 3 0; > #P connect 3 0 32 0; > #P connect 32 0 2 1; > #P connect 24 0 30 0; > #P connect 30 0 9 0; > #P connect 27 0 9 0; > #P lcolor 4; > #P connect 9 0 6 1; > #P connect 23 1 25 0; > #P connect 8 0 6 2; > #P connect 25 0 27 0; > #P connect 34 0 32 4; > #P connect 25 0 31 0; > #P connect 15 0 18 0; > #P connect 18 0 17 0; > #P connect 19 0 14 0; > #P connect 14 0 21 0; > #P connect 4 0 16 0; > #P connect 16 0 15 0; > #P connect 15 0 33 0; > #P connect 33 0 14 1; > #P connect 34 0 33 4; > #P connect 35 0 34 0; > #P fasten 4 1 37 0 285 322 562 322; > #P pop; > #P newobj 546 271 51 196617 p panning; > #P newex 546 332 51 196617 dac~; > #P message 655 247 208 196617 note 5000 0 593 0. 0.17 seq01; > #P newex 655 226 62 196617 prepend set; > #P newex 546 183 32 196617 t b l; > #P newex 546 206 145 196617 pack note 0 0 0 0. 0.25 seq01; > #P newex 546 238 104 196617 poly~ play+gizmo~ 8; > #P window linecount 2; > #P comment 720 219 100 196617 message sent to poly~; > #P user panel 540 178 328 177; > #X brgb 237 244 185; > #X frgb 0 0 0; > #X border 1; > #X rounded 13; > #X shadow 0; > #X done; > #P window linecount 1; > #P newex 220 154 40 196617 key; > #B color 5; > #P newex 220 176 52 196617 select 49; > #P newex 221 624 59 196617 s bangpan1; > #P number 268 561 74 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P message 318 455 33 196617 stop; > #P comment 290 457 24 196617 stop; > #P button 268 456 15 0; > #P newex 268 525 58 196617 clocker 10; > #B color 5; > #P number 371 126 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P button 316 79 13 0; > #P number 316 127 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #N vpatcher 539 44 1057 540; > #P button 68 25 15 0; > #P window setfont "Sans Serif" 9.; > #P newex 317 215 39 196617 s dur1; > #N comlet muliply lenght by x; > #P outlet 251 461 15 0; > #N comlet set length to; > #P inlet 251 37 15 0; > #P flonum 251 186 52 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P number 113 93 88 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P outlet 85 94 15 0; > #N comlet buffer info; > #P inlet 7 25 15 0; > #P newex 7 55 105 196617 info~ seq01; > #P connect 1 0 0 0; > #P connect 8 0 0 0; > #P connect 0 6 2 0; > #P connect 0 6 3 0; > #P connect 5 0 4 0; > #P connect 4 0 6 0; > #P connect 4 0 7 0; > #P pop 1; > #P newobj 316 103 65 196617 p seq01 info; > #P comment 398 66 34 196617 odd; > #P message 396 83 40 196617 15000; > #P message 355 83 34 196617 5000; > #P number 354 316 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P number 316 298 68 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P hidden button 240 219 15 0; > #P comment 246 244 82 196617 bang the sound; > #P comment 346 336 43 196617 volume; > #P comment 228 317 125 196617 semitones higher or lower; > #P comment 390 300 30 196617 end; > #P comment 352 280 32 196617 start; > #P flonum 392 334 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P button 220 238 19 0; > #P message 240 412 116 196617 5000 0 593 0 0.17; > #P newex 240 388 62 196617 prepend set; > #P newex 240 365 90 196617 pack 0 0 0 0 0.17; > #P number 278 279 72 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P number 240 260 74 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P comment 316 261 38 196617 lenght; > #P window setfont "Sans Serif" 14.; > #P comment 241 342 53 196622 seq01; > #P window setfont "Sans Serif" 9.; > #P comment 355 66 34 196617 even; > #P comment 278 508 92 196617 TEST THE LENGHT; > #P user panel 255 446 129 146; > #X brgb 191 191 191; > #X frgb 0 0 0; > #X border 1; > #X rounded 0; > #X shadow 0; > #X done; > #P toggle 32 210 15 0; > #P message 106 190 75 196617 read rec01.aif; > #P message 57 210 75 196617 open rec01.aif; > #P window setfont "Sans Serif" 12.; > #P comment 103 145 72 196620 SOUND 1; > #P window setfont "Sans Serif" 9.; > #P newex 64 227 29 196617 adc~; > #P newex 32 250 55 196617 sfrecord~; > #P message 30 148 41 196617 replace; > #P newex 30 189 74 196617 buffer~ seq01; > #P user panel 26 142 166 130; > #X brgb 191 191 191; > #X frgb 0 0 0; > #X border 1; > #X rounded 0; > #X shadow 0; > #X done; > #P comment 213 81 100 196617 bang to get length; > #P comment 590 417 100 196617 stops clocke; > #P hidden connect 4 0 3 0; > #P hidden connect 9 0 3 0; > #P connect 6 0 5 0; > #P connect 6 1 5 0; > #P connect 8 0 5 0; > #P connect 10 0 5 0; > #P connect 45 0 44 0; > #P fasten 30 0 21 0 359 334 205 334 205 234 225 234; > #P connect 44 0 21 0; > #P connect 21 0 43 0; > #P hidden fasten 22 0 28 0 397 354 431 354 431 197 245 197; > #P hidden fasten 29 0 28 0 321 340 214 340 214 197 245 197; > #P hidden fasten 17 0 28 0 283 340 213 340 213 196 245 196; > #P connect 37 0 16 0; > #P lcolor 7; > #P hidden connect 28 0 16 0; > #P hidden connect 16 0 18 0; > #P connect 18 0 19 0; > #P fasten 21 0 20 0 225 408 245 408; > #P connect 19 0 20 0; > #P hidden connect 17 0 18 1; > #P fasten 21 0 39 0 133 400; > #P connect 39 0 38 0; > #P fasten 41 0 38 0 323 484 273 484; > #P connect 38 0 42 0; > #P hidden connect 29 0 18 2; > #P hidden connect 30 0 18 3; > #P connect 36 0 34 0; > #P connect 34 0 35 0; > #P connect 35 0 29 0; > #P lcolor 7; > #P fasten 54 2 41 0 742 380; > #P hidden connect 22 0 18 4; > #P connect 32 0 34 1; > #P connect 31 0 34 1; > #P connect 34 1 37 0; > #P fasten 20 0 50 0 245 434 520 434 520 153 551 153; > #P connect 50 0 49 0; > #P connect 49 0 48 0; > #P connect 48 0 54 0; > #P connect 54 0 53 0; > #P connect 50 1 49 1; > #P connect 54 1 53 1; > #P connect 49 0 51 0; > #P connect 51 0 52 0; > #P pop; >
    • Apr 11 2008 | 6:50 pm
      This is better I think. Read seems to use the old buffer length while replace changes to fit the new file.
      Cheers Gary Lee Nelson Oberlin College www.timara.oberlin.edu/GaryLeeNelson
    • Apr 11 2008 | 9:55 pm
      It is also possible to resize a buffer~ on the fly by using the waveform~ object to select the appropriate part and sending it the crop command. Just make sure your buffer~ size to begin with is well above the length of the material you want to record.
      To determine the length you would still use clocker.
      Hope that helps...
      Stefan
    • Apr 11 2008 | 11:46 pm
      >This is better I think. Read seems to use the old buffer length while replace changes to fit the new file.
      This is a nice automation Gary, I am going to use it:) thank you! ted
    • Apr 11 2008 | 11:55 pm
      dear Gary,
      I wonder whether you could give me a small explanation what the difference is between the original and your expression objects in the gizmo~ patches is.
      All the best, ted