How to enable doppler effect in GMOD?

I am creating a train and want to know if and how to enable doppler effect on the sound emitters and other things. Can anyone help?

I don’t think source engine has this. You can use the BASS library though, which has this.

You mean like red and blue shift doppler effect?

Source engine doesn’t and cannot do that in real time.

Make it spit circles, closest thing the source engine can do.

Make it alter pitch depending on relative velocity? $( Train:pos() - Player:pos() ) should do it (E2). Of course, it only works for one player unless there’s a way to only play the sound for one specific person and play a separate sound for each player.

Source cannot do this at all.

Yes it can.

http://wiki.garrysmod.com/?title=CSoundPatch provides enough functions to do this.

why would you ever use that avatar ever i should kill you for that, no one likes the MTA and all their god fucking damn delays and shit

Source actually DOES have this. To observe, place a Combine gunship/helicopter, then noclip towards it, then noclip away from it. When you’re moving towards it, the pitch of the engine sound will be higher and when you’re moving away from it, the pitch of the engine sound will be lower!

The Doppler effect would be pretty straightforward to implement with SENTs, actually.

Just do all the sounds clientside, via the clientside Entity:EmitSound or a CSoundPatch. As someone else said, you can just adjust the pitch dependent on position and velocity. The exact formulas and such for that, I don’t know.

But it is possible (and relatively painless), at least for SENTs.