We’ve fooled around with web audio synthesizers before, but never in a situation where mp3s would not also do the job. But in our recent Red Bull Racing game it really made sense to use a synth. The throttling sound is of course what it’s about. You want the speed of the car to control the pitch of the sound, so a generated sound is the way to go.
The amazingly realistic car sound is made out of 7 oscillators, three of them making sound (square, triangle and noise), and three of them acting as low frequency oscillators, modulating stuff. The last one is doing frequency modulation on oscillator 1. All this goes through four different filters plus pan and delay.
Frequency modulation can be described as changing the pitch of a sound back and forth so fast that the movement itself starts to make sound. When throttling the car affects both the pitch of the audible oscillator and the one doing the frequency modulation it starts to sound a bit interesting.
Try some FM in this jsfiddle: http://jsfiddle.net/nPD3W/
You first hear the clean sinus wave, and as you turn up FM the character of the sound changes. Turn the frequency of the LFO all the way down to get a glimse of what’s going on.
Frequency modulation is the synthesis method of the famous 80s Yamaha DX7 synth, which had 6 of these oscillators or operators modulating each other.
Our next project gotta be to reproduce the DX7 in the browser.
The game (use your phone): www.redbullracechallenge.se