Advertisement

Car sound, pitch shift

Started by October 25, 2004 11:51 AM
4 comments, last by Sphet 20 years, 1 month ago
Hi, I'm writing a car racing game and must do the sound part. I have recordings of the low, middle and high RPM for each gear of the car (eventually cars) and I must go from one to another in a most seamlessly way as possible. First of all, How is a pitch shift done using DirectSound? Secondly, Should I play one sound at a time and when the time has come, stop the first sound and play the second? or should I blend the sounds at some point during the pitch shift? Thirdly, Is there rules I should know when working with car engine sounds? Thanks ThunderMusic_80
ThunderMusic
As for the second question: it is more realistic to blend the sounds, if transition is needed. However, don't make the cross-fade too long!

To attain a realistic engine sounds, you should observe what a real engine does and algorithmically emulate the sounds it produces [smile] More often than not, though, people just sample the sound from a real engine and be happy with that. The latter approach is certainly easier of the two.

With "pitch shift", do you mean the Doppler effect?

-Nik

EDIT: I wasn't very good at reading the original question :)

Niko Suni

Advertisement
hi, thanks for the answer.

As for the pitch shift. Would the doppler effect be the best way to pitch shift my samples to get the wanted result? Is there other methods I can use?

I know the Doppler effet will be a must have when it comes to replays when the camera follows a broadcast TV kind of path or when a car passes beside the car the user is in.

Is there a site you know where I can get information on this (implementations, etc)?

What did you not understand from the first post? maybe I can explain better...

Thanks a lot

Thundermusic_80
ThunderMusic
The Doppler effect may not work well for general pitch shifting, as it is controlled by the relative velocities between the listener and sound objects.

Have you tried to just change the playback frequency for the engine sound buffers continuously, in response to the changes to the RPM count? After all, even on a real engine, the pitch changes because the parts - which produce the sound - move faster or slower against each other. This can be replicated on a computer by moving the sound buffer slower or faster against the playback pointer!

In case you do need Doppler controls, DirectSound has very nice 3d interfaces; check the docs out (far too much stuff to tell about in a single post) :)

Quote: Original post by ThunderMusic_80
What did you not understand from the first post? maybe I can explain better...


I only thought about your problem the wrong way first, hence the edit [smile]

Do ask if you need more info.

-Nik

Niko Suni

Thank you very much, It's exactly the hint I was searching for...

Now, what would you prefer for sound effects like car engines? sound streaming from files or loading all the files in memory, then play them when needed?

Thanks
ThunderMusic
Quote: Original post by ThunderMusic_80
Thank you very much, It's exactly the hint I was searching for...

Now, what would you prefer for sound effects like car engines? sound streaming from files or loading all the files in memory, then play them when needed?

Thanks


I've implemented car engine sounds in a couple of games in the past. We've always done it using very short loops. The sound designer provides me with a number of loops, for the different gears. I then setup the loops, say five of them, to all be playing at the same time. They are constantly playing all the time. I setup a controller that lets me set the pitch for each loop, implemented by setting the playback frequency. Then I have a system that lets me control which loop is active. As I transition from one active loop to the other, I fade out the other one really quickly. On top of this I have a controller that converts the gear and RPM data of the game into the correct frequency range for the loop, and the right loop data. It takes some fiddling, but if you setup a good system, it's pretty easy to tune.

And it sounds pretty good to boot! We've sometimes introduced gear rattle loops too, so that if you car's drive train is damaged, you hear a bit of rattle mixed in, too.

Best of luck!

This topic is closed to new replies.

Advertisement