View Full Version : Extracting frequencies from a wav file

03-30-2005, 11:48 AM
I didn't know where to post this but here goes.

I'm re-mixing an album for my friend using Sony's Sound Forge Audio Studio and several other tools. However I really need access to the tracks in the song and all I have is the final mix.

Is there a way to extract the separate tracks from the final mix? Also can I write something in C to extract data within a certain frequency range and if so how do I convert from sample value to actual frequency??

It would be nice too, to be able to write my own mixer and my own frequency readout displays that show me exactly what is going on in the music. But I'm not sure how to convert a value like 16500 into a 20 band frequency readout. FFT perhaps?

03-30-2005, 12:23 PM
You never do anything easy, do you? ;)

03-30-2005, 12:54 PM
It wouldn't be a challenge if I did.


03-30-2005, 01:06 PM
There's no easy way to seperate tracks from a mixed/mastered recording. All the tracks are merged and the only separation is the stereo channels. Your best bet would be professional recording software... im not really sure what sony's Sound Forge is capable of.

03-30-2005, 01:54 PM
How can I program a visual representation of the frequency ranges? Media player does this with just about everything like waves, bars, etc. But how do they do it?

I know how to do a wave - take a sample, plot it, take next sample plot it. Large sample values would mean large y displacement and vice versa. But to separate them into bars is something I don't know how to do.

EQ's do this in real time - a visual display that shows frequency ranges and db in that range.

03-30-2005, 02:01 PM
The difference between a wave and a bar is simply a matter of how many values you're displaying. If you display a bar graph with bars each a pixel wide, that'll look like a wave. Just make the bars wider and it'll look more like a bar graph. Just sample values less frequently.

03-30-2005, 02:42 PM
Fourier transforms.

03-30-2005, 04:39 PM
The difference between a wave and a bar is simply a matter of how many values you're displaying. If you display a bar graph with bars each a pixel wide, that'll look like a wave. Just make the bars wider and it'll look more like a bar graph. Just sample values less frequently.
No, they are not the same. Bar graphs show what frequencies the sound is made up of.

As has been said, fourier transform should do the trick.

04-03-2005, 09:50 AM
Bubba, techniques that could help are -

FFT's (Fast fourier transforms) and DCT (Discrete Cosine Transforms). These are quick ways of doing Fourier analysis..

Standard fourier analysis is slow, because it depends on adding series of sines + cosines. But I would suggest understanding the principle of this before moving on to FFT/DCT. I would think that a graphics guru, you would find the maths quite accessible.

Also digital filtering techniques could be useful for extracting bands of frequencies.
There is an excellent book "The Art of Digital Audio" on this. Can't remember the author.

Another idea to extract a single instrument is to look at the relative amplitude /phase of the two stereo channels. For instance,consider an instrument that is directly ahead of the listener (in the centre of the stereo "soundstage"). Assuming that the phase and amplitude for each channel for this instrument are the same, then subtracting say the left channel from the right would make this instrument dissappear from the sound. Somebody demonstrated this concept a few years ago, but I can't remember more details.

Maybe you could combine this idea with the FFT thing. The fourier equations will give you information on the phase too.

04-04-2005, 12:25 PM
goldwave and audacity can both seperate out the stereo tracks, but goldwave has some great advanced filtering features. You could try to seperate frequencies out and save them off as seperate tracks...this would be as accurate (or more) than programming it yourself, and neither method will be perfect. Good luck.

05-14-2005, 11:41 PM
ok let me say I am not a computer expert, in fact I just started learning C++ today. I can help with the audio side of things though let me explain...

It is going to be next to imposible to extract an insturment based on its frequency range. This is because all complex wave forms (all sounds not generated by math that ocour in our world) contain ALL of the frequencies, but at different amplitudes. For example: a bass guitar has much higher amplitude in the lower part of the frequency band, but also has significant amplitude(data-wise, not perceptual) as high as 10khz and higher.

EQ is not going to help here. The only things you have to work with are time( 44.1k samples per second), amplitude(volume) and frequency. and that is not enough.

05-18-2005, 10:42 AM
what you say is true, but like I said the good people at goldwave.com have already taken that into account and have come up with the best (non-commercial) filters I've seen. It is true that the instruments will have some sound coming from them in other ranges...but you must also realize that most people's ears won't pick that up (plus when recording they usually use highpass filters on instruments like the bass guitar for example to constrict it to a certain range). No matter how he tries to do this, it can't be perfect. He' trying to strip apart a mastered recording and there will always be the sound of other instruments in the background. But if filtered correctly he can make them less audible.