Linux下如何消录音时的除静态噪音?(Static noise in microphone recording) #
Static noise in microphone recording #
If we are getting static noise in Skype, gnome-sound-recorder, arecord, etc.’s recordings, then the sound card sample rate is incorrect. That is why there is static noise in Linux microphone recordings. To fix this, we need to set the sampling rate in /etc/pulse/daemon.conf for the sound hardware.
In addition to the guide below, since PulseAudio 11 it is possible to set avoid-resampling = yes in daemon.conf.
Determine sound cards in the system (1/5) #
This requires alsa-utils and related packages to be installed:
$ arecord --list-devices
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC888 Analog [ALC888 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: ALC888 Analog [ALC888 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
The sound card is hw:x,y where x is the card number and y is the device number. In the above example, it is hw:0,0.
Determine sampling rate of the sound card (2/5) #
We aim to find the highest sample rate supported by the hw:0,0 sound card using a trial-and-error procedure starting from a low value. When the top value is reached, we got a warning message:
arecord -f dat -r 60000 -D hw:0,0 -d 5 test.wav
"Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo
Warning: rate is not accurate (requested = 60000Hz, got = 44100Hz)
please, try the plug plugin
observe, the got = 44100Hz. This is the maximum sampling rate of our card.
Setting the sound card’s sampling rate into PulseAudio configuration (3/5) #
The default sampling rate in PulseAudio:
$ grep "default-sample-rate" /etc/pulse/daemon.conf
; default-sample-rate = 48000
48000 is disabled and needs to be changed to 44100:
# sed 's/; default-sample-rate = 48000/default-sample-rate = 44100/g' -i /etc/pulse/daemon.conf
Restart PulseAudio to apply the new settings (4/5) #
$ pulseaudio -k
$ pulseaudio --start
Finally check by recording and playing it back (5/5) #
Let us record some voice using a microphone for, say, 10 seconds. Make sure the microphone is not muted and all
$ arecord -f cd -d 10 test-mic.wav
After 10 seconds, let us play the recording…
$ aplay test-mic.wav
Now hopefully, there is no static noise in microphone recording anymore.
From #
https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Static_noise_in_microphone_recording