Forums > Max For Live

Save buffer contents with Live set or registered in Live project?

March 16, 2014 | 8:13 pm

I am writing a recording and sequencing device and would love to find a way to save the recorded audio data in my buffer~ objects along with the Ableton Live set. If this is not possible, is there a way to save the data as an audio file within the project, so that the set and project are aware of them when using the "Manage Files" dialog? I want to avoid the samples being lost when there are changes to the Live set.


March 17, 2014 | 1:31 pm

I save the buffer audio using a write message that includes the folder address. Something like,

"write" + "Macintosh HD:/Users/mikeF/Documents/Samples/MaxLoops/loop1.aiff"

Then I read it using the same address with a "read" message. The process can be somewhat automated if you use objects like "opendialog" to get the folder path, "combine" to create .aiff names, and "sprintf" to format it".

It also doesn’t hurt to have a simple "write" and "read" message attached to the buffer, to save things manually, if the above method is not working.

April 6, 2014 | 11:31 pm

I guess I should save them in the live project’s samples folder, but how to get the full path of that folder from max? And then I wonder what the correct way to save the file path in the live set is?

April 8, 2014 | 1:09 pm

This is one way to do it.

– Pasted Max Patch, click to expand. –
  • This reply was modified 11 months by  mike fonte.
April 8, 2014 | 1:32 pm

I think what I’m looking for is a way to do this automatically so it happens behind the scenes. I want to be able to record into ~buffer, save the live set, close Live, then re-open the live set and have the contents of the ~buffer objects all automatically loaded and ready to go.

April 8, 2014 | 2:01 pm

Since buffer~ is only going to store what you tell it to store (by reading and writing) there is no way I know of to do that "automatically".

April 9, 2014 | 1:00 pm

Patrickkidd, would you mind opening the patch I posted for you? Some feedback would be nice.

April 9, 2014 | 1:28 pm

I opened your patch before my first reply, and thank you for posting it.

By "automatic" or "programatic" I mean without user interaction. Your patch shows how to get a file or folder path from an interactive dialog, and then how to format the resulting output into a filename. I am looking for a way to do this *programmatically*, which means without user interaction. That would require a function from the max for live api that returns the path of the current live set file, so you can then calculate the full path of where to store the audio file.

To be perfectly clear, the goal is to save the live set from Live’s "Save" menu function and have the max patch to save the contents of the ~buffer into a file as well (probably by a some kind of save event from the live api) by calculating the path relative to the live set file’s path, and sending the ~buffer object a "write" message with the *programmatically* calculated path as an argument.

This is not a question about ~buffer as much as it is a question about the Max For Live API and how to get a string containing the full or relative path to the live set on disk *without* user interaction.

Thank you

April 9, 2014 | 2:36 pm

You are welcome, I appreciate your response!

Did you see this post about the live set path?

Also, I was looking in the LOM for a "save event" or a "savebang" and could not find anything.

If that functionality doesn’t exist, then some user interaction may be required.

March 24, 2015 | 4:38 pm

Here’s an external I put together for that purpose.

The only way I’ve found to do it saves the buffer every time the user closes the set, or deletes the plugin from the rack. Basically, it’s gonna save whether you want it to or not. But if you want it to restore the buffer, this seems to be the way to do it.

A savebang object doesn’t exist as far as I know, so for now we can get by with "freebang"

– Pasted Max Patch, click to expand. –
  1. freebangtest.amxd
March 26, 2015 | 2:53 pm

Ah interesting. I didn’t know about the freebang. All we need now is a way to accurately get the Live project or set path. I reviewed the other linked thread and it seems to be unreliable since it didn’t work for me even after collecting and saving all assets to the project.

Interesting problem.

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

Forums > Max For Live