Project

General

Profile

Bug #2180

alsa chirping buggy noise with external plug headphones and speakers

nona - about 5 years ago - . Updated about 4 years ago.

Status:
not-a-bug
Priority:
bug
Assignee:
-
% Done:

0%


Description

Hello,

I think that ALSA has a common problem: the sound is described as chirping, missing or buggy when headphones are plugged in. It sometimes fixes itself, which is hard to debug. I have noticed that the "fix" happens after I come back from hibernation (can't suspend and come back right now). Following this http://troubleshooters.com/linux/sound/sound_troubleshooting.htm , I came with a way to diagnose my situation.

It seems that the internal speaker interferes with the external plug. Mutting everything except my Master, Headphone and PCM controls, an external speaker set and my headphones work well. As soon as I start increasing the Speaker control (mutted, by the way), I can hear the interference. This cannot be tested with the default

 speaker-test -c2 -t sine
or at least, not fully. I recommend Le nozze di Figaro for the test ;) .

Question is there a way (or a place where I can find information on how) to create a kernel rule to turn the volume of the speakers completely down when the jack is connected? Thanks!

Steps to reproduce:
--------
  1. Make sure that only ALSA is running (without Pulseaudio)
  2. Connect an external speaker set (as per the link above, for safety, do not use your headphones)
  3. Run alsamixer, and mute every channel except for Master, Headphone (external or equivalent), and--if available--PCM.
  4. Set the volume level of Master to the minimum (and make sure it is not mute)
  5. Increase the sound output of Headphone and PCM to max
  6. Start your favourite media player with a frequency-rich sound (Le nozze di Figaro would work).
  7. Start increasing the volume of Master in alsamixer until you hear sound at a decent level (50%)
  8. To hear the interference, start increasing the level of the internal Speaker little by little. The noise should appear at around 55% (or earlier, if you set the Master higher).

Besides this system information, I attach some info from alsa-info.sh

Kernel release:    4.9.127-gnu-1-lts-xtreme
Operating System:  GNU/Linux with OpenRC
Architecture:      x86_64
Processor:         unknown
SMP Enabled:       Yes

!!ALSA Version
!!------------

Driver version:     k4.9.127-gnu-1-lts-xtreme
Library version:    1.1.8
Utilities version:  1.1.8


Files

alsa-log.txt (17.4 KB) alsa-log.txt partial output of alsa-info.sh nona, 2019-02-18 12:15 AM

History

#1

Updated by freemor about 5 years ago

I can see from the information you provided that you are using the Extreme kernel. This is most likely where the problem lies. The Exterme kernels patches require much more hands on tuning after install. If you have not done such tuning the lack of it is most likely the cause of your problem.

Unfortunately I'm not versed enough in the extreme kernel to talk you through the necessary adjustments. One of the other devs may be.

As a debugging measure I'd suggest trying with the regular kernel or the regular LTS kernel and see how ALSA behaves. If fine with those then my suspicions are almost certainly confirmed.

#2

Updated by freemor about 5 years ago

You may also wish to paste the output of:

lsmod | grep snd
lspci | grep -i audio
aplay -l 
cat /proc/asound/cards
cat /proc.asound/modules

As this will give a much better idea of what you are dealing with sound card wise.

#3

Updated by bill-auger about 5 years ago

one thing i can add off-hand is that you would not need any kernel hacks to change ALSA settings programatically - JACK and it's front-ends expose hooks to run scripts on start and shutdown

the command to mute speakers on JACK start would look something like this:

amixer -c 1 sset 'Speaker,0' '0%'

and the command to un-mute speakers on JACK shutdown would look something like this:

amixer -c 1 sset 'Speaker,0' '100%'

#4

Updated by nona about 5 years ago

Thank you for all this. I think that I need to clarify something:

- When I said jack, I meant the physical device :) . I think that JACK is actually installed, but I don't think that it's running (`ps aux | grep jack` returns nothing)
- This issue happens with linux-libre and -lts-xtreme (I couldn't boot -lts last time I tried--months ago).

About my question on muting the Speaker: where would I set that command to set 0% volume on Speaker when the headphones are connected? (if not using pulseaudio nor JACK).

I don't consider this to be very urgent or anything, by the way.

Regarding the extra information:

lsmod | grep snd
snd_hda_codec_realtek    73728  1
snd_hda_codec_generic    69632  1 snd_hda_codec_realtek
snd_hda_codec_hdmi     49152  1
snd_hda_intel          32768  5
snd_hda_codec         106496  4 snd_hda_intel,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
snd_hda_core           65536  5 snd_hda_intel,snd_hda_codec,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
snd_hwdep              16384  1 snd_hda_codec
snd_pcm                90112  5 snd_hda_intel,snd_hda_codec,snd_hda_core,snd_hda_codec_hdmi
snd_timer              28672  2 snd_pcm
snd                    77824  16 snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek,snd_pcm
soundcore              16384  1 snd

lspci | grep -i audio
03:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Device 15de
03:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Device 15e3

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic_1 [HD-Audio Generic], device 0: ALC295 Analog [ALC295 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

cat /proc/asound/cards
 0 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfe088000 irq 54
 1 [Generic_1      ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfe080000 irq 55

cat /proc.asound/modules
cat: /proc.asound/modules: No such file or directory

cat /proc/asound/modules
 0 snd_hda_intel
 1 snd_hda_intel

#5

Updated by bill-auger about 5 years ago

ok i misunderstood about JACK; but the `amixer` command would be the same - 'Speaker' and 'Headphones' are usually different "pins" - you can see them all with `alsamixer`

if all you are asking about is if the speakers should go mute when you plug headphones into the physical headphone jack, that is normally handled automatically by the kernel module, and there is often a "pin" for that switch you can also find in `alsamixer` (named something like "auto-mute", "auto-sense", or "jack-sensor") - this is only true f the sound card actually supports that feature - it is not always the case - and for desktops, sometimes it will work only for the jack on the front of the computer or the one on the rear

for now the first thing to do is see how the LTS kernel behaves - if that does not work, then i would try it with a different distro - if that does not work, then the people to ask for help would be the ALSA devs

#6

Updated by bill-auger about 5 years ago

nona wrote:

8. To hear the interference, start increasing the level of the internal Speaker little by little. The noise should appear at around 55% (or earlier, if you set the Master higher).

FWIW, that description would be consistent with feeedback from a microphone

#7

Updated by nona about 5 years ago

bill-auger wrote:

ok i misunderstood about JACK;

No worries

but the `amixer` command would be the same - 'Speaker' and 'Headphones' are usually different "pins" - you can see them all with `alsamixer`

Yep, I got that much (that's how I debugged). Thanks.

if all you are asking about is if the speakers should go mute when you plug headphones into the physical headphone jack, that is normally handled automatically by the kernel module, and there is often a "pin" for that switch you can also find in `alsamixer` (named something like "auto-mute", "auto-sense", or "jack-sensor") - this is only true f the sound card actually supports that feature - it is not always the case - and for desktops, sometimes it will work only for the jack on the front of the computer or the one on the rear

Oh! But I have that and it does not make a difference (enabled or disabled, it's the same). That's why I wanted to know if there was a way to execute the command that you posted via a edev rule (or something).

for now the first thing to do is see how the LTS kernel behaves - if that does not work, then i would try it with a different distro - if that does not work, then the people to ask for help would be the ALSA devs

I will try with Trisquel and report back.

By the way, my linux-libre is broken as of 4.20.10-gnu-1 (amdgpu is missing; will create a bug report--this one is actually important), but this same behaviour used to happen with previous versions of linux-libre.

#8

Updated by nona about 5 years ago

bill-auger wrote:

nona wrote:

8. To hear the interference, start increasing the level of the internal Speaker little by little. The noise should appear at around 55% (or earlier, if you set the Master higher).

FWIW, that description would be consistent with feeedback from a microphone

Yep, that's what I thought, but they are all at level 0 (Mic Boost, Capture, Digital, Internal Mic Boost; no way to mute), and if I have the headphones on, there should not be a way for feedback, right? My headphones do not have a microphone either. As I said, the issue happens with both the speakers and headphones.

I am inclined to think that this has to do with core ALSA, because similar behaviour shows up in Arch, Ubuntu, Debian, Fedora... forums.

#9

Updated by freemor about 5 years ago

Form the above I can see that you have 2 sound devices both snd_hda_intel devices.

This means that you will most likely have to set Index values in /etc/modules.d/asla-base.conf (or similar) to ensure that the one you prefer is always the default. With multiple sound devices the order they are detected can change from boot to boot and this change which is the "default" card.

More Details here:

https://alsa.opensrc.org/MultipleCards

Also as they are both snd_hda_intel you MIGHT have to manually have to specify the model= option while loading the modules. Some machines (Notably Dell machines) wire up their sound chips odly and thus need the model= specifier to get things to work right. You can see a list of all the model= options here:

http://git.alsa-project.org/?p=alsa-kernel.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;hb=HEAD

#11

Updated by bill-auger about 5 years ago

  • Status changed from unconfirmed to not-a-bug
#12

Updated by nona over 4 years ago

The issue has been back for a while. Sorry for the delay on reporting. I still have

model=alc295-hp-x360
mentioned above. I run linux-libre, I will try with linux-libre-lts

#13

Updated by freemor over 4 years ago

What you are describing sounds like either electrical interference from the Mobo or Cliping/over modulation

Problem a.) electrical interference is due to poor circuit design that laaows noise from the MoBo to leak into the
audio channels usually seem at high amplifications (volumes to max). Try setting the PCM and headphone volumes to only about 3/4s or 75%
then raise the master.

Over modulation is a different problem again caused by over amplification. With this problem you are taking a sound that was recoded at a laoud volume and then trying to amplify it beyond the limits of the hardware.
This causes "cliping" (the tops and bottoms of higher amplitude sections of the signal are lost (if you looked at the output in an oscilliscope it'd look like someone clipped them off) causing distortion. Or
over modulation which is just where the wave form gets mangled because of overdriving the amplifier/speakers.

This too is usually helped by not setting the PCM/etc to 100%

Are you using amplified speakers. A common reason I have seen for people having this problem is using unamplified speakers on a system that was designed for amplified (powered) external speakers. Because the output
from the soundcard expects to be run to amplified speakers it is too quiet when played on non amplified ones causing people to overdrive their sound cards amps.

fun fact: in days long gone computer without soundcards were programmed to run the cpu through timed loops
so that an AM radio placed next to it would pick up the electrical noise from the MoBo ans make music (really squeaky music)
but when you didn't have a sound card it was still very cool.

A recording of the interference will help to Dx whether it is cuircit noise, clipping/Overmodulation,
Or some other problem like sample recorded at a nonstandard sample rate (don't get me started on all the problem
with "HiRes" FLACs) etc.

#14

Updated by nona over 4 years ago

Oh, that is very interesting. I did the 75 % volume on the headphones and the PCM. It has worked so far. One point less for the HP envy X360 (of the many that I have recorded; read: don't buy this crap).

#15

Updated by bill-auger over 4 years ago

i cant say for sure if this is your problem; but often when ALSA
has the wrong settings for your sound card, you can specify a
'model' in /etc/modprobe.d/alsa-base.conf

#16

Updated by nona over 4 years ago

nona wrote:

Oh, that is very interesting. I did the 75 % volume on the headphones and the PCM. It has worked so far..

And it no longer works.

$ uname -a 
  Linux localhost 5.3.8-gnu-1 #1 SMP PREEMPT @1572742724 x86_64 GNU/Linux

bill-ager wrote:

i cant say for sure if this is your problem; but often when ALSA
has the wrong settings for your sound card, you can specify a
'model' in /etc/modprobe.d/alsa-base.conf

I also have this in my modprobe.d/alsa.conf

options snd-hda-intel model=alc295-hp-x360

I think that I will go over:
- https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/sound/hd-audio/models.rst
- https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture/Troubleshooting#Crackling_sound_through_mini-jack_(headphones_connector)

And these may help too:
- https://docs.slackware.com/howtos:hardware:audio_and_snd-hda-intel

#17

Updated by nona over 4 years ago

I have this in /etc/modprobe.d/alsa.conf, and the sound seems to be quite good now:

options snd-hda-intel model=alc295-hp-x360,hp-mute-led-mic3

I wish this helps someone.

#18

Updated by bill-auger over 4 years ago

oh that is good news - it can be tricky finding the right set of
params for some sound cards

#19

Updated by nona about 4 years ago

I know that I keep coming back to this. I found something new:

  1. Turn on computer
  2. start mocp
  3. hibernate
  4. turn on computer without headphones
  5. plug-in headphones --> no issues
  6. hibernate
  7. plug-in headphones
  8. turn on computer with headphones --> chirping
  9. un-plug headphones
  10. hibernate
  11. turn on computer without headphones
  12. plug-in headphones --> no issues

Super weird! :S .
4.19.101-gnu-1-lts openrc

Also available in: Atom PDF