Are they environment based, or are the just random, like for example does a certain set of music play when you are near a lot of stone blocks? Or does music play because you are in a certain biome?
^^^ Unless you're in the Nether or the End (Biomes). They have their own music tracks, which are not played in the overworld. The overworld tracks are randomly played, the time doesn't matter, the location doesn't matter. It's random. Edit: Another thing that I forgot to mention. Recently, (A few days after the release of 1.7, if I remember correctly) C418 (The artist that makes the Minecraft music tracks) added a new soundtrack to Minecraft. "Minecraft - Volume Beta". It contains music tracks that only play when you are viewing the Minecraft menu (Start menu) and tracks that only play when you are on Creative mode.
They seriously should have music exclusive to biomes in the over world, that would fit to the environment and still be in c418's musical style
Music plays during sunrise/sunset. Pretty sure different tracks every time. Cave noises play when you're in or near an area where mobs spawn (Light level lower then 7)
the music is eviroment based, when you enter a cave, several sounds play, when alone and no mobs near, again some sounds play so bascily its based on what you do, its all on the code