Save Only Length of Clip Recorded to Disk From Buffer

Steve Brooks's icon

Hi Guys,

I have set up a record object to record a signal from within max. I have that saving to a buffer with a large size (about 15 minutes worth just in case) when the recording stops I send a bang to the 'write' message so I can save the clip directly to disk.

At the moment when I save the clip it saves the whole length of the buffer silence after the recorded audio stops. Is there a way I can just save the length of the recorded signal?

Thanks so much for takng the time to help out!

Steve

Source Audio's icon

1 measure recording time
2 crop the buffer to that length (crop 0 $1)
3 write the file
4 set full size for new recording again (erases the buffer !)

Steve Brooks's icon

That did it thanks so much!

I've sent a message of 'size (number)' to the buffer when I start recording so it resizes it when new audio comes into it!

Cheers mate!

Steve

Source Audio's icon

If buffer is very large size, it could take a bit of time to resize it
and few samples could possibly get lost at the recording beginning.
I mean if you start recording and resize the buffer at same time...

Steve Brooks's icon

I guess in that case I could have a second buffer and link the record button to a counter which switches between buffers after recording and resizes the other buffer when one is complete. both could write the recorded signal to a waveform object!

I'm fairly new to max so I'm sure there's a more streamlined way to do this haha

Source Audio's icon

You could also copy recorded material to different buffer
resize it and write, keeping original buffer intact.
I am on the run, but will post a patch later, showing how to do it.
it is really simple

Source Audio's icon

simply replace crop 0 1000 with crop 0 $1

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

Also write file could be automated to avoid write dialogs
providing path, name and a counter

Steve Brooks's icon

This is awesome thanks so much!

the automated writing is definitely an option but I quite like the idea of it as I've used similar apps in the past and I always had the feeling that my recordings weren't saved so it's good to get a visual cue!

Cheers mate!