How to lower sample rate for buffer~ & record~?

conorb's icon

Hello!
I'll be recording a lot of audio from telephone style microphones, and wish to record them at 11050Hz sample rate to save space on my HD

(hmmm Ive realised that this suddenly sounds creepy. Its for an art installation I swear!)

My audio drivers only support 44.1K and up, is there anyway to lower the sample rate that buffer~ and record~ use so that the recordings have a smaller file size?

woyteg's icon

I think I'd use gen~ and poke in there to do this.
I don't know if sox supports that low samplerates, but if it does, I think it should be far easier to just record with normal settings and batch-downsample them all later.

Mark Durham's icon

Have you looked at sfrecord? I think that can go lower.. not 100% on that though.

woyteg's icon

hey very cool didn't know that, [sfrecord]-help files makes it seem possible

conorb's icon

Ahh, Im trying to stay away from sfrecord, as the final application of this will have multiple files being recorded at the same time... buffer~ + record~ handles simultaneous recording a lot better.

And as this is an automated installation that will be running for a month, I'd love for the downsampling to be done automagically.

woyteg's icon

hm, why not poke?
But also the batch-post-processing should be possible to do automatically. You can even access sox via the shell extrenal.

pdelges's icon

I'm not sure to understand: you write about buffers and file sizes, which are unrelated things.

buffer~ understands the sr message. I don't know if it will use less RAM (if that's what you're looking for) but the file you'll get if you save the buffer is smaller.
If what you want is a 11025Hz feeling, you can work in a downsampled poly~.

sleeplesswaves's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Why not something like this?

You can just add your sample rate to the menu item or throw a message in directly with your sample rate?

conorb's icon

Patrick - I completely overlooked the sr message in the buffer~ reference. After all that it was sitting in the help file.
That does the trick and thanks!

Roman Thilenius's icon

to lower the samplerate of record~ – or any other msp object– you´d wrap it into a poly~ patcher.
-110

conorb's icon

Hello again!
So I've tried out the sr message into buffer~ to lower the sample rate, and sure enough when writing the buffer to file, the output has a sample rate of the 11025 that I desire. Except its now 4 times slower, and 4 times longer which defeats the purpose of lowering the sample rate.

How can I get it to write samples that are sampled 4 times less frequently (i.e. 11025 times per second, rather than 44100 times per second) - resulting in lower quality, smaller files?

woyteg's icon

did you try the poly~ downsampling idea?

conorb's icon

A quick in - out patch within a poly~ that then has the downsample 4 argument in the master patch didn't seem to have any effect, maybe the buffer has to be within the Poly patch rather than after its output. let me try that.

woyteg's icon

only the record~ object should have to be in there, i think

conorb's icon

YES!!!!

You were bang on WOYTEG, only the record~ object has to be within the poly... it works a charm.
Thank you so much for your help.

I love this forum.

woyteg's icon