Forums > MaxMSP

Merging a selection of audio from two Buffer objects, and saving it.

March 13, 2013 | 12:59 pm

I am creating a patch which includes two features: The first allows you to load a song, select a sample up to 2 seconds long from it, then save this sample as a new file. This feature is finished and works. The second feature allows you to load two audio samples (the idea being you load in two samples you just created), and merge them together to create a new sample. The whole patch is basically a sample ripper and remixer.

It all works fine except I am struggling to find a method to merge and save the two audio files loaded into the second part of the patch. I have a good offline method of saving a selection of audio, which I have attached as well, but cant get this to work with two buffers together. I’ve tried various combinations of uzi, defer, and peek objects but none of them worked – however I probably got it wrong! If anyone could help it would be greatly appreciate. To summarise – I need a non-realtime or quick method to merge and save a selection of audio from two buffers into a single audio file.

Thanks

– Pasted Max Patch, click to expand. –

March 14, 2013 | 3:11 pm

Sorry to bump but I am really stuck on this and nobody I know can help! Any geniuses on here able to help at all? Would be greatly appreciated! Sorry the patch is so messy I havn’t tidied up the patching mode yet.

Thanks!


March 14, 2013 | 5:28 pm

Hi Meddyy !

sorry i cant check it now as im not on the applicable machinge at the moment,
im not an expert but definitely there is a way with poking things or something in this fashion ,
But the first thing that came to my mind was a [mxj buf.Op] object where you can apply many tasks for dedicated buffers , it even works with [polybuffer] .
im sorry i cant help you directly ,but i didnt want to leave you without any clue before others that might came to help .

ps:i could not open it in max 6.1 (x64) version


March 20, 2013 | 11:36 am

Hi Kris!

Thanks for your reply, I will investigate the [mxj buf.Op] and [polybuffer] objects! I wonder why max would not let you open my patch? Odd!

If anybody has any methods that would definitely work they would still be very welcome, If I manage to figure something out with the two objects Kris mentioned I feel my solution would still be very inefficient due to my rather amateur max knowledge!

Thanks!


March 20, 2013 | 4:16 pm

Hi again, I’ve played around with the [mxj buf.Op] object and found a feature called "merge buffer1 buffer2", however after setting this up I got the error message "mxj invalid buf". The buffer name was correct and the object was told to operate on a new buffer I created however no results :( I dont know if I was doing it wrong or if it was a problem between java and max but either way it was getting too complicated for me.

I did have the idea of taking a signal path from the audio-output, and implementing a real-time save feature. This feature meant choosing a file location, and then initiating the save which reset the waveform playheads back to 0, before recording for a time equal to the amount of audio selected in the waveform object. The method works about 50% of the time, other times it just crashes the patch. However the deadline for this patch is in the next few days and I really don’t have time to try and fix it so I will submit this as my final version on the deadline date.

If any kind genius’ sees this and can think of a solution to this problem, then that would be fantastic. I’ll post up my entire patch just incase.

Thanks!

– Pasted Max Patch, click to expand. –

March 20, 2013 | 4:33 pm

Here’s a quick and dirty solution.

But I think sending a "merge" command to mxj buf.Op is the easiest way!

– Pasted Max Patch, click to expand. –

March 20, 2013 | 5:46 pm

Ah thanks for the reply LSka. I can’t access Max until tomorrow now but i’ll have a look at your solution tomorrow and repost then.

Thanks!


March 21, 2013 | 2:22 pm

Hi, I took a look at your patch, unfortunately I need both buffers to be playing at the same time, not one after the other. Thanks anyway, think i’m going to submit this as it is it works fine – if you treat it correctly! :P


March 22, 2013 | 9:13 am

See if this works for you. I’m using jit.buffer to treat buffers as jitter matrices, then mixing them using jit.xfade

– Pasted Max Patch, click to expand. –

March 22, 2013 | 9:16 am

…or using peek!

– Pasted Max Patch, click to expand. –

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