Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] [Solved] Work-Around for 60 Cycle Hum From Inactive Sound Card

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
dhunt2206
Posts: 6
Joined: 2024-02-25 00:30

[Software] [Solved] Work-Around for 60 Cycle Hum From Inactive Sound Card

#1 Post by dhunt2206 »

I have run into a problem with trying to use PC speakers on a headless server running bookworm with all the current updates. The hardware consists of a Gigabyte Z790 motherboard sound card. The problem is a 60 cycle hum, but it is not the result of your conventional ground-loop scenario. When the sound card is active there is no hum, even during the few seconds of quiet before and after a music file plays. The hum is only present when there is no activity. It appears the sound card “floats” when it is not actively being used and picks up the hum.

Now for the question. All I need is for speaker-test to run as root with no hum between runs and with no users logged in. I have tried a lot of things and what appears to be the simplest thing to do is to install alsa-utils and alsa-oss. It meets the criteria of running as root with no users, including root, logged in and would be perfect except for the hum. If I run Windows on the same motherboard, there is no hum between uses, so I suspect if I could keep the sound card active all the time (daemon??) while still being available to use speaker-test when needed, life would be good.

Any suggestions?
Last edited by dhunt2206 on 2024-03-07 12:25, edited 1 time in total.

Aki
Global Moderator
Global Moderator
Posts: 2981
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 75 times
Been thanked: 407 times

Re: [Software] 60 Cycle Hum From Inactiive Sound Card

#2 Post by Aki »

Hello,
dhunt2206 wrote: 2024-02-25 00:43 [..] The problem is a 60 cycle hum, but it is not the result of your conventional ground-loop scenario. [..]
Does the "hum" go away when you turn down the volume of the audio card's main output? You can do some tests with alsamixer from a remote shell using ssh.


Note: please, correct the little typo in the subject of the first post. Thanks :)
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

dhunt2206
Posts: 6
Joined: 2024-02-25 00:30

Re: [Software] 60 Cycle Hum From Inactiive Sound Card

#3 Post by dhunt2206 »

I did you what you asked. I used Putty to open up two shells and ran speaker-test in one shell and alsamixer in the other. When speaker-test was running, the card was active and alsamixer controlled the volume of the output reaching the PC speakers. There was however no hum at any volume setting. When speaker-test was not running, the hum was present and alsamixer had no effect. I suspect in the latter test, alsamixer had no effect because the card was inactive and as a result, there was nothing it could control.


I am still open to any and all suggestions, but In the meantime, I am still looking for a way to keep the card active even when speaker-test is not running, but that doesn't interfere with speaker-test running when it needs to run. If it isn't a problem in Windows, then there has to be a way to do it in Linux.

Aki
Global Moderator
Global Moderator
Posts: 2981
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 75 times
Been thanked: 407 times

Re: [Software] 60 Cycle Hum From Inactiive Sound Card

#4 Post by Aki »

Hi there,

If you want, you can play a sound with a frequency so low that it cannot be heard (by humans) indefinitely; for example, a 5Hz sound:

Code: Select all

play -n synth sine 5
You need to install the sox package.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

User avatar
Hetzer
Posts: 80
Joined: 2024-01-05 22:30
Location: /etc/fstab
Has thanked: 46 times
Been thanked: 21 times

Re: [Software] 60 Cycle Hum From Inactiive Sound Card

#5 Post by Hetzer »

Aki wrote: 2024-02-25 15:15 Hi there,

If you want, you can play a sound with a frequency so low that it cannot be heard (by humans) indefinitely; for example, a 5Hz sound:

Code: Select all

play -n synth sine 5
You need to install the sox package.
I think it's better to go with 0Hz instead:

Code: Select all

play -n synth sine 0

Same effect but speaker cones won't unnecessarily move all the time (since duration of cycle @ 0Hz is infinite + no amplifier / codec can process that)
And by the way, reproducing 5Hz on most speakers may damage them on higher volumes
Heave 'er up, and away we'll go...

dhunt2206
Posts: 6
Joined: 2024-02-25 00:30

Re: [Software] 60 Cycle Hum From Inactive Sound Card

#6 Post by dhunt2206 »

I thank you for your effort and I really thought you might have struck on a solution, but after trying to make it work for several hours, I am not sure I will ever make it work with this approach.

There are basically two problems. The first one is that you have to kill the 0 Hz output before you go with new process to produce a tone. If you don’t, they are both running at the same time and you end up with a unpleasant garbled tone, not a pure sine wave. I finally came up with a way of doing that, but it created a new problem. I am not sure if there is a lag in killing the first process so there is overlap or lag in starting the next one so there is gap, but regardless, there is quite a bit of noise at the transition. You might think of it as a “click” but it is really much louder and lasts a little longer than what you might associate with the term click. It is certainly not something you would want to live with.

I have also spent hours trying to get pulseaudio to work and I have managed to keep it from suspending and have even found a way to make it work from the console when logged in a root, but I cannot find a way for it to do what I want unless a user is logged in.

Why pulseaudio has been designed to only allow logged in non root users to use it without a lot of mickey mouse tweaking is beyond me. If it is for security, all I can say is “Lord, protect me from those who would protect me from myself!”

