Well, I'm talking specifically about bass guitar, where my best friend plays guitar with me. When he asks me to figure out how to play a song on the radio, I get to work on it, and it's a fun project. Then we end up learning how to play it together.
But it also applies to trombone in the school jazz band, when I have to make improvised solos on the spot! I really just put together pieces of things I've already heard...at least, that's how it's planned out in my head, until I start playing.