To some people, the familiar sputtering sound of a motorbike engine is like music, while to others, it can be a great annoyance. To us though, synthesizing engine sound in our motorbiking adventure game Bike Trip has been a challenge.
The biggest components of engine sound is made of the exhaust pipe sound, the thump thump, and the high pitch whine of gears and chain. These sounds vary in loudness and pitch according to the driving conditions and the speed.
To recreate this sound effect in a video game like ours involves a number of steps. The first is to observe and record a real world motorbike. Since Bike Trip is a travelling game we chose to take inspiration from a popular cruising motorbike Royal Enfield Classic.
We took out our portable stereo recorder Zoom H1 and found a quiet place on the street to do the recording. Though it was not an ideal place due to general background noise, we managed to get a good recording by placing the recorder very close to the engine and setting the recorder to lowest possible input volume so it wouldn't record any background noise. We made many recordings by revving the engine to different speeds and also recorded gears and chain sounds by putting the motorbike on stand and letting the back tire run.
Looping samples and audio filtering
Next step after recording is analysing the sounds and finding looping sections so it appears that the sound is playing endlessly. Finding loops is necessary as the in-game motorbike might run at a certain speed for a long time, so a looping sample can be played as long as required. Since the sound recordings are heavy files in terms of storage we try to keep the loops as short as possible to minimise the download size of the game.
In this step we also apply audio filters to modify the characteristics and make the samples sound pleasant on phone speakers and headphones. We use the program WaveLab to cut, edit and filter the audio files.
Arrangement and variations
This is where the fun begins. After all the sound samples are ready we have to arrange them in audio tracks to play as required. In this step, we define engine parameters like speed and load which control the sound pitch and volume. An engine running at high speed but low load, like when going downhill will sound different from one going at low speed but under high load, like going uphill. This difference in sound won't be sudden but will vary in a range. That's why we need to use mathematical values to control the audio pitch and volume. We use an audio design program FMOD for this purpose.
Game integration and testing
The last step in this process is to integrate the audio parameters created in FMOD Studio with the game code. The physics simulation system in the game environment provides the speed of the object, which in this case is the motorbike. Using this speed, we can calculate acceleration and after applying some more math, we can approximate the motorbike engine speed and the load.
It can take many iterations of the above steps to achieve a convincing sounding engine in the game. The result so far can be heard in the video below. As of this article's writing, the game is in active development and the final result may change over the course of development.