Return to Level1Techs.com

[solved] Need help with microphone crackling sound[linux]

I have the following issue. My Mic (Logitech G430) has in most application (teamspeak, discord) I use a crackling familiar to unmatched sample rate. Oddly audacity don’t have the problem.
I tried this guide from the arch wiki, but it didn’t resolve the issue. The mic loop back also result in no distorted sound.
here a sample using arecord -f dat -D hw:2,0 -d 5 test.mp4

and this using audacity (sound quality degraded using vlc to pack it into a mp4)

The crackling gets amplified using teamspeak/discord to a point I don’t like to use the application with friends

pastebin links:
My /etc/pulse/daemon.conf
My /etc/pulse/default.pa

System Specs:
r7 1700X
X470 Aorus Utra Gaming using ALC1220 sound chip
arcord --list-devices
–>
**** Liste der Hardware-Geräte (CAPTURE) ****
Karte 1: Headset [Logitech G430 Gaming Headset], Gerät 0: USB Audio [USB Audio]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 2: Generic [HD-Audio Generic], Gerät 0: ALC1220 Analog [ALC1220 Analog]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 2: Generic [HD-Audio Generic], Gerät 2: ALC1220 Alt Analog [ALC1220 Alt Analog]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 3: C170 [Webcam C170], Gerät 0: USB Audio [USB Audio]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0

Note:
card 1:0: sound card is for windows vm sound loop back and pulse has no access via udev rules
card 2:0: The behavior is explained in this thread
card 2:2: don’t record any sound at all
card 3:0 has no crackling but poor mic-quality

I appreciate any help on this subject.

oh and I use pulseaudio with alsa on a ubuntu 18.04.1 LTS build, kernel version: 4.20.0-042000-generic

I know Discord has a problem with too much bit-depth and sampling rate that can be worked arround by increasing buffer size.

I see you have 2 changes in /etc/default.pa

module-udev-detect use_ucm=0 tsched=0

using ‘tsched=0’ is a known method to fix crackling sound for onboard audio devices
but it isn’t effective unless other settings are configured in /etc/daemon.conf

with timer-scheduling disabled, also usually need to uncomment and adjust two settings ‘default-fragments’ and ‘default-fragment-size’
and set audio buffer size for best performance of audio devices

uncommenting other settings for sample format and sample rates may also help

options ‘use ucm=0’ OR ‘tsched=0’ could be making audio worse rather than better for usb headset

1 Like

where do I do that?
I also have crackling sound but basically only in Discord, Skype has good sound for me.

Should be Start > Control Panel > Hardware and Sound > Sound.
Then rightclick the mic and go to properties. Should be in there.

I was thinking Linux since OP was talking Linux :smiley:

Thanks for your help.
I feel a bit dumb, I just now realized that most of my changes didn’t apply because ; also comments a line. :woozy_face:
Netherless

I don’t have a USB Headset, instead I connect the Headset via AUX on the mainboard and use the USB sound card for my VM, the host shouldn’t touch it.

how do I do that?

didn’t resolve the crackling, I tried various combination 4+10 up to 8+100 sometimes making things worse and over +80 teamspeak crashes

see this from Arch wiki:
https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Setting_the_default_fragment_number_and_buffer_size_in_PulseAudio

may be more information on that page that may help resolve audio problems

1 Like

thanks for the link.

device.buffering.buffer_size = "19200"
device.buffering.fragment_size = "3840"
witch seems really low compared to the article.
I calculated 19200/3840 = 5 --> default-fragments and
3840/( 48000*16 (bit depth) *2 (channels) )= 2,5 ms

setting these 5+2 or 5+3 didn’t make any change
and only one channel: 5+5 with default-sample-channels = 1 neither did a change.

However in removing use_ucm=0 it makes the crackles less loud but don’t makes them go away

I got the best result with
load-module module-udev-detect tsched=0
and default fragments

If the crackles are only reduced increase the default-fragment-size
don’t usually want to go more than default value of 25ms because there are problems with audio latency

may also help to try s24le bit depth

1 Like

I’ll try it later the day and come back to you

so, I tested a bunch of stuffs.
my new /etc/pulse/daemon.conf
anyway increasing frag-size don’t seem to change anything, so I was wondering why audacity works.
And it does because of the use of alsa and directly using the hardware 2:0. Switching to pulse it has the same issues.
Teamspeak also works fine as soon as I switched it to alsa and the hardware 2:0. Now the question is how to do this for discord or even better system wide? And I’ve found nothing so far

if discord can support ALSA playback should be able to select the ALSA devices in discord for playback and capture

some packages require Pulseaudio so may not be possible to avoid using it entirely

So I think my problem is related to this one https://bugzilla.kernel.org/show_bug.cgi?id=195303 as specially because I can reproduce Comment 28 with all settings returned to default (both default.pa and daemon.conf)

SO in short there is no sufficient workaround without buying a soundcard or hoping for a fix in the future

comment 28, and many of the other comments on that bugzilla report, do not relate to the ALSA codec and motherboard problem

Bugzilla report is only needed for a confirmed ALSA problem:

  • run alsa-info.sh to get the required information
  • post a comment for specific hardware if a matching bugzilla report is already there;
  • Make a fresh bug report only if there is no report for same hardware
  • hope it doesn’t get spammed like linked report and kernel gets a patch

If a clean recording is possible using ALSA but not with Pulseaudio, is likely a Pulseaudio problem

webcam is also available as capture device. if that has same audio problem as the Realtek codec/hda driver is not likely to be something that can be worked around by another audio device.

firstly thanks for your time and affort you put into this topic. I appreciate that very much.

The webcam doesn’t suffer from any crackling whatsoever in no application tested so far. The sound in general for this device is just crappy, but thats for windows too, so expected behavior :smile:.

It’s just like I tested pretty heavily with various settings in pulseaudio without any success this far. And I think I’m better off buying a compatible sound card. I look around and maybe start a new thread for additionally advice. At worst case, I’ll return it and live with bad mic-sound.

if webcam audio capture is clean, should be no problem with another usb device for microphone
even a cheap usb device is likely to have lower noise floor than an internal device

if onboard audio is ok for playback having another playback device isn’t essential.
maybe a USB microphone?

honestly when I switching from my old mainboard (ASRock Fatility X990, if I remember correctly) to the new mainboard was like day and night. The noise floor is not hearable, the sound is balanced and clear. From that side a usb mic might be a good option. On the other hand my G430 Headset is about to break into peaces:


So I pretty much at the point where I have a good excuse to buy a new pair. I was thinking of something like Sennheiser HD 6XX or beyerdynamic DT 770 paired with a modmic. But I should properly visit a local retailer for a sound test.

And my experience (the included sound card from this headset) the noise floor is way to high. So I was really considering a good soundcard with good linux support.

Okay thats weird… I seem to fix my issue…
I tried with PulseEffects to eliminate the crackling with software. And experimented with the settings Buffer, latency and Block Size and there is no crackling when

Buffer = 250000 us
latency = 125 us
block size = 2048

and also blacklist all recording application from this program :smile:
wtf, I have no clue why and what the settings mean but it works…

1 Like

just good that you got to a working state

have you tried audio capture using the line-in socket ?
if audio signal does not need any boost inside pc case should be very little noise on a modern motherboard
would need a preamplifier or small mixer to boost microphone to line level

and I really like beyerdynamic headphones for sound quality and easy to repair

2 Likes