I practiced writing that code for about a day before I could write it flawlessly in one take. I guess, in a similar fashion to how a musician will practice using an instrument before going on stage.
The most enjoyable thing in improvisation, are sudden changes that can emerge in a good session. You typically have less than a second to react to such things. That is, less than a second to change rythm/feel, tempo, harmonics, volume, etc. More often than not all at the same time. Playing like that makes you feel part of the organism from which the music emerges, rather than a thinking actor in a rehearsed play. A feeling that I only find in dancing and other things I do with my wife.
I would really like to get into this livecoding stuff, and have tried ChuCK and SuperCollider. Clearly I never practiced enough to improvise in the live, but I'm wondering if it is at all possible in the sense I described above.