Last active
March 11, 2022 15:07
-
-
Save mauron85/fdb1440cb7908f46898a525901c91dbc to your computer and use it in GitHub Desktop.
How to record and filter noise from mic in Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
Thanks! If someone else finds this: -f dat runs at 48kHz, so you need to change the sox command to -f 48000!