Pitch / Bend samples in my cargame?

Hi there!

I’m deleveloping a cargame (2D seen from above driving around in a classic Amiga/C64-style) and I’d love some nice engine sounds to accompany my cars as they accelerate… Thus; Bending / Pitching in Java? How does it work? Tutorials / Examples? Hints…?

Thanx in advance!
/Markus

Use my software synth which is in the making :slight_smile:
The tone generator can play any wave form, so you could create a loop of an engine sound (or use a preset wave form of course), plonk it in a tone generator and then you can simply control the pitch by setting its frequency parameter.

If you like I can send you the current version of the lib with a little test program.

That would be nice - to see how its done;)

I’m one of those “I-need-to-understand-everything”-persons so I’d still like to read about the stuff you mentioned; Tone-generator and how and where and what and does Java offer any standard-features or do I have to make (or utilize yours) my own tone generator?

I once thought of something like using Java Sound Clip and read my wavs as a big byte []. Could I then pitch the sound by removing every 2:nd / 3:rd byte just as if I where scaling an image?

/Markus

[quote]I once thought of something like using Java Sound Clip and read my wavs as a big byte []. Could I then pitch the sound by removing every 2:nd / 3:rd byte just as if I where scaling an image?
[/quote]
Simply removing samples (in audio or images) might get close to what you want but it is “wrong”. You will get aliasing effects, unless you properly filter. Do some research on digital signal processing and I’m sure you will find how to do proper filters. This is not something that Java is suited for. The best way to do it is using the vector instructions of whatever processor you are running on (MMX/SSE/SSE2 on x86, Altivec on PPC, etc.), anything else will run MUCH slower than it should.

I too am also trying to write a car game, and I have been pondering how to get realistic engine noises as the car accelerates and brakes.

erikd, can you post your lib and tutorial somewhere so I can have a play.

Does anyone else know of a good way to simulate engine noise without having to load in wav files?

Thanks,

Andy.

http://www.movegaga.nl/80s/SoftSyn.zip

Look in the package org.modsyn.test for some examples.
The library is nowhere near finished and it’s pretty much unoptimized, but it might still be useful.
I also should remove the multithreadedness of the thing.
Time, time, there’s just too little of it ::slight_smile:

If you run TestFrame2, set the frequencies of the 2 very low but not exactly the same, set the PWM low, add some resonance, set the cut-off frequency of the filter quite low. Just fiddle with the sliders a bit and you should be able to get an engine noise without using samples.