Can I get the file path of the current live set using max for live?

loudon's icon

Hey everyone, I would like to create a max for live patch that makes it easy to create built-in live lessons. The first thing I need is a way to get the file path of the current live set. Is there a way? I can't seem to find anything in the Live API that can do this.

Thanks!

Loudon

Lee's icon

I don't think so, explicitly...

the only hacky thing i can think of is having a an audio clip in the set, getting the path to the clip and then getting the set path name from that...

Thomas's icon

Use this.patcher.filepath. In Max 6.1.3, this returns the path of the Live set. In Max 6.1.2, this used to return the path of your Max device. Note however that this implementation is buggy, see:

loudon's icon

Lee and Thomas, thank you for the quick replies. Thomas, I will play around with your method and see if I have the same issues. I am sorry to hear that you are having trouble with this. Honestly it seems like a pretty normal thing to want, I wonder why we need to resort to JS in the first place. Seems like the filepath should be a property of the Live set, but hey what do I know.

loudon's icon

So, I tried a couple things including the JS solution posted here. I can get the path of the max patch itself(using the thisdevice object or the JS method posted above). The Max patch is not saved within my live set. I need the filepath of the live set itself. Still on the hunt..

loudon's icon

Thomas, weird, I thought I was on the latest version of Max, but after re-reading your previous post I went in and checked and it turns out I am using an older version. I'll update to 6.1.3 and try again(hopefully it'll work!), thanks for your help!

loudon's icon

Thomas, I am getting the buggy response in the patch that you described, sometimes sending a path and sometimes sending the patcher's filename without the path. But, for me when it sends the path it is the path of the amxd file, and not the path of the live set. Strange that it would work two different ways. I am on Max 6.1.3 32 bit on a Mac.

loudon's icon

Lee, how do you go about getting the filepath to an audio file contained in a live set?

Lee's icon

you can grab the filepath of an audio clip (e.g. live_set clip_slots x y clip ) - i think the property is filepath or something like that - not at my laptop currently... the clip will have to have been created by live tho (i.e. recorded) in order for it to be in your folder structure, or you'll have had to do a collect and save first

very hacky! not really a usable solution, but can't think of anything better

as for why this isn't available... send a request to C74 - they maintain a list of requests for new attribs... i don't know how this is actioned, but at least it's recorded...

we're still trying to figure out why we can't even get the name of a set ;)

Thomas's icon

Loudon, that's interesting that you get the path of your Max Patch. I will look into it again. I am glad though that you experience the same regression regarding that it only works sometimes, therefore confirming my bug report.

Lee, I like the idea of getting the filepath of an audio clip. It's extremely hacky, yes, but it may just work well enough if used with caution, or maybe if combined in a workaround hackish solution with this.patcher.filepath.

gbravetti's icon

