sound gets scratchy by random

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
ttt
Level 2
Level 2
Posts: 70
Joined: Wed Jun 24, 2020 7:33 am
Contact:

sound gets scratchy by random

Post by ttt »

since yesterday my linux mint 20.1 sometimes turns the sound to scratchy noise with partially audible audio. It is annoying.
I plugged off the speakers and plugged in headphones and there is was scratchy sound too so it is coming out of the audio out of the mobo (Gigabyte AORUS X399) like this.
yesterday it got scratchy on listening to music on youtube, I turned on internet radio and then it worked normal again. no idea what fixed this.
Today it gets scratchy on youtube on firefox again, this time the trick with internet radio did not work, but after a reboot it works normal again. So it is probably not a hardware problem but a problem with audiodrivers? Did I miss an update or install a wrong update? the weird thing is, it happens only sometimes and not permanent... good but annoying.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
ugly
Level 5
Level 5
Posts: 592
Joined: Thu Nov 24, 2016 9:17 pm

Re: sound gets scratchy by random

Post by ugly »

I get this quite a bit. I haven't found a solution.

I think it is related to onboard audio on Intel boards. I've read some issues related to power saving, where it essentially goes to sleep too aggressively.

For me it tends to happen when I'm watching a movie. If I pause the movie for a few minutes, occasionally (but not always), the audio will suddenly have that scratchy, tinny sound to it.

One quick workaround is to simply change the audio source and then change it right back (this can be done graphically using the audio applet).

I think it also works if you restart pulseaudio using pulseaudio -k at the terminal.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: sound gets scratchy by random

Post by rene »

MrEen seems to be taking a break but I believe he'd immediately advise e.g.

Code: Select all

echo options snd_hda_intel power_save=0 | sudo tee /etc/modprobe.d/snd-hda-intel.conf
or maybe

Code: Select all

echo options snd_hda_intel power_save=0 power_save_controller=N | sudo tee /etc/modprobe.d/snd-hda-intel.conf
After a reboot things may behave. If not, simply sudo rm /etc/modprobe.d/snd-hda-intel.conf and reboot undoes it.
User avatar
ttt
Level 2
Level 2
Posts: 70
Joined: Wed Jun 24, 2020 7:33 am
Contact:

Re: sound gets scratchy by random

Post by ttt »

thanks already. I found the trick with changing the line out to digital out in the soundsettings already but will try what you suggest.
That basically creates a config file for what? what is modprobe? but combining what you 2 say this should turn off some powersaving setting on the motherboard?
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: sound gets scratchy by random

Post by rene »

ttt wrote: Wed May 12, 2021 9:46 pm That basically creates a config file for what? what is modprobe? but combining what you 2 say this should turn off some powersaving setting on the motherboard?
"modules" in the context of the Linux kernel are discrete, separately loadable/unloadable pieces of kernel-code, drivers mostly. "modprobe" is the tool with which to load such modules. Much like with normal programs a module can be passed parameters upon loading, and the created .conf file has modprobe do so for the snd-hda-intel module, supposedly your sound "card" driver. Directly then, the created snd-hda-intel.conf is a config file for your sound card driver snd-hda-intel. Although, careful, not by name; modprobe just reads all .conf files under /etc/modprobe.d. Naming it <module>.conf is just something that you-the-human-operator do to keep conceptual order. man modprobe.d for more information if desired.

What the parameter does is tell your sound driver snd-hda-intel to program your sound hardware in such a way as to not enable power saving modes of the hardware. Sometimes necessary due to, for example, problems such as you describe when it does.

