# Audio mixing and DSP

## Recommended Posts

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

##### Share on other sites
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

##### Share on other sites
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

##### Share on other sites
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

##### Share on other sites
Good with python? Tryout scipy. It has a lot of data manipulation techniques. If not try gsl.

#### Share this post

##### Share on other sites
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

##### Share on other sites
I've never used Python; though I've read through the scripts for concept. I program solely in C.

#### Share this post

##### Share on other sites
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

##### Share on other sites
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)

## 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

• ### Forum Statistics

• Total Topics
628338
• Total Posts
2982167

• 9
• 24
• 9
• 9
• 13