Sound Proximity?

Hello!
Does anyone know if It’s possible to make it to where an enemy could be making a continuous sound, but it’s can’t be heard unless the player is within proximity of it? Where it gets louder the closer you get to it?
Oh, I did this for my own game. I think this is what I used. https://forums.rpgmakerweb.com/index.php?threads/sound-emitting-events.1714/
I haven't used the script but I saved this page. It might help you out - good luck!

Original thread: https://forums.rpgmakerweb.com/threads/sound-proximity.155276/