Car engine sound generation

Started by
12 comments, last by Cosmic R 18 years, 1 month ago
Hi everyone, I am wondering what's the best way to generate the sound of an engine for my car game? I can't really load and play WAVs, because then it wouldn't sound continuous. Is there any good way to dynamically generate the sound of an engine revving up?
Advertisement
i don't really know of a way, but i wanted to say (that rhymes) that a method a creating a sound of an engine on the spot has already been copyrighted (trademarked w\e). I dont know if whatever legal binds on it have expired now, but i remember seeing the notice on some game devlopement wikipedia site when i was looking for the .wav file format.
I'm sure there must be more than one way..
Hey tekmoto,
You can accomplish the desired affect with a wav file of the normal engine sound that can be looped. You loop the wav file to generate the continuous effect you are after. Then to increase/decrease RPMs, you modify the frequency with which you are playing the sound so that it matches. This will raise/lower the pitch of the sound to simulate the roar of an engine.

I implemented this exact effect in a GTA2 clone that I made, and it went off without a hitch. You can even implement a simulated gear shifting effect by dropping the frequency back down to a low value that matches the rpms whenever the car shifts.
You either use a loopable WAV and resample it to change the frequency, or generate each section of your sound via a reverse Fourier transform with the appropriate primary frequency.
I imagine you could probably render some interesting engine sounds by starting with a single 'pop' combustion sound and mix multiple channels of the same sound in varying succession for a simulated n cylinder engine. As engine speed increases, you would need to keep the combustion sound at about the same frequency throughout, probably increasing slightly, but increate the number of fires per second.

If you know anything about cars, you know you'll need to take into effect certain dynamics that change the overall sound of exhaust. For example, most 4 cylinder engines have a 4-into-1 exhaust manifold or header. The sound will be generally a pretty consistent hum. A V8 will have two banks of 4-into-1 manifolds. Depending on the car, you could have two straight-back exhaust pipes, an H-pipe connecting the two, or a Y-pipe with one exhaust pipe to the back. Each of these three sound distinctly different because they vary in pressure and sound cancellation. Mustangs have an H-pipe configuration, which is what gives it the throaty rumble.

Of course there are lots of other variables in what makes an engine sound the way it does: spark advance, compression ratio, engine volume, air/fuel ratio, forced induction, fuel injected vs. carbuerated, headers vs. manifolds, cats/no cats, exhaust pipe dimensions, etc.
As per the OP's question as to how to do it without wav's (although the replies have shown that is very feasible to do it with wav's) does anyone know how to generate sounds for use in applications like this?

I've played around with some software synthesizers, and that's what i'm really interested in. How do you produce the sound of a sine wave, or a square wave, or a triangle...etc, at an octave and whatnot?
I would say in my opinion that the legality that flounder mentions refers to a particular method of generating the car sound. As long as you devise another method, I am sure you that no one can hold you against it.

Just my opinion but do check this out for yourself.

I don't know if this would work but you could create a sine wave on the fly into a buffer and distort it somehow based on the RPM, gear and other engine parameters and just play the buffer you created

Wow, so many good ideas, I'm not sure which one to pick.

I may end up doing with the WAVs after all, it seems easier.

Anyone know where I can download a copy of a seamless looping car engine WAV?
Just a simple idea I just came up with which may work well...

If you have a car or know someone with a car you could record a few samples of the engine noise at some known RPM...

Do a recording of idle speed - record the RPM (you can keep it for your idle noise)

Rev the car to about 2000 RPM and record. Rev the car to 4000 RPM and record.

Play around with the .WAV start and end positions to work out the best looping and trim the wave to those positions

Now at a certain RPM, say 3000, you increase the sampling rate of the pre-recorded 2000 RPM sound and decrease the sampling rate of the 4000 RPM sound and play them mixed together.

You should set some damping of the amplitude of one of the samples as it approaches the other RPM (So when you reach close to 4000 RPM, the 2000 RPM sound file will be low in volume so it doesn't sound weird)

If you play around with this idea I am sure it could work for you just brilliantly.

Good luck :)

This topic is closed to new replies.

Advertisement