There should be a way to get the current live set file path :(

newtfish's icon

The reason why it might be difficult is because the liveset initially is given a temporary path, until you save it under a name e.g. "untitled1", so a new live set has a temporary path. It would be great if live forced you to give a name for your set, or if it could/would change the name of the temporary set (and all the files inside the temporary folder) to the name you have chosen.

D_Lo's icon

This device returns the *project* folder location and name. Not exactly what you want, but the solution might lead to something you need in terms of functionality. * YOU WILL NEED TO "COLLECT ALL AND SAVE" YOUR SET BEFORE THIS DEVICE FUNCTIONS PROPERLY!*

Get-Live-Set-Path-Name.amxd
amxd
loudon's icon

Naetron, thank you so much! This is perfect, you are a rock star. Will be easy to navigate to subfolders once I know the project path...

D_Lo's icon

Hey, no problem. Happy Life Day!

to_the_sun's icon

This device returns the *project* folder location and name. Not exactly what you want, but the solution might lead to something you need in terms of functionality. * YOU WILL NEED TO "COLLECT ALL AND SAVE" YOUR SET BEFORE THIS DEVICE FUNCTIONS PROPERLY!*

GET-LIVE-SET-PATH-NAME.AMXD

Wait, this doesn't return the project folder of the Live set, it returns the folder that the device is saved in. Is this really the solution you were looking for, Loudon? Is this more varying behavior because of versions? I have Max 6.1.8. I haven't tried the 1st 2 suggestions yet but I will…

D_Lo's icon

This is true, but It should return the project path once you 'collect all and save' (or manage the project file to collect this device into the "presets' folder of the project). It's definitely a workaround, but there's a lot of that that comes with the territory.

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

Ohhh, collect ALL and save. Well don't I just look foolish. For what it's worth, it turned out that was not an automatic enough solution for me after all, so I pursued Lee's suggestion instead. I needed a place to store temporary files written to disk with sfrecord~, so the paths I'm getting with his method are perfect. I automated it as much as possible and contained it in an abstraction

It's not so terribly unwieldy after all.

loudon's icon

Thanks for bringing this back to life! The fact that it requires this hackathon is a major issue, but I am digging on NAETRON's solution. Clean, and I am OK with having to collect all and save, makes sense to me. TO_THE_SUN, I am impressed with your work here, I am afraid I am a bit lost in your patch, but impressed none-the-less, If I can figure it out I will totally use it. Thank you personally, and a big thanks for all those in the future that will stumble on this thread and find two great solutions.

to_the_sun's icon

Yeah it's definitely a tangled mess in there; I just threw it together as quickly as possible. But if you put it in your device all it will do is output the path when it loads, and store it in [v ---path]. Inside what it's doing is creating a new track and scene, quickly recording a clip in it, retrieving the path, then deleting the track and scene and resetting a few other things. It does all of this in a flash of a half a second when you drop the device in, which would probably be strange and confusing to someone who is not expecting it and might require an explanation some kind if strangers are going to be using your device, but other than that it's pretty unobtrusive.

bertrandfraysse's icon

thank you very much to_the_sun for this work around.
it works great, but I don't like the file it creates, it tends to mess things up a bit.
does anyone else have another solution to this problem ?
anyway, just asking in case, but the actual solution is nice.

stephane moreau's icon

I know I'm late
For those like me who are struggling with that matter :
http://www.11olsen.de/code/category/6-max-msp-externals

bertrandfraysse's icon

this seem nice, but I don't get how to save a file in the current project folder

stephane moreau's icon

Not to the project folder
Unzip into
C:\ProgramData\Ableton\Live 11 Suite\Resources\Max\resources\externals

Or wherever your ableton and max is installed

bertrandfraysse's icon

yes I know how to install it, but what I'd like to do, is save a soundfile into the current project folder, but it doesn't work. I can share my patch test, but there should be a way.

stephane moreau's icon

I'm sorry I just don't know what you're referring to.
I was just sharing that 11something tool collection, helping me with getting the set live name and loading and new one in my case. But honestly I don't have a clue of how it works and don't see anything related with sound file in it.

Sorry dude I'm not skilled enough in max and don't see how I could help you...

enteleform's icon

There's a less hacky way to do this via a MIDI Remote Script. It's still a bit hacky as it depends on parsing Ableton's log file, but it at least doesn't require Collect All & Save or recording a temporary audio clip.

Found this Gist which I used as a starting point:
https://gist.github.com/ideoforms/7204179

I added more patterns in my implementation for detecting a few other possible states I came across:

class File_RegEx:
  New             = r"^.*info: Default App: Begin OnNew"
  Opened_From_UI  = r"^.*info: Default App: Open document"
  Opened_From_CLI = r"file:///.*als$"

In the case of File_RegEx.New, there is no path as the project hasn't been saved yet.

Seems to work pretty reliably so far, and it runs immediately when the script is loaded without the waiting period of the audio approach.

Once you have the path, you can store it on the ControlSurface instance and access it from Max via LiveAPI.get

petrus04's icon

Hi all here is a javascript version of the python log.txt solution found elsewhere.

I didn't get time to make the code very clean...
if somebody is motivated to clean it up and make it safer

all the best

pg.liveset.path.zip
application/zip 5.26 KB