Anything in our external environment can potentially affect our dreams. You've probably had dreams where you heard the phone ringing, only to wake up to hear that the phone actually is ringing. The same principle applies to music.