# How to remove background noise from sound file for analysis

I'm working on a project at my university and it involves background noise recognition/classification. I'm very new to this so I'm unsure what to really search/google or where to really begin any research.

I'd like to remove background noise from any audio file and analyze THAT and not the primary signal (for example, if you had a recording of someone talking on a phone, remove their voice and keep the remaining background noise). I then wish to train a classifier to cluster or group possible sound samples.

How does one do this (extraction and preseervation of background noise)? I'm guessing I need to do a FFT on the raw data? Are there proper file formats one needs to have an audio file in to do this? Additionally, what are proper learning or classification techniques for audio recognition?

## migrated from stackoverflow.comJul 28 '14 at 14:49

This question came from our site for professional and enthusiast programmers.

• I'm actually asking about how to do this via a program and am interested in modules that might do this, but I equally am asking about the DSP portion as well. I'll migrate if this seems like the best path forward. – WildBill Jul 28 '14 at 13:47
• It seems more DSP than programming to me, since there is no language/platform specified. Once you have an algorithm then it may become a programming question. I think you'll get more "expert" DSP answers on DSP.SE too. – Paul R Jul 28 '14 at 13:50
• I'm told this needs to be migrated to DSP. I'm guessing I should try to migrate via this method (unsure how to do so otherwise) vs. creating a new question... – WildBill Jul 28 '14 at 13:50
• You can either hit the flag button above and ask a moderator to do it (may take time) or just copy and paste the question (don't forget to delete the original once it's been reposted on DSP.SE!). – Paul R Jul 28 '14 at 13:51

## 1 Answer

So you basically have a noisy speech signal and want to analyze only the noise without speech? This seems like a task for a voice activity detector (VAD). Assuming it works properly it should give you the parts of the signal containing speech and the parts of the signal containing noise. This approach is often used in speech enhancement where an estimate of the noise is required in order to suppress it from the noisy speech signal (usually the noise power spectral density or PSD is calculated). This seems to be pretty close to what you want to do apart from the speech enhancement part which you don't need. This is the way to go instead of "removing the voice" as this is more difficult. If you have access to the Digital Speech transmission book by Peter Vary, it has a nice section on VADs. You can also look at http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html - very useful toolbox for any type of audio processing.

So let's say you have the parts of the signal containing only noise. So you then want to classify it in how many classes? The most important thing for the classification is your choice of classification features - basically, how will the different noise types differ. You can have external/ambient noise as a property of the environment in which the communication is taking place but also internal noise as a property of the communication system itself. Keep in mind that competing speakers can also be considered noise, based on the application. In that case the VAD will have more problems.

So, you need to define your features and then you can extract them. Yes, you can do the FFT on raw data and calculate the PSD for example and look at the energy in certain frequency bands. This is a nice (and free) book on spectral analysis you can use as a reference: http://user.it.uu.se/~ps/SAS-new.pdf.

Anyhow, try to get started on it (people have already done similar things -google noise classification) and do it step by step. So there's no use worrying about classification when you don't know what features you'll use to distinguish between the signals.

Hope this helps