Observing clip's playing status in the arrangement view?

defetto's icon

Hello,

it looks like when I play an arrangement in Live, the playing status of the clips is not updated.

In fact if I look at the session view, all the clips are off even though they are actually playing in the arrangement view. (or maybe they are two different things and I don't know enough about Live's internal architecture)

My question is, is it possible to retrieve the playing status of the clips in the arrangement view (actually I need the name of the playing clip, but I already did that and it works fine when just using the session view for launching clips).

I tried to look in the Live Object Model Reference but couldn't find anything useful..

Or can you suggest a clever workaround?

Thanks a lot for your time and help!

best
Pedro

broc's icon

Clips in the arrangement are not objects that can be handled with the Live API.

defetto's icon

Damn... as I thought :(

Thanks for the reply broc

I am trying to think of a workaround for this..

What if there is a MIDI note at the very beginning of each clip?
This way when I play the arrangement the MIDI notes should be sent out each time a new clip starts, right?
Do you think it would be possible in m4l to listen to all the MIDI notes coming from the arrangement and understand from which clip the note is coming? (and therefore find out the name of the source clip?)

Or do you have other ideas?
Many many thanks

broc's icon

Yes, in theory you could have a midi note or another midi event (cc, program change) at the beginning of each clip and use a simple M4L device on each track listening to that event. If the same clips are also stored in session view on the same tracks, the event value could be used as slot index to retrieve the name from the clip.

defetto's icon

Ok, but how can I tell from which clip on the track the midi event is coming from?
The event value could be used as slot index to retrieve the name from the clip? How?
Thanks broc!

broc's icon

Well, each clip needs to have a different event, for example using CC with values from 0..127.

defetto's icon

hmm unfortunately this isn't really a solution for me, I need something automatic and not manual..

so if it's not possible to check the source clip of a midi event on a track, maybe one solution would be creating a device that automatically populates a clip with midi events according to the clip's name..or maybe according to the slot index, even though I want to be free to move clips around in my session view..

defetto's icon

..but I'm not sure it's possible to add midi events to a clip via m4l? Looking at the LOM right now, only possibility I see is a combination of select_all_notes - replace_selected_notes functions? what do you think?

broc's icon

To add midi notes to a clip, the combination is: deselect_all_notes - replace_selected_notes.

Unfortunately it works for notes only, but no other midi events.

defetto's icon

Oh you mean that when no note is selected the replace_selected_notes creates a new note? This is not clear in the LOM Reference, thanks a lot broc I will try it

defetto's icon

oops sorry it's actually written there..

deselect_all_notes     Call this before replace_selected_notes if you just want to add some notes.

thanks!

defetto's icon

Just to let you know, note creation works fine and now I'm patching a little converter that allows me to translate the unique id of the clip to a midi note (pitch+velocity, so 128x128 resolution, should be enough)

sounds like a good workaround :)

thanks again for your precious help

defetto's icon

Did that and it worked..
however I realized that if I save and close a Live set, when I reopen it the system won't work since the id of the clips are not stored..

plus the documentation says that "The id is only valid inside the device with the live.path and remains unchanged as long the object exists."..
what happen if I have two instances of the same max devices on two different tracks? will the ids be the same in the two devices? It looks so to me, but I'd like t be sure of this before I proceed further..

now I'm trying to find a way to check all the existing clips when the device is reloaded (ie on startup) and re-assign midi notes accordingly to the new ids..
possible? any hints?

thank you

broc's icon

Checking and modifying all existing clips can certainly be done by iterating over all tracks and clip slots.

But there is another serious problem: the arrangement clips are independent copies of the session clips, meaning that any changes of the session clips are not reflected automatically in the arrangement clips. So you would have to move the clips manually from session to arrangement after each restart.

I forgot to mention that there is a special case to access clips directly in arrangement view with the Live API, namely by selecting the clip and using the path 'live_set view detail_clip'. This way you can perform some operations on arrangement clips, but unfortunately the clip selection cannot be automated.

In summary it seems to me that a perfectly automated solution of your problem is not possible.

defetto's icon

Damn you're right.. well in this case there is only one option left:

at the moment I am converting the id of the clip to a midi note, problem is that the id changes everytime the device is reloaded.

I will convert the entire name of the clip to a combination of multiple midi notes, this way I will be sure that even if I close and reopen Live everything will stay the same.. correct? would like to hear your thoughts on this one

thanks for pointing out the 'live_set view detail_clip' too, didn't spot it in the LOM..not what I need in this case but can be handy in the future :)

many thanks broc

broc's icon

Yes, using the clip name in coded form (eg. ascii) is probably the best solution!

But I'm still not sure how the pseudo notes can be separated safely from real notes.

defetto's icon

Well these clips will not contain real notes..they will be used just to trigger different scenes (presets) of an external music visualization software..

So basically I use a umenu to browse the folder where all these presets are saved, select one and assign it to the selected clip..
So yeah, name looked like the best solution, but I realized that there would be a conflict if there are two presets with the same name in two different subfolders..

So I thought that the best would be to read the creation date of the preset file.. I checked the node called filedate, but it only gives the modification date which is not what I need..

I know it's a bit off topic, but do you have any idea on how to access the creation date of a file? Found this topic https://cycling74.com/forums/get-file-creation-date but it looks like mac only and I'm using windows..tried to search on maxobjects.com too..

thanks!