How to get a list of all tracks in the set
As a first step to building a device I decided to try and get Live to cough up a track list. So I created a patch like this:
----------begin_max5_patcher---------- 504.3ocyVEsbiBBE8Y8qfgmylAPwzrus6uwNc5fJMgtJjQHsosS+2W7p1lra bhIl3rOHLdAky4v4dg2CCvolcRKF8czuPAAuGFD.gpCDz9d.tTrKqPXgog0x WLoOgm0LjStyAg2TozttnOZzNq5MY8HTxbRaX81RyVWgzA+otnaDtr0J8pGp jYtFjvWj3+HTLE5hhpao2MmfteuEPKJgE.+iJkn.8SSQd25qxgA737azD7Wq tR2s3z5XeDFV2LafLuTZshUx+g5qjNk9QyYQdZazlPtW2HaXNF+IGOhtDGeG HHLnKNFzkjKSWhOptvt.coGGgCkhJNKQg0mnjJzqvyNg3vi.2BKItQilyubS C6pYZ5QbJTOKm6GnF82deCuwvD03X3KGS9D8p4a5KexSf0nZA5AqzgbUhrea mhjqkf+gRZRqHQiI6hb0TozsNmQiOOhBILCfrLfqLRW6mexdbYwMu.pJGw3S vNbR24IPGmLhMX9st5ITf3fLgyRfh5Ufl09LD2AAJarjNh5EQmz8.+TOe0+8 8P.fUG+P0yZ1Vk0QmtRRnuvVtz5OOV3T9rl8lTxASZsJOWp2+ZHkp7MF+cXZ AA59itWNXLEODLQmVL4OUCQOAl3GLm+KfDHSSGlhFBjXS6NGY.tonIERKFh+ lLBH4e4iv+.Zjht2 -----------end_max5_patcher-----------
What I expected was a consistent ID and an object containing children representing the tracks in my set. What I actually observe is a different ID each time I set the path and the following output:
print: info type tuple
print: info description tuple() -> an empty tuple tuple(sequence) -> tuple initialized from sequence’s items If the argument is a tuple, the return value is the same object.
If I extend the path to a specific track, e.g. track 0, then I get the expected track information.
Can anyone tell me what I am doing wrong in attempting to enumerating the tracks in the set?
First; it helps to have the trigger object’s bang output connected to the message object ;-)
ID’s aren’t static, only paths are. The moment something is changed within the liveset (devices or tracks added/(re)moved) then you risk the id’s from changing. Also see the Live API reference for info on this.
Another detail which I’d suggest avoiding is using the live.path object with a parameter and sending it a message afterwards. This can influence the id assignment quite drastically as well.
In short: loaded with an argument live.path will assign and send out an id the very moment the patch gets loaded ("started"). So; in your case it’ll start asking ‘getinfo’ from the Song class (‘live_set’) and assign it with an id, most likely id 1.
Next you click the button and you focus your attention to tracks (a child of the Song class). Thus it gets id 2.
So far the theory…
Asking that child for information gets you no where (as you’ve noticed yourself) since its basically (quote) "An empty tuple".
"getinfo" is a function (message) specific for a live.object and is only used to get information about the current object (see here).
Edit: You’d want to use getinfo to learn more about a certain object. For example, to know what its children are, what properties it has and what functions it supports. But all of that is specific for live.object, and not what you want.
You don’t want to know what ‘live_set tracks’ is (an empty tuplet), you want to know what it represents (‘contains’).
Back to the LOM (the link above). If you look closely at the Song class again you’ll see that you can get or observe tracks. That is the right approach to get to know what it contains.
----------begin_max5_patcher---------- 487.3ocwVtsTCBCDF9ZbFeGxjqqcHI8.3c5qgiiS.hsQgPGRpV0w2cSVJ8f1 HTsJW.6L6tP92urKg2N+r.bR4JgFitDcCJH3Mqm.vmySPii.bAeUZNWCIhUh mKSd.OXcLiXkA7unRpLabqVVTtzjKLvCE13VlA4ZeAWPlrI46KUFs7UgKFIb 3lrWvMoykpY2UIRM0pjQlZiinwSbFFycmDMLDc6NqrT0rvjcWBEu.VB7UURd N55x7LLD98yOyYslAcFCEBslOS7UNLSXPlJd5iZOvfbHXLZSx0YZdYgnthw3 s01Q.JZTL.JFvqwQ.nl3ETz+LP4qewfRP4dPD8PHh5GQIb0L7feJpXrQ.chA CiNbbO0S4CU4xmDCsQbJ9H5oHm5dplguogPOUbKCez++gOqnmib35Ns3nXU3 Ie9KtdjiAenZJo2l+RVZLkpifErVly1VAGrrgVDRHLKQCat6aV5uYVw0F3oh YGnhi9lM+Aqu9UMAS.yXxI9zp5WisjUe4PbPLt.ehg5xkUoMEWSmOZGAkIzF ohaj1dlsYEseRykYYB0dmrWHyVTZ+Cf0BAcq+c1NqM2pRZSZtyE5As495Z6b y8SN8g3F0IwQ5GwQ6z1JY+r9mDGqSfKr+.W6hazuVbNGVyG.ACKqwB -----------end_max5_patcher-----------
And as a bonus (nah, kidding a bit) here’s the same patch but this time making it a little easier to grok the output you got from it:
----------begin_max5_patcher---------- 892.3oc0XssbaBCD8YmYx+vN7RZmwwCR.Fnouz9Kz9VSlLXP1Vs.xCRNWm9u WoEiiiicL3KA5CHMypaGczYWshmO+rdViDOvjVvWfeA858r1ROzlwRuJC8rx hdHNMRhczJmcuXzus5unME6AEZeVAOWAphn3+badTFaYOxmmIlqRYJb71Ul4 I3vzy0kNjkcdrHWI4OwLsQrGrr2yhTwS44StsfEqJALkLT2N3DhUgDSIIXfM byJqLOuZgIqtDH.MK+2J3Qov2EoIVXy+87yL05p9GLi7TJHS4wLfrEtftItv dYmK6o5wYrxMrkUe82KauFwUdHWMDq7n6fqne3bUJ+N1.cKFDuYxhrAxhF9N j0AQTNgHQE1ZDUFSJilvdKSMgof2w+ZizTvwllHgNHMYi9ddtHMMrComTvHH sAtcTmsSQihxmb.tdN9F1g5aiLFcfWGKL0pAt4IxFD2ltewsK0NzgAlJ+vVK tcrHKikqdKi70KAcrathUbEVFoXf3NVAnlx.VJyLJIHFCQPJWpfOImwUvEYf lu.QNCF8no5yCfepGvEzKfDVtPwj5IHRomRPNULOMAvwYFD8koU2gHPwyXCV BrTdNKVLOGQmWCNer2myGmxiD5hfedntcnamSwNqfcId+ZCTrjf8RwFfg4n1 38l99cUEKxFWAErLsZEEqi4ERifikAiKDYnMijc..+P.Wagd8RfmnUf5Buqs f64oovzH8DT0r1X4TlrEIoaCN.7O.IIIzaEIoIKltTtdlHE.sA24P7NIo5s3 9FGLgXWuNWpd6UZwDmSCW4U5X61xoE+tY6U5E1f78HtG8zhsKC54hUdA+2mu Ggdxx2agLpTS0Ay2a+dpEgbz0TNKhMY2UepkFzSACccqj0Htx93+rTLCDWrz mzZteilqTh7FPE65YUurC19iwItkAoqJ2lmzowSwHB1xF1YCa3fcbOU+CTB3 iwd8N1+sqxoASqa8+GHhESCqQgRw7h3p8VUHBXE.kvjJddjhqULqzqfW2qo7 D8qidU9hY7jYBcJ9KPBby1OYqM3L+WMfrKv4PZEvY9OV6l4vsPK.tf5.t02B eTfyoNGqH3HsC31My0NNDlWeTCv4zkAW63sRpkla8svGE3pWP3V5X0tNfqc7 GBp0gJsc3M2Zcn1RtCzZwbjVIDbsh.SraOha2fy8fAmwft5eHMpsO. -----------end_max5_patcher-----------
I think this may give you a good head start…
Hi there ShelLuser.
Many thanks for the lengthy reply, I do think you’ve addressed my main confusion. I’m still getting my sea legs with Max generally and with the LOM in particular. I’d obviously misunderstood the purpose of getinfo and was further confused by the fact that a path of "live_set tracks 0" seemed to return what I would have expected for a track, but "live_set tracks" did not.
I’ve also downloaded your(?) LOMnavigator device to try and understand the LOM better. As an aside, if it is yours, the archives on your site didn’t work for me (they unpack to 0 length files on my Mac) but the device on maxforlive.com does work (albeit it seems an older version).
Oh just as a further note, re-reading a part of your answer and thinking about my own thought processes.
What confused me is that the way that tracks is
basically (quote) "An empty tuple"
I guess what we are talking about here is the the metadata for the tracks object, i.e. there isn’t any. Since I think I’d seen children in the info for other objects I’d assumed what I was looking at was an empty trackset which was nonsensical.
I’m also bound to say that I think the guys who came up with parts of the Live API should have thought a bit harder. When you "get tracks" why return "tracks id 2 id 5 id …" instead of an array (2,5,…). Lots of this API just seems like it was designed to create busy work. But I digress. It’s possible and that’s the main thing.
Thanks again for your examples.
Forums > Max For Live