Skip to content

Instantly share code, notes, and snippets.

@patadejaguar
Forked from mauron85/recnoisered.sh
Created May 23, 2020 16:43
Show Gist options
  • Save patadejaguar/c9ad9afbf5f253831c196b33729da24d to your computer and use it in GitHub Desktop.
Save patadejaguar/c9ad9afbf5f253831c196b33729da24d to your computer and use it in GitHub Desktop.
How to record and filter noise from mic in Linux
# Useful links
# https://stackoverflow.com/questions/42904441/pipe-sox-play-command-to-stdout
# http://www.zoharbabin.com/how-to-do-noise-reduction-using-ffmpeg-and-sox/
# Record some noise
sox -t alsa default -b 16 -r 44100 -e signed -t wav - -t wav /tmp/noise.wav
# or alternative with arecord
arecord -f dat | sox -t wav -b 16 -r 44100 -e signed - -t wav /tmp/noise.wav
# Profile noise
sox /tmp/noise.wav -n noiseprof /tmp/noise.prof
# Play with filtered noise
arecord -f dat | sox -t wav -b 16 -r 44100 -e signed - -t wav - noisered /tmp/noise.prof 0.21 | play -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment