Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to strip the noise from an audio source, but it needs to happen live. The resulting voice doesn't need to sound perfect, it just can't contain too much noise.

I've read up about sox, but it seems to need a profile of sorts, which would require me to pass it through sox twice.

So does anyone know how to pass an audio source through something like sox or ffmpeg live and do some basic wind/noise filtering?

share|improve this question
Whenever you talk about processing audio (live or otherwise) I always think about Gstreamer. See for example audioiirfilter (not sure if it does what you want – allquixotic Oct 28 '12 at 19:14

You can generate a noise profile for SoX with:

sox sample-input.wav --null noiseprof ~/noise.profile

You can then use the profile to filter your recording:

sox recording.wav filtered.wav noisered ~/noise.profile

This works because static noise that your microphone picks up usually depends on your setup (wiring) and is thus always about the same in the same environment. Note that SoX is considerably worse than Audacity at removing noise. :(

Additionally, you could use ffmpeg's audio filters like highpass/lowpass to diminish frequencies below/above certain threshold, or use compand filter to compress dynamic range of the recording and/or make a noise gate.

Once you have the noise profile, the complete process pipeline could be:

ffmpeg -f alsa -i hw:0,0 -af 'highpass=300, lowpass=4000' -f wav - | sox -f wav -f wav - noisered ~/noise.profile | aplay

Note, you should extract the profile from the ffmpeg-filtered recording, if you use those filters.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .