Hi, I want to change the pitch of a sound (the sound of the vehicle engine), when the speed of the vehicle increases. In which way can I do that?
If you look at the Vehicle Game sample, there is a node that has been added specifically to take care of vehicle engine sounds, blending different samples for various RPM ranges. I guess this is something that is a bit too game specific to be part of the engine as a whole but you should be able to place SoundNodeVehicleEngine.cpp/h from the vehicle game source into your own project and build that to make it available for your own use (if you’re building your own code anyway).
EDIT: I’ve just taken a look at the code for this node, you’d need more than just these two files as they also make use of AVehiclePlayerController and ABuggyPawn to get the current RPM of the vehicle that owns the sound. That makes it a bit more complicated to port into your game, I’m not sure if this is something you’ll be able to attempt. You could also attempt to build something similar in blueprints, switching which sounds are playing based on the RPM and pitch shift/mix them together.
The short answer is to use the “continuous modulator” node within a sound cue.
You will have a default (Iow) engine idle sound then pitch it up using this node, which is setup to take inputs from blueprints. Simply input a value to this based on your current speed and your sound will speed up and slow down based on movement.
Is there a way to do it in blueprints?
, it’s a good idea. Now I used the Jacky’s method (Vehicle engine sounds - Blueprint - Epic Developer Community Forums) to set the pitch based on the engine RPM. For now it works. When I have more sounds to use, maybe I’ll use your method. Anyway for the help!