You don't hear any change of volume? Are you using headphones? Check condition "Advanced audio supported", maybe your browser doesn't support it.
With your first example when I set SoundOn=1 for just one enemy, it worked fine for me.
You can change volume depending on the distance to the player, something like this:
volume = lerp(-10, -100, abs(enemy.x-player.x)/1000)