Engine Sounds
#4
(Yesterday, 04:40 AM)entrana Wrote: What I found: 
I took a look in the STK source code and found that the engine audio file is pitch shifted based on speed.

Each kart is only set to one engine sound through m_engine_sfx_type which can be set to small, large, or custom. 

That one sound is then looped and manipulated based on speed.

My solution would be to make it possible to add layers like an idle, low, mid, high or a list in the kart.xml instead of reducing to one type.

My approach would be to add an idle, low, mid, high sound at a minimum that crossfade based on speed using this open source engine simulator for the recorded snapshot samples at idle, low, mid, high rpm : https://www.engine-sim.parts/ 

Potential Issues with the Approach: 
It could cause issues with multiple listeners and more complex AI engine sounds being processed simultaneously which could be too intensive.
The other AI karts could have simplified layers where as the custom kart for the player is more complex on client side - or simplified audio layers when at a certain distance from the player's position.

What happens in splitscreen with multiple listeners is its own can of worms. The game doesn't really use positional audio in that situation, and it could be improved, but it should not work any worse than it currently does.

The main concerns I see with your concept are:
- Clean transitions. With a single looped sound and manipulated based on speed, there is no issue with transitions. However if you have two different sounds you are playing simultaneously trying to fade one into the other, I could see significant issues for it to sound clean and natural.
- Audio source usage. At first glance it seems like you'd need at a minimum two audio sources per kart engine even if used smartly. The game has enough margin for it to work with standard number of karts, but it would significantly lower the limit of karts that can be used in a race before issues appears. Playing a simplified sound for karts other than the kart currently focused on or beyond some distance could limit extra resource usage, but it brings quality concerns (and at the start of a race, all karts will be close enough anyways so a distance based solution wouldn't work there, splitscreen would also be an issue here).

And of course, the old system of manipulating just one sound would still need to be supported as, even if we'd offer some default sound sets that karts could just specify to use without coming with their own custom sounds, not all karts would be updated to actually support it.

Two situations which are also poorly handled by the current system is what happens when accelerating beyond the standard max speed (with various boosts), with the engine sound not changing, and what happens when going backwards.

(Yesterday, 04:40 AM)entrana Wrote: Code Location:

From what I can tell most of these systems are handled in kart_properties.cpp and kart.cpp and the custom per-kart engine system was added by "Benau"

Feel free to give suggestions, correct me, link any documentation, or lines of code to check out!

Yes, that's where it's currently handled, kart properties to load the parameters and kart.cpp to apply the pitch. It'd probably be fine to keep doing things in kart.cpp for now, although depending on kart complexity

Please also note that this kind of changes won't be merged into the 1.x branch, so it's better to take the Evolution branch (compilation instructions here) as a basis.
Reply


Messages In This Thread
Engine Sounds - by entrana - 07-07-2026, 04:43 PM
RE: Engine Sounds - by Alayan - 07-07-2026, 07:41 PM
RE: Engine Sounds - by entrana - Yesterday, 04:40 AM
RE: Engine Sounds - by Alayan - Yesterday, 07:48 AM

Forum Jump: