You are not logged in.

#1 2021-04-18 13:56:23

chuckles991
Member
Registered: 2021-04-02
Posts: 17

static on headphones/speakers using headphone jack

Hi archlinux community,
I posted not long ago regarding a slow startup issue on an arch install on an ssd that migrated from one laptop to another.  You all quickly helped me solve that issue and now I unfortunately present another issue.  There is static sound on headphones and speakers using the 3.5mm headphone jack.  I have pulseaudio installed.  I attempted to implement some of the solutions suggested in the wiki quoted below (https://wiki.archlinux.org/index.php/Pu … io_quality), but have not observed a difference in the sound output through the headphone jack.
I have not confirmed that it is not a physical malfunction of the headphone jack but am assured by the prior user of the laptop that there was no static through the jack in Windows 10.

Audio quality
Glitches, skips or crackling
The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach.

Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system.

To turn timer-based scheduling off add tsched=0 in /etc/pulse/default.pa:

/etc/pulse/default.pa
load-module module-udev-detect tsched=0
Then restart the PulseAudio server:

$ pulseaudio -k
$ pulseaudio --start
Do the reverse to enable timer-based scheduling, if not already enabled by default.

If you are using Intel's IOMMU and experience glitches and/or skips, add intel_iommu=igfx_off to your kernel command line.

Some Intel audio cards using the snd-hda-intel module need the otions vid=8086 pid=8ca0 snoop=0. In order to set them permanently, create/modify the following file including the line below.

/etc/modprobe.d/sound.conf
options snd-hda-intel vid=8086 pid=8ca0 snoop=0
Please report any such cards to PulseAudio Broken Sound Driver page

Static noise when using headphones
Time-based scheduling may be causing this, disable it as explained in #Glitches, skips or crackling.

Another reason you are encountering static noise in your headphone jack could be ALSA's loopback mixing.

Make sure you have alsa-utils installed, launch alsamixer, then select your audio device (pressing F6), navigate all the way left using the left arrow, and stop on Loopback, if Enabled disable it using the down arrow. This should not impact audio playback or microphone recording negatively, unless you require loopback mixing.

Some notebook models, like Dell XPS 13 9360, suffer from continuous hissing sound when a headphone is plugged in.

Yet another reason for this symptom could be the power-saving mode of your audio device.[3] If you followed Power management#Audio, revert the changes and check if it solves the problem.

Setting the default fragment number and buffer size in PulseAudio
Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Copied from Linux mint topic with few additions (Discuss in Talk:PulseAudio/Troubleshooting#)
Disabling timer-based scheduling (0/4)
By default, PulseAudio uses timer-based scheduling. In this mode, fixed-size fragments are not used at all, and so the default-fragments and default-fragment-size-msec parameters are ignored. To turn timer-based scheduling off add tsched=0 in /etc/pulse/default.pa:

/etc/pulse/default.pa
load-module module-udev-detect tsched=0
Decide on audio device parameters (1/4)
Instructions below will cause PulseAudio to use a fixed size and number for audio fragments. These settings directly affect latency and power consumption. The latency is determined as default-fragments * default-fragment-size-msec, and the interrupt rate (i.e. how often the application is notified that some sound has indeed been played) is 1000 / default-fragment-size-msec. The considerations are:

The total number of fragments must be within the limits accepted by the hardware. Most sound cards are OK with two or more fragments, but some require three or more.
Giving the sound card more fragments than strictly necessary increases the latency, does not change power consumption, and does not remove the load from the scheduler. Therefore, it is advised only in the cases when the interrupts are not reliably delivered to the CPU, and one extra fragment beyond the minimum required should always be enough.
Giving the sound card bigger fragments increases latency and decreases power consumption.
Some applications (games and VoIP) request low latency and produce glitches when PulseAudio cannot fulfill their request.
Setting the latency too low will put a lot of stress on the scheduler, also resulting in glitches.
If one does not care about excessive power consumption, then 2 or 3 fragments, 5 ms each, are a reasonable choice.

Modify PulseAudio's configuration file (2/4)
/etc/pulse/daemon.conf
default-fragments = 3
default-fragment-size-msec = 5
Restart the PulseAudio daemon (3/4)
$ systemctl --user restart pulseaudio.service
See if it helps (4/4)
Run your applications, listen to the sounds they produce, inspect the journal.

If the skips/pops/glitches are occasional and mostly correlated to the system being highly loaded: this is a scheduler problem, the latency needs to be increased.

If there is metallic sound with the wrong speed from all applications: the most common reason is that you are trying to configure the fragment size which is way too small, like 1 ms. Do not do this.

If some, but not all, applications produce a constant stream of glitches: this is an application that assumes a low-latency setup. So the fragment size must be decreased so that the application request becomes valid.

Last edited by chuckles991 (2021-04-19 21:52:33)

Offline

#2 2021-04-18 15:00:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,671

Re: static on headphones/speakers using headphone jack

Please don't literally put a quote of the entire wiki section into your post.

Revert all of the other solutions you followed and try a 

options snd_hda_intel power_save=0

for starters. If that doesn't help post

aplay -l
amixer -c0
pacmd list-cards
pacmd list-sinks
pacmd list-sink-inputs

during an active playback attempt having the issue.

Last edited by V1del (2021-04-18 15:01:18)

Offline

#3 2021-04-18 15:24:00

chuckles991
Member
Registered: 2021-04-02
Posts: 17

Re: static on headphones/speakers using headphone jack

Many thanks kind sir, that option seems to have doe the trick!  So crisp and clear!  Again, many thanks.

Should that option be visible somewhere in the wiki?  Is it and I missed it?

I will mark solved.  Best wishes.

Offline

#4 2021-04-18 15:30:35

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,671

Re: static on headphones/speakers using headphone jack

I don't think it is, it probably should be somewhere, wonder where best to add it since it's a more general thing

Offline

#5 2021-04-19 22:28:40

chuckles991
Member
Registered: 2021-04-02
Posts: 17

Re: static on headphones/speakers using headphone jack

Interesting development:  the static returns to the audio through the 3.5 mm jack after suspending.  The static is not there after a fresh reboot. After resuming, I ran modprobe snd_hda_intel power_save=0 and restarted pulse audio (and alsa) but the crackling issue was still there.  I tried to add options snd_hda_intel power_save=0 power_save_controller=N to the /etc/modprobe.d/sound.conf but then I couldn't suspend through closing the lid, and the static problem returned after suspending through terminal command.

Please let me know if that other info you requested will be relevant and I will post it.

Last edited by chuckles991 (2021-04-19 22:59:54)

Offline

#6 2021-05-07 20:03:17

chuckles991
Member
Registered: 2021-04-02
Posts: 17

Re: static on headphones/speakers using headphone jack

I'm not sure if I lost you guys on this issue or not... I decided to install arch linux fresh on this machine, but the static issue persists on the microphone jack.  I post the output of the commands requested in an earlier post, in hopes I can still get some of your attention... thanks for any attention you can spare me!

[shawn@archlinux ~]$ aplay -l        
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC295 Analog [ALC295 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[shawn@archlinux ~]$ amixer -c0
Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [on]
  Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 0 [0%] [-65.25dB] [off]
  Front Right: Playback 0 [0%] [-65.25dB] [off]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958',1
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',2
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',3
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',4
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 39 [62%] [12.00dB] [on]
  Front Right: Capture 39 [62%] [12.00dB] [on]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Enabled'
Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
[shawn@archlinux ~]$ pacmd list-cards
1 card(s) available.
    index: 0
        name: <alsa_card.pci-0000_00_1f.3>
        driver: <module-alsa-card.c>
        owner module: 23
        properties:
                alsa.card = "0"
                alsa.card_name = "HDA Intel PCH"
                alsa.long_card_name = "HDA Intel PCH at 0xb1228000 irq 141"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1f.3"
                sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "9d71"
                device.product.name = "Sunrise Point-LP HD Audio"
                device.form_factor = "internal"
                device.string = "0"
                device.description = "Built-in Audio"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        profiles:
                input:analog-stereo: Analog Stereo Input (priority 65, available: unknown)
                output:analog-stereo: Analog Stereo Output (priority 6500, available: unknown)
                output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6565, available: unknown)
                output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5900, available: unknown)
                output:hdmi-stereo+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (priority 5965, available: unknown)
                output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 800, available: unknown)
                output:hdmi-surround+input:analog-stereo: Digital Surround 5.1 (HDMI) Output + Analog Stereo Input (priority 865, available: unknown)
                output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5700, available: no)
                output:hdmi-stereo-extra1+input:analog-stereo: Digital Stereo (HDMI 2) Output + Analog Stereo Input (priority 5765, available: no)
                output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (priority 600, available: no)
                output:hdmi-surround-extra1+input:analog-stereo: Digital Surround 5.1 (HDMI 2) Output + Analog Stereo Input (priority 665, available: no)
                output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 600, available: no)
                output:hdmi-surround71-extra1+input:analog-stereo: Digital Surround 7.1 (HDMI 2) Output + Analog Stereo Input (priority 665, available: no)
                output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5700, available: no)
                output:hdmi-stereo-extra2+input:analog-stereo: Digital Stereo (HDMI 3) Output + Analog Stereo Input (priority 5765, available: no)
                output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 600, available: no)
                output:hdmi-surround-extra2+input:analog-stereo: Digital Surround 5.1 (HDMI 3) Output + Analog Stereo Input (priority 665, available: no)
                output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 600, available: no)
                output:hdmi-surround71-extra2+input:analog-stereo: Digital Surround 7.1 (HDMI 3) Output + Analog Stereo Input (priority 665, available: no)
                output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5700, available: no)
                output:hdmi-stereo-extra3+input:analog-stereo: Digital Stereo (HDMI 4) Output + Analog Stereo Input (priority 5765, available: no)
                output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 600, available: no)
                output:hdmi-surround-extra3+input:analog-stereo: Digital Surround 5.1 (HDMI 4) Output + Analog Stereo Input (priority 665, available: no)
                output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 600, available: no)
                output:hdmi-surround71-extra3+input:analog-stereo: Digital Surround 7.1 (HDMI 4) Output + Analog Stereo Input (priority 665, available: no)
                output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (priority 5700, available: no)
                output:hdmi-stereo-extra4+input:analog-stereo: Digital Stereo (HDMI 5) Output + Analog Stereo Input (priority 5765, available: no)
                output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (priority 600, available: no)
                output:hdmi-surround-extra4+input:analog-stereo: Digital Surround 5.1 (HDMI 5) Output + Analog Stereo Input (priority 665, available: no)
                output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (priority 600, available: no)
                output:hdmi-surround71-extra4+input:analog-stereo: Digital Surround 7.1 (HDMI 5) Output + Analog Stereo Input (priority 665, available: no)
                off: Off (priority 0, available: unknown)
        active profile: <output:analog-stereo>
        sinks:
                alsa_output.pci-0000_00_1f.3.analog-stereo/#3: Built-in Audio Analog Stereo
        sources:
                alsa_output.pci-0000_00_1f.3.analog-stereo.monitor/#4: Monitor of Built-in Audio Analog Stereo
        ports:
                analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: unknown)
                        properties:
                                device.icon_name = "audio-input-microphone"
                analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "audio-input-microphone"
                analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "audio-speakers"
                analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: yes)
                        properties:
                                device.icon_name = "audio-headphones"
                hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: yes)
                        properties:
                                device.icon_name = "video-display"
                                device.product.name = "JLC37BC3002"
                hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"
                hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"
                hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"
                hdmi-output-4: HDMI / DisplayPort 5 (priority 5500, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"
[shawn@archlinux ~]$ pacmd list-sinks
1 sink(s) available.
  * index: 3
        name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: RUNNING
        suspend cause: (none)
        priority: 9039
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 20.49 ms
        max request: 4 KiB
        max rewind: 4 KiB
        monitor source: 4
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        used by: 1
        linked by: 3
        configured latency: 23.22 ms; range is 0.50 .. 2000.00 ms
        card: 0 <alsa_card.pci-0000_00_1f.3>
        module: 23
        properties:
                alsa.resolution_bits = "16"
                device.api = "alsa"
                device.class = "sound"
                alsa.class = "generic"
                alsa.subclass = "generic-mix"
                alsa.name = "ALC295 Analog"
                alsa.id = "ALC295 Analog"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "0"
                alsa.card_name = "HDA Intel PCH"
                alsa.long_card_name = "HDA Intel PCH at 0xb1228000 irq 141"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1f.3"
                sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "9d71"
                device.product.name = "Sunrise Point-LP HD Audio"
                device.form_factor = "internal"
                device.string = "front:0"
                device.buffering.buffer_size = "352800"
                device.buffering.fragment_size = "176400"
                device.access_mode = "mmap+timer"
                device.profile.name = "analog-stereo"
                device.profile.description = "Analog Stereo"
                device.description = "Built-in Audio Analog Stereo"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        ports:
                analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "audio-speakers"
                analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: yes)
                        properties:
                                device.icon_name = "audio-headphones"
        active port: <analog-output-headphones>
[shawn@archlinux ~]$ pacmd list-sink-inputs
1 sink input(s) available.
    index: 17
        driver: <protocol-native.c>
        flags: START_CORKED 
        state: RUNNING
        sink: 3 <alsa_output.pci-0000_00_1f.3.analog-stereo>
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 33.74 ms
        requested latency: 23.22 ms
        sample spec: float32le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        resample method: copy
        module: 8
        client: 48 <Brave>
        properties:
                application.icon_name = "chromium-browser"
                media.name = "Playback"
                application.name = "Brave"
                native-protocol.peer = "UNIX socket client"
                native-protocol.version = "34"
                application.process.id = "1600"
                application.process.user = "shawn"
                application.process.host = "archlinux"
                application.process.binary = "brave"
                application.language = "C"
                window.x11.display = ":0"
                application.process.machine_id = "a5a83c4543504deca99d3563f24aff86"
                application.process.session_id = "1"
                module-stream-restore.id = "sink-input-by-application-name:Brave"

Offline

#7 2021-05-07 21:44:02

chuckles991
Member
Registered: 2021-04-02
Posts: 17

Re: static on headphones/speakers using headphone jack

V1del wrote:

I don't think it is, it probably should be somewhere, wonder where best to add it since it's a more general thing

As far as a place to put this line in the Wiki, I am not sure, as I do not know how general a thing this is, but if it addresses static / crackling over headphones (which it seemed to do for me on a fresh boot), maybe between these two lines on this page: https://wiki.archlinux.org/index.php/Pu … io_quality

Static noise when using headphones
Time-based scheduling may be causing this, disable it as explained in #Glitches, skips or crackling.

Offline

Board footer

Powered by FluxBB