tdableton - how to get the list of tracks?

I want to build a UI where a user can select an ableton track from a drop down. With tdableton, how can I query for the list of tracks? What about the list of clips?

There are two things you’ll need to know to build a UI like that… the track names and the track pointers. Because Ableton doesn’t enforce unique names (though TDAbleton tries to) the pointers are unique values used to identify tracks. The pointers exist in Ableton Live as well, but are not persistent across loads, so they’ll change every time you load your set.

The easiest way to see an example of the UI you’re describing is in the Track parameter of an abletonTrack component. .par.Track.menuLabels contains the track names and .par.Track.menuNames contains the track pointers. When you set the parameter, you have to set it to the track pointer value, but you’ll always be choosing a track name.

An example of clips can be found similarly in the abletonClipSlot component. When you pick a track, the Slot parameter menu will be filled. Because slots don’t have names, the clips are referenced by an integer index instead of a pointer.

All of this information comes from the SongInfo dictionary (reference: docs.derivative.ca/TDAbletonCom … n#SongInfo). The SongInfo dictionary is a huge compendium of just about everything in your Live Set. If you try to print it, it will take quite a while for TD to output and will seem like you have crashed, so always look at the .keys() member of dictionary items

Because the dictionary is so huge and deep, accessing it requires some long expressions. The following can be tested directly in the textport, and you can then incorporate it into your UI system using Python:

  • op.TDAbleton.SongInfo[‘tracks’].keys() : the list of track names.
  • op.TDAbleton.SongInfo[‘tracks’][][‘ptr’] : the specific track’s pointer.
  • op.TDAbleton.SongInfo[‘tracks’][][‘clipSlots’] : the array of clip slots on that track
  • op.TDAbleton.SongInfo[‘tracks’][][‘clipSlots’][<slot index][‘clip’][‘name’] : the name of the clip at that index on that track

From there you can probably figure out how to access other info you need from the SongInfo dictionary.

One last thing… reacting to SongInfo changes in real-time adds another level of complexity. If you want to be able to edit the Live Set and have your TouchDesigner UI update dynamically, I’ll write more about that in another response. Try this first to get the feel for it.

1 Like

Thanks so much Ivan, that’s exactly what I needed. For now don’t need to sync in real time so this should be good :slight_smile: