Sound effects has been notably absent in Rad Trails since its inception a few years ago. I finally took up the challenge to implement some sound effects such as engine sounds this weekend.
The approach to implementing engine sounds in Rad Trails was based on some basic principles. Most importantly I wanted find a solution using only rudimentary techniques. Instead of relying on actual audio samples, that could produce a more realistic effect, I wanted to put emphasis on Rad Trails lo-fi aesthetics.
Infact the new engine sounds in Rad Trails is so simple it’s done using only two parallel oscillators generating two different types of waveform frequencies.
The basic idea of replicating engine sound is to generate a frequency that goes from a low frequency to a rapidly higher frequency as the throttle is increased.
Up shifting gears will lower the base frequency and also decrease the rate at which the frequency increases, and vice versa.
The frequency should be aligned with the RPM of the motor. On a dirt bike the RPM will increase rapidly when applying the throttle and also decrease fast when the throttle is no longer applied.
I used a fantastic audio generation framework for iOS, called AudioKit to generate the sounds in Rad Trails.
Gear shift functions:
As you can see the RPM is also adjusted when it hits the ceiling or the floor. This creates a little bit of a humming effect.
So, there is only two states in Rad Trails. Either the throttle is applied or it’s not.
Whenever the throttle is applied I’m just increasing a variable called
rpm according to the graph above.
The basic formula looks something like this:
Setting the oscillator frequencies.
So I’m just setting the same frequency on both oscillators, the sawtooth oscillator generates a intensive sound and the sine wave oscillator helps to balance out the sound a bit and generates a more nuanced effect.
To get a little bit more variance in the effect I added a sin transformation to the frequency so that the frequency fluctuates a bit as the RPM increases.
And that is basically it. Please note that this example is filled with arbitrary and numbers and assumptions.
I’m somewhat satisfied with the result, as I think it resembles, albeit vaguely, how an engine sounds. With that said there is a lot that can be done to improve it. So please lower your expectations before playing the clip and keep in mind that one of the goals was to complete this using very basic techniques.
This is due to be released in the next version of Rad Trails that is awaiting App Store review at the time of writing. In the mean time please check out the current version of Rad Trails in the App Store 🤙
Daniel aka Crazy D