At the moment I am trying to work with only alsa, but no matter what I do the hum starts again after the sound generating script ends. With pulseudio there are .pa files etc that you can modify to prevent suspension, but I have yet to find a way to do so using only alsa.

On the old server I use to use “beep”, but it no longer works on some of the newer motherboards and my Gigabyte Z790 appears to be one of them.

I never thought I would say this, but sound is one area Windows is handling things much better than Linux. :(

User avatar
Hetzer
Posts: 80
Joined: 2024-01-05 22:30
Location: /etc/fstab
Has thanked: 46 times
Been thanked: 21 times

Re: [Software] 60 Cycle Hum From Inactive Sound Card

#7 Post by Hetzer »

dhunt2206 wrote: The first one is that you have to kill the 0 Hz output before you go with new process to produce a tone. If you don’t, they are both running at the same time and you end up with a unpleasant garbled tone, not a pure sine wave
I don't think so, I hear no difference no matter when I start it. At least in my case - Tested with Realtek ALC892 (or 897?) codec which drives Pioneer SA-520 amplifier with Altus 110 loudspeaker pair
dhunt2206 wrote: Why pulseaudio has been designed to only allow logged in non root users to use it without a lot of mickey mouse tweaking is beyond me. If it is for security, all I can say is “Lord, protect me from those who would protect me from myself!”
Ye, it's all 'bout security. But it's "treat user like a idiot" approach and brings nothing but unnecessary irritation
At the moment I am trying to work with only alsa, but no matter what I do the hum starts again after the sound generating script ends. With pulseudio there are .pa files etc that you can modify to prevent suspension, but I have yet to find a way to do so using only alsa.
PulseAudio is kinda "front-end" to ALSA, so ALSA should be able to do as much as it
I found a solution which may work out for ya:

Code: Select all

/etc/modprobe.d/alsa-base.conf:
options snd-hda-intel power_save=0 power_save_controller=N
dhunt2206 wrote: I never thought I would say this, but sound is one area Windows is handling things much better than Linux. :(
I wouldn't say so, as I have no problems with sound. Maybe I have that powersave hum ('cause I didn't even try to disable it), but it's so silent I don't hear it most of the time
Heave 'er up, and away we'll go...

dhunt2206
Posts: 6
Joined: 2024-02-25 00:30

Re: [Software] 60 Cycle Hum From Inactive Sound Card

#8 Post by dhunt2206 »

I may have been a little over the top in my remarks about Linux, but I will chalk it up to frustration. And to be honest, I blame Gigabyte as much as Linux. I think there is something in their design with regard to how the input to the sound card is handled when it is not being used that produces the hum.

I will take a look at your suggestion as to a possible solution, but I am not very hopeful. I should also note that I now feel that I do not have the skill set to solve this problem, if it is solvable, and that further effort looking for a solution is simply wasting more time.

As a result, I have decided to try an alternate approach. I found an inexpensive USB sound card (dongle if you like) on Amazon with a large number of good reviews for less than $10. I am only going to use with monitoring scripts that I created to alert me to events on the server via Morse code so fidelity is not a problem. When it comes in, it should at least help me decide if that is a viable approach and if the source of the problem is the internal sound card.

Thanks to all that offered suggestions.

dlu2021
Posts: 211
Joined: 2021-08-13 19:55
Location: Minnesota
Has thanked: 7 times
Been thanked: 41 times

Re: [Software] 60 Cycle Hum From Inactive Sound Card

#9 Post by dlu2021 »


dhunt2206
Posts: 6
Joined: 2024-02-25 00:30

Re: [Software] 60 Cycle Hum From Inactive Sound Card

#10 Post by dhunt2206 »

I thank you for your effort, and I will keep your suggestions in mind if my alternate approach does not work out. To be honest though, those references talk about whine, which suggests to me a much higher frequency than what I am hearing. What I am hearing when the sound card is not active is clearly 60 cycle hum, and if it has a higher frequency component to it, you cannot detect it aurally. It is the same hum you would get if you did not fully connect an RCA plug from a turntable into preamp/amp and only the middle pin was making a connection. Thanks again.

dhunt2206
Posts: 6
Joined: 2024-02-25 00:30

Re: [Software] 60 Cycle Hum From Inactive Sound Card

#11 Post by dhunt2206 »

I am not going to mark this as solved because I could not find a away to keep the motherboard sound card active in Linux, but I did find a work-around. The usb sound card/dongle that I mentioned in my first post of Feb 27th arrived and it worked without a hum right out of the gate. I am posting this so if someone has a similar problem, they will know there is an alternative. Thanks again to those who offered suggestions along the way.

Aki
Global Moderator
Global Moderator
Posts: 2981
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 75 times
Been thanked: 407 times

Re: [Software] 60 Cycle Hum From Inactive Sound Card

#12 Post by Aki »

I'm glad you sorted it out. :)

Please, mark the discussion as "solved" manually adding the text tag "[Solved]" at the beginning of the subject of the first message (after other tags, if any). It is also an opportunity to the make the subject more understandable to other forum users and readers, if necessary; i.e. :
[Software] [Solved] 60 Cycle Hum From Inactive Sound Card
Happy Debian !
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Post Reply