When does Minecraft decide to start playing gameplay music?
Well, first, there are two terms you're using here that may cause confusion. Ambience is the term used to describe the "cave noises" that play when near caves. I will assume that you are talking about the gameplay music, though, so here's that.
Until recently, I thought that is was completely random, but it actually isn't. A random track is selected at sunrise, sunset, noon, and midnight, though in some cases no music at all will be selected. This chooses completely randomly between the various Minecraft in-game music tracks.
I play Minecraft all day and I've noticed that a track plays at sunset and midnight.