Why do you modify your code as it plays? Could you simplify and abstract your expressions to call them along a predictable flow pattern? This reminds me of Knuth's beautiful representation of recurrence relations: https://en.wikipedia.org/wiki/The_Complexity_of_Songs
(Aside: His later work on Constraint Based Music Composition https://news.ycombinator.com/item?id=9512962 also offers some interesting insight as to what could come from algorithmic musical composition.)