I do not know about the "changing line out to digital out" trick. That sounds rather misty since picking a fully different output, analogue vs. digital, would seem to imply needing a fully different setup behind said output. But if indeed you are saying that you have such now: a digital-out is more or less "a serial port" alone which is to say you are then basically not using your onboard sound anymore but whatever DAC is behind said digital-out. Can as such certainly be functional as to side-stepping a problem with the analogue line-out (and can again depending on what's behind that line-out sound nicer than the sound coming from your onboard DAC) but, well, is then not really a fix for former in a technical sense.

All that said; note that if the mentioned tweak doesn't help, I've also immediately no more suggestions.
User avatar
ttt
Level 2
Level 2
Posts: 70
Joined: Wed Jun 24, 2020 7:33 am
Contact:

Re: sound gets scratchy by random

Post by ttt »

the trick was changing to digital out and then back to line out. that had worked, but now it did not work anymore.

I did what you suggested @rene and after a reboot it works again, but it did that before after a reboot. will see if it keeps working...
also the reboot happened with a hardware error message but it seems to work :P
User avatar
ttt
Level 2
Level 2
Posts: 70
Joined: Wed Jun 24, 2020 7:33 am
Contact:

Re: sound gets scratchy by random

Post by ttt »

it happens again, but I found out when. It happens when listening to music and working in blender, especially when hitting play for an animation in blender (in the normal blender workspace, no sound involved at all!). all other operations in blender are fine, but as soon as I start the animation on the blender timeline the sound gets scratchy again.
Then switching between digital out and line out does nothing, it is silent shortly (because there is no signal on DO) but then scratchy sound again. but closing blender and switching between digital out and back to line out makes the sound good again.

Should I report this to the blender devs or do you think this is a Linux problem?
This happens with all newer blender versions from 2.93 on...
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: sound gets scratchy by random

Post by rene »

It's probably a resampling or sample-format issue, and I would assume relatively specific to your hardware. I don't know blender, but if it has a setting somewhere where you can set sample-rate and/or -format parameters for any possibly present audio track in its settings, try and look at what they're set to now. If e.g. 44100 try 48000 or, seemingly more likely, if some floating point sample format such as FLOAT32LE, try plain old S16LE.

As said, don't know blender so maybe above is N/A. If so try and see what your hardware is set to when all's fine and when all's not by looking at e.g. /proc/asound/card0/pcm0p/sub0/hw_params for the in your case correct (card, pcm,sub) triple in both cases so as to possibly identify a/the format your hardware or driver isn't handling correctly.

Forcing things at the Pulseaudio level might then be useful. When you open as root /etc/pulse/daemon.conf you will supposedly see among other things

Code: Select all

; resample-method = speex-float-1
[ ... ]
; default-sample-format = s16le
; default-sample-rate = 44100
; alternate-sample-rate = 48000
; default-sample-channels = 2
The ; at the start of the lines mean they are commented out: you'd try e.g. removing that comment marker and saying e.g.

Code: Select all

default-sample-rate = 48000
save, and then kill/restart Pulseaudio with pulseaudio -k. I feel that in this case sample-format stands as big a chance as rate: if you can't adjust things Blender-sides you can try e.g. s24le, s32le, float32le there in daemon.conf, see man pulse-daemon.conf, but it depends on what your sound hardware in fact supports. Uncommenting and changing the resample method to e.g. speex-float-10 might also be a useful test.

It it in any case likely that Blender is opening your sound hardware, apparently even without a sound track present if I read you right, with parameters that some part of the rest of your setup is not happy with. Option 1 as said is to tell it to stop doing that, option 2 if 1 not possible perhaps to try and convince Pulseaudio to play ball. An unlikely to be generally useful third option could be to configure your music player to output directly to ALSA rather than go through Pulseaudio but that might depending on what said player is again not be possible.
User avatar
ttt
Level 2
Level 2
Posts: 70
Joined: Wed Jun 24, 2020 7:33 am
Contact:

Re: sound gets scratchy by random

Post by ttt »

Image
These are the blender options, I did set it to 16bit, that seeḿs to have fixed it for now, I hope forever! Thanks a lot rene! :)
kylerickards
Level 4
Level 4
Posts: 372
Joined: Sun Oct 18, 2009 9:39 am

Re: sound gets scratchy by random

Post by kylerickards »

Hi

By no way means of a hijack at all (and please move if it is) but I have upgraded to 20.2 this week, am not using Blender and have the same scratchy intermittent sound problems occurring, seemingly at random. Weirdly for me Firefox seems to trigger it but that could be coincidence.

Kyle
bta
Level 1
Level 1
Posts: 1
Joined: Fri Aug 06, 2021 1:35 pm

Re: sound gets scratchy by random

Post by bta »

I am running into this issue with Firefox as well, still trying to test the fixes mentioned above as the issue is quite sporadic. For me, restarting Firefox resolves the issue consistently.
User avatar
BashBasher
Level 1
Level 1
Posts: 24
Joined: Thu Aug 05, 2021 8:28 am

Re: sound gets scratchy by random

Post by BashBasher »

The following should work as a workaround, for Firefox:
In Firefox's about:config, set media.webspeech.synth.enabled to false.
Reference: viewtopic.php?p=2050191#p2050191
This tweak stops Firefox from launching an audio process (speech-dispatcher), that triggers the bug.
It's not a fix for the underlying bug, but it should hopefully work, until a bugfix arrives.
kylerickards
Level 4
Level 4
Posts: 372
Joined: Sun Oct 18, 2009 9:39 am

Re: sound gets scratchy by random

Post by kylerickards »

BashBasher wrote: Sat Aug 07, 2021 10:19 am The following should work as a workaround, for Firefox:
In Firefox's about:config, set media.webspeech.synth.enabled to false.
Reference: viewtopic.php?p=2050191#p2050191
This tweak stops Firefox from launching an audio process (speech-dispatcher), that triggers the bug.
It's not a fix for the underlying bug, but it should hopefully work, until a bugfix arrives.
Thank you
User avatar
ttt
Level 2
Level 2
Posts: 70
Joined: Wed Jun 24, 2020 7:33 am
Contact:

Re: sound gets scratchy by random

Post by ttt »

BashBasher wrote: Sat Aug 07, 2021 10:19 am The following should work as a workaround, for Firefox:
In Firefox's about:config, set media.webspeech.synth.enabled to false.
Reference: viewtopic.php?p=2050191#p2050191
This tweak stops Firefox from launching an audio process (speech-dispatcher), that triggers the bug.
It's not a fix for the underlying bug, but it should hopefully work, until a bugfix arrives.
great, I just changed that setting, let's see how it goes, the sound problem was still present in the last weeks...
User avatar
Neojade13
Level 1
Level 1
Posts: 12
Joined: Mon Jun 08, 2020 10:50 pm
Location: Northwoods Area, WI, USA, Earth, Milkyway Galaxy

Re: sound gets scratchy by random

Post by Neojade13 »

This has happened to me three times today since upgrading to latest kernel. I'm still using LM 19 for whatever reason...it just works lol.

Code: Select all

pulseaudio -k
Fixed this issue for me, never had it before though until getting newest kernel. I'm on a Ryzen 3 setup.

The way my audio works is I use a fancy digitial cable from soundbar to HDMI TV to PC. :)
Linux Mint Mate changed my life. :)
Locked

Return to “Sound”