select/replace portion of midi clip programmatically?

    May 30 2010 | 3:14 pm
    If I have a midi clip that is, say, 10 measures long, is there a way to programmatically select the notes in the 4th measure in order to replace them?
    The live clip api doesn't seem to have a way to do that. It has select_all_notes, which selects everything, but doesn't take any arguments that allow you to narrow down the selection.
    What I'm trying to do is fill in the notes, measure-by-measure, ahead of time. If it's the 4th beat of a measure, I want to clear out and populate the next measure. This is straight-forward to do the first time around if the clip starts off empty. However, I'd like to be able to go back to any point within the clip.
    I've thought about adding many (many) 1 measure clips to make it possible to clear out, replace the next measure. However, that doesn't seem very practical and I'd prefer to be able to open one long clip to see what was generated over time.
    Another approach would be to simply clear out the entire clip before marching down and generating measure-by-measure. The disadvantage is that you lose the previous measures if you are focusing on a later section.
    Does anybody have any other ideas?

    • May 30 2010 | 6:04 pm
      You could try using the [text] object for saving and reloading notes.
      In particular, with [text] you can for example write all clip notes to a text file, modify it with a standard text editor and reload the clip.
    • May 30 2010 | 6:28 pm
      Interesting idea. Alas, I'm a newbie. Could you outline in a little bit more detail how to use the [text] object for this purpose? Thx.
    • May 30 2010 | 7:45 pm
      The basic idea is using [text] as "scratchpad". But I haven't really thought about the details yet. So it's left as an exercise to the reader..