I really to have to say that it happens at any given time - I can be sleeping and a riff will pop into my head and I have to get up and write it down. It truly does not matter the time of day when a song gets what I refer to as: "stuck in my head".