You can also try a SMC reset:
Follow directions for a battery you should not remove yourself.
Try going to applications/utilities/Audio MIDI Set up.app make sure Format is set to 44100.0hz and 2ch 32 bit.
If it is still doing it, there may be a hardware issue, you can take it to an Aplle store Genius bar (make an appointment) and they will diagnose it for free, and then tell you your options. (maybe you have a failing sound card)
Also try with a different set of phones.
Sorry, I forgot what system your were using.
It should default to 2ch-24 Integer, try switching that value, see what you have, then try switching back, try them all.
This happens with a different set of phones as well?
You can also try another pram reset, except let it chime 3 times (really flush it out)
After trying this, it may be a hardware issue, and you should take it in to Apple.
Try this and get back, I am going to check thru some system stuff, that take me a bit.
AHH, if the in ears make the noise and the Sony's don't, leads me to 2 possible conclusions.
There is something about the in ears that the Mac does not like, (impedance, reactive load, capacitance) or the cable on the in ears is not shielded well, or has a break in the shield or some other inadaquancy in the the shield scheme.
Being that only the in ears have this issue would lead me to think that it is not a problem with the Mac. You should try to borrow another set of phones/buds to confirm this.
Also one other thing I forgot to ask, do you have any USB devices connected? They may be the source of the noise, either from the cables they are connected with, the device it self, or some strange combination of those 2 things.
Let me know
OK, see if you can get another set of buds to try. This would certainly help to narrow down the search for a solution.
You can still take it to Apple (make an appointment) the Genius bars are usually very busy and just walking in you may be there forever.
But I would still try a second set of buds (preferably) a different brand/model.
Then the pods that you have seem not to electrically match with your Mac, as the others that you tried seemed ok, am I right in this understanding?
On the iPhone it has a very unique plug configuration that seems to set specifically for the iPhone, because it is a 4 conductor connector (one is for the microphone) that may make other pods not work properly. (yes this is an Apple thing, AAAAARRRRGGGG!!!!)
But that would then confirm that there is not anything wrong with your Mac, as those Apple pods are for the iPhone, I guess both good and bad news.
I don't use my iPhone to listen to music, nor do I use pods either, unless the artist I am working with is, then I use the same make and model so I can "hear what they hear".
I do pro audio for a living and I can understand this "crosstalk issue with the 4th connector"
But without getting too technical, it would seem your Mac is just fine, which is a good thing.
I would think that the newer Macs will be more compatible with the Apple iPhone pods, but they all seem to have their issues with the switching system...for years now!
Hope this helps you understand this "FRUIT FLY"
My suggestion is to use "regular headphones/ear pods with your Mac and the Apple iPhone pods with the phone. )I only have ever used the iPhone pods with the iPhone when I'm driving, and with only the iPhone. I have much better sounding pods/phones that I use to "ACTUALLY' listen to music with....and it a'int MP3/4