Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Im trying to create a car game in c sharp! Im now trying to figure out a way to get some sounds into the game! For example, the acceleration sound of the car.

I recently tried to add a 5 second-sound of a real car accelerating, but I don't think its the right way to do it. Because then i have to start from the beginning all the time of the clip when i accelerate.

Is there maybe some way to work with frequencies? To send a frequency to the speakers and then just increase it when I accelerate (And to make it sound like a car)

I've heard about PWM, could that be something?

Thanks!

share|improve this question
    
short loops should work –  Gustavo Maciel Jan 26 '12 at 20:41
    
Related: gamedev.stackexchange.com/questions/3147/… –  Noctrine Jan 26 '12 at 20:42
    
Don't forget Doppler! en.wikipedia.org/wiki/Doppler_effect –  Byte56 Jan 27 '12 at 0:38
    
Of course Doppler only applies to other cars or if viewing the race from a fixed location. –  Byte56 Jan 27 '12 at 0:46
add comment

1 Answer

This is not a simple task, most decent solutions involve writing DSP code, multiple channels and custom samples as seen in some of the thread @Noctrine linked.

If you're unfamiliar with audio programming the most simple suggestion I can make is that you try taking 2-3 channels and mixing them based on engine speed.

Channel 1..3 containing low, medium and high frequency loops and percentage of each channel playing based on how close the engine speed is to the sample.

Once that's working you can tweak that based on heavy acceleration or rapid braking.

The advantage to DSP coded solutions is that all this work is handled algorithmically with frequency shifting and filters and more dynamic effects are possible.

share|improve this answer
2  
+1 The FMOD car engine examples out there illustrate this really well: youtube.com/watch?v=jDhmVV7rTdw –  michael.bartnett Jan 27 '12 at 3:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.