Hi,
Ok, I need an audio utility (a software audio Digital Signal Processor) that will be able to load a wave file and then play back that wave file as an "instrument". (You've seen this done via musical keyboards, where someone records their voice, and then they play back that voice in real time in any pitch - (In fact, i recall watching an episode of the Cosby show in the late 80s when Stevie Wonder demonstrated this ))
The #1 effect I need is to be able to transform the wave file to any pitch (frequency) in real time with minimal CPU use. Looks like MOD players have this function internally. But they don't expose this feature to developers to use independently (ie I can't use a MOD player, since the only thing you can do with a mod player is pause/play/stop the music)
So if anyone does not know of a free DSP API, then I will need to write my own. After looking at the Internet, most effects like this can be accomplished by using a Fast Fourier Transform. I think this will be my next "utility" that I write. A software DSP would give us a lot of cool effects. For instance, recording one sound for a sound effect (ie explosion/ voice/ etc.), but then being able to play back that one sound in many different ways within seconds would be a very a powerful feature- and this is not being utilized at all in games right now.
I don't want to waste my time reinventing the wheel, if anyone knows of an alternative.
Thanks for any help,
Dana
dtaylorjr said:
The #1 effect I need is to be able to transform the wave file to any pitch (frequency) in real time with minimal CPU use.
Your fastest, least cpu-hungry option is playing back the sample (your wave file) at different speeds - One octave higher would mean double the playback speed, and a logarithmic increase for the half tone steps in between. This will, however, sound unnatural for steps larger than a full tone for most samples, and accordingly shorten sample playback time (unless it's a looped sample, of course!).
dtaylorjr said:
For instance, recording one sound for a sound effect (ie explosion/ voice/ etc.), but then being able to play back that one sound in many different ways within seconds would be a very a powerful feature- and this is not being utilized at all in games right now.
Actually, it is! Most current 3d games use a reverb effect to simulate room sound, and a doppler effect to simulate the effect you perceive when something is passing by your ears at fast speed - it's pitch seems to be higher when it's approaching you, and lower when moving away from you. Those effects are hardware-generated on today's sound cards, and you can access them via APIs such as openAL and SDL. There are other effects available on most sound cards, but the two mentioned are by far the most frequently used ones.
Thanks for the info. I knew about the 3d positional effects that today's sound cards support. But, i did not know about the ones you mentioned. I'll try everything I can to perform all the calculations necessary to change the pitch so it's a reasonable cost that can be done during game play. I don't want to use last resort mentioned (changing the play speed), since I want this to work for most samples. I plan to run this DSP (and all the OpenAL calls in a different thread than the OpenGL calls), so hopefully that will help too.
Thanks,
Dana