How to increase the range of an CSoundPatch?

I want to play a looping sound using a CSoundPatch, but the sound refuses to play if the distance is larger than roughly 2500 units. How would I increase this range?

This is my code at the moment.
[lua] self.Entity.Horn = CreateSound( self.Entity, Sound( “car/horn.wav” ) )
self.Entity.Horn:SetSoundLevel( 0.27 ) --0.27 = SNDLVL_GUNFIRE
The sound loops and I want to stop it later, so I have to use CSoundPatch. However, when the entity is too far away, the sound doesn’t play. Any ideas?


It’s undocumented, but try playing around with the SetVolume function of CSoundPatch?

Wait, are you sure 0.27 is SNDLVL_GUNFIRE? That looks horribly low to me.

Oh, I see, you used Valve’s wiki, if I remember correctly, the values in the sound level table are incorrect. SNDLVL_GUNFIRE is somewhere between SNDLVL_130dB and SNDLVL_140dB, so I guess its value should be about 135. Try that.


Also, if the entity is too far away when you start playing it, you won’t hear it even if you get closer, you have to stop it and play it again. At least according to the wiki. That’s pretty damn problematic if that’s the issue you’re having, I have no idea how to fix it.

The lower the sound level, the louder the sound (according to valve’s wiki). Though, maybe parent some kind of soundscape to the entity, and play the sound through that?