Something similar that may help you is the [TF2] Dispenser Music plugin by redjazz96:
https://forums.alliedmods.net/showthread.php?p=1982288
What it does: When a dispenser is built in TF2 music plays from a song list. The sound originates from the dispenser. If you walk away from the dispenser the sound becomes softer. If you walk towards the dispenser the sound becomes louder. If you don't like the song that is playing simply move the dispenser and it will play a new song. When the song finishes it will play a new random song from the song list. Players can toggle the sounds on or off.
The code in that TF2 plugin might be edited to work the way you want with CSGO.