Is it considered against standard Buddhist doctrine to meditate with music? Two slightly related questions:

Is it considered against standard Buddhist doctrine to meditate with music? In particular, "meditation music" - where it's calm, relaxing, peaceful, etc. I'm fairly new to all this; my meditation practice is hardly a year old, although getting stronger and more consistent; I don't have an overwhelming urge to meditate to music, but wondered what light could be shed on the subject from the perspective of the teachings. I am committed to undertaking this path as purely as possible, as it was laid out by the Buddha himself. But I enjoy music and find it draws me into certain mental states that could be useful to cultivate.

What should I do when the inevitable song pops up in my thoughts? This is something I've noted for years (I'm quite musically inclined)...I always seem to have some sort of tune running through my head. Now, when I sit, it becomes much more noticeable than when I'm doing something more secular...say, standing in line at the store, or performing some task at work. I suppose that the tune could become the focus of some mindfulness meditation and help develop concentration. OTOH I can see how it would be considered yet-another-thought, and one that should be avoided dwelling on (unless it happened to be the focus of the meditation). I don't know how useful it would be for insight meditation however. Is there an official stance in the teachings on this?

I hope this is not considered a useless question.
I am aware of some studies that suggest that "noise" can be an aid to concentration - i.e. people who doodle at meetings tend to be more attentive, people who chew gum in class tend to remember more, and people who listen to classical music write more fluently.  In preliminary stages of meditation, you might even find it easier to gather your mind when there is an outside stimulus.  Guided mediation is just one example of this.  That being said, all four of those activities refer to modes of thought that are distinctly different from what you are aiming at in deeper meditation.  When sitting in a Buddhist sense (i.e. for jhana meditation, vipassana, koan practice, etc.), you need to work towards developing applied and sustained thought in a way that is as free from distraction as possible i.e. "Quite secluded from sense pleasures, secluded from unwholesome states of mind..."  MN 4.  This also infers that the influence of the five hinderances needs to be limited.  It goes without saying that listening to music is fairly antithetical to that end.

Regarding your experience that you hear music more readily when sitting - that's a fairly common occurrence.  You are just becoming aware of another level of your mind that was previously obscured by grosser thought (for what it's worth, I have the same experience when I'm backpacking or doing any other activity that isn't thought-intensive).  You do need to get beyond that state, however.  As you apply concentration, you will eventually push past that boundary and into deeper, more silent layers of the mind.