Engine Sounds
#1
Hello everyone!

I am new to this community and I am a sound designer/composer.

I was wondering if it's possible to replace engine sounds. 

From my understanding there is only a small, medium, large engine sound to choose from currently. 

I would love to add an add-on or mod to replace engine sounds with a more dynamic system. 

If anyone who knows more about this could point me in the direction that would be great!
Reply
#2
Hello!

In general, SuperTuxKart's sound effects are subpar because what is available under suitable licenses is limited (and not necessarily easy to find when it exists), and we currently don't have a contributor with the skills to create nicer ones. If you'd like to contribute some nicer sound effects, that could be very valuable.

SuperTuxKart already support fully custom per-kart engine and skidding sounds. You can check Pepper in game for custom skidding sounds.

As for engine sounds there are multiple addons making use of this capability, specifying it in the kart.xml file and shipping with the relevant .ogg file. For example:

Code:
    <sounds engine="custom" file="bus.ogg" rolloff="0.3" max_dist="200" volume="1.1"/>
Reply
#3
First off, thanks for the quick and clear response!

I was able to easily drop in an .ogg with the line of code you provided and test it out. 

Quick disclaimer:
I am newer to the audio programming side of things but I am currently in a program which is helping me develop programming language skills. I am currently looking for projects like this to strengthen my skills and include in my portfolio. However, it may not be within my current capabilities.
Here's what I think is going on with the subpar quality of the engine sounds but I'm not 100% certain on all of the specifics.


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.

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!
Reply
#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


Forum Jump: