How do you begin a piece of music? That's a question I'm often asked. The answer I usually give is that you begin as soon as you start playing - that is, if you're trying to "compose" something, the piece begins the moment it has energy and is something you want to capture. If it's an improvisation, the piece begins the moment you set your fingers on the keys and hit the first note. It's like free flow writing and writing a chapter to a novel.
The writer can both improvise and enjoy the process or can structure the ideas more - or, as I like to do, combine both procedures into one. I start out by improvising - always. Then, if I want to memorialize a musical idea, I write down the first two bars of melody along with the chord(s) I'm playing. I throw this on a chart and voila - the idea remains fresh until I want to either expand on it, or ignore it completely.