Sign in to follow this  
Ectara

Audio mixing and DSP

Recommended Posts

Ectara    3097
I'm trying to learn some digital signal processing to implement audio manipulation for my game engine. Can anyone give some tips or resources as to how I can get started with this? I've been searching for quite a while. I can read in and play out PCM sound, but what I've been trying to learn is how to determine frequency from amplitude, and how to adjust pitch given amplitude. Forgive me if these operations aren't possible.

Share this post


Link to post
Share on other sites
Madhed    4095
I give you some keywords to search for:

FFT - Fast fourier transformation
FFTW - GPL(?) FFT Library
Digital Filter theory
IIR - Infinite Impulse Response (One kind of digital filter)
FIR - Finite Impulse Response (Another class of digital filter)

There are countless resources out on the internet.
Most information on these topics, however is intended for rather experienced audiences.
So prepare yourself for some serious math...

You could start by implementing a simple FIR lowpass filter by averaging consecutive samples. This is called a moving average filter if I remember correctly.

I started looking into this area before but havent done anything lately.

Share this post


Link to post
Share on other sites
Aressera    2919
The DSP Guide is a good free resource if you're looking for in depth explanations on basic DSP operations.

A Fourier transform will transform audio from time domain to frequency domain. This operation is very useful for any sort of frequency analysis, pitch change, time stretching, etc.

Adjusting the pitch of a sound without worrying about time stretching is fairly simple. It still requires a Fourier transform (interpolation is the bane of DSP). Just do a FFT and multiply all frequencies by whatever your pitch shift factor is and then synthesize the result.

It might be a good idea to implement a reverb processor for your engine. I've implemented a Schroeder Reverberator, a fairly simple (yet sounds pretty good) design. You'll need some basic building blocks which are easy enough to make, and then a low pass filter to reduce the "metallic-ness" of the reverb.

Share this post


Link to post
Share on other sites
Ectara    3097
Thanks, Madhed and Aressera. I'll be sure to look into those. When I found the Fourier Transform a while back, I didn't think it was relevant to what I was trying to accomplish.

Share this post


Link to post
Share on other sites
Ectara    3097
After reading up on this, I still wonder how I can use it. All I have is a measurement of amplitude and a fixed sample rate. I don't know how I will be able to use a Fourier Transform with this.

Share this post


Link to post
Share on other sites
stake    158
All you need for the fft is the amplitude at a fixed sampling interval. fft won't do anything for you though. It is simply used to measure the data in the frequency domain. If you have an a complex signal not sure you will get tons out of looking at the fft. You can program it in C using gsl. But C will probably slow you down as it doesn't have integrated features for plotting and such. You really should prototype in something high level...ie matlab/octave/python. Once done prototyping implement it in C. Matlab is the standard. It isn't free but others like octave are.

Share this post


Link to post
Share on other sites
Madhed    4095
if you are programing in C you should try http://www.fftw.org/ it is a cross platform, heavily optimized Fast-Fourier-Transform Library written in C.

However, if you want to learn about the algorithms first, I also suggest doing it in some kind of prototyping environment like Matlab or the like. Here at uni we are using scilab, which is a free math evaluation environment with a built-in scripting language.

Basically, what the FFT (Fast Fourier Transform) does is taking your input signal (Amplitude versus time) and calculating its frequency spectrum (Amplitude vs. Frequency). You can mess around with this frequency spectrum and perform an inverse FFT on it and you get back an altered signal.

(This explanation is not mathematically correct in any way :) but basically this is what you will do)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this