Speed & E = great combo for writing. 3 weeks after the release of my newest album I already have 20 demos for the next one ... and according to my keyboard player they are consistently good.
For me it depends on what kind of music and instrument I'm playing.
If I'm playing metal with the guitar, I'd rather be sober.
But when I'm playing drums with my stoner/space rock band, I do enjoy being high, as we tend to do a lot of jams, and while stoned we usually come up with cool stuff.
When I state something related to science I'm coming from the stuff that they teach us in medicine, subjects like neuroanatomy and especially in physiology. Not saying bullshit that I've read in the net
Whenever an idea comes to me (most likely at some random moment one doesn't expect, as you point out) I hum/tap/sing the rhythm, lyrics or the notes on the cellphone's recording app. So, at the end of the day I can record them more properly and permanently.
Kind of awkward at first but nowadays I'm very used to do it, I've gotten the hang of it as not to get unintelligible clipping nonsense.
This!!!! I tend to come up with melodies, rhythms, and riffs while driving so my phone is always a handy way to capture an idea. I have a dashboard mount so it's always just a foot away with a shortcut for the recording app on my home screen.
All of it goes into my DropBox account and when I get home if I still find it inspirational I work on it.