3

What I am doing right now is recording audio from my mic using arecord and piping the raw output to VLC like so:

arecord -r 8000 - | vlc -vvv - 

It works great, except the audio that is coming out has a lot of noise. I know it is possible to clean up background noise using sox, but I can't seem to figure out the right commands. When I use "play" just to test output (without even attempting noise removal), the output sounds horrible using:

play -t raw -b 16 -c 1 -e signed -r 8000 -

Are there any other solutions other than sox/play? If I can do this via VLC itself, that would be ideal. I also need to amplify the sound as well, which is why I use VLC. If I can get sox to clean up the audio and the pipe the output back to VLC again, that would be amazing. How could I accomplish this, I am sure it's possible.

My goals are to (1) clean all the background noise and (2) amplify the audio as much as possible.

6
  • I don't know anything about the system you are using, but loud background noise suggests that the signal to noise ratio at the 1st stage is too small. Recording by microphone is prone to this. Can you not get a direct signal rather than use that mic?
    – Xavierjazz
    Apr 28, 2013 at 15:33
  • thanks for the response Xavierjazz, im using ubuntu linux, the hardware is a laptop and I need to be able to do this on the move without any special equipment at the moment. The laptop FAN is among the noise makers, but even when that is not running, there is still a lot of noise even in a dead quiet room. :-(
    – eagleon
    Apr 28, 2013 at 15:37
  • I should mention, the audio sounds great using VLC except for the background noise. I can hear a lot of subtle things... so if I were able to remove this static sound in the background, I would have a pretty crisp output.
    – eagleon
    Apr 28, 2013 at 15:54
  • Well, I would try try Audacity or something similar: wiki.audacityteam.org/wiki/Noise_Removal
    – Xavierjazz
    Apr 28, 2013 at 16:43
  • 1
    make your mic more directional
    – Ruskes
    Apr 28, 2013 at 16:53

1 Answer 1

4

Here is a bash script to fix up vocal audio with sox:

#!/bin/sh

# This script shows using several
# effects in combination to normalise and trim voice recordings that
# may have been recorded using different microphones, with differing
# background noise etc.

SOX=/usr/bin/sox

if [ $# -lt 2 ]; then
  echo "Usage: $0 infile outfile"
  exit 1
fi

$SOX "/tmp/tmp_audio_leveled.wav" -n trim 0 0.5  noiseprof newprofile
$SOX "/tmp/tmp_audio_leveled.wav" "$2" noisered newprofile

$SOX "$1" "/tmp/tmp_audio_leveled.wav" \
    remix - \
    highpass 100 \
    norm \
    compand 0.05,0.2 6:-54,-90,-36,-36,-24,-24,0,-12 0 -90 0.1 \
    vad -T 0.6 -p 0.2 -t 5 \
    fade 0.1 \
    reverse \
    vad -T 0.6 -p 0.2 -t 5 \
    fade 0.1 \
    reverse \
    norm -0.5

You must log in to answer this question.

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