# Distorted sound in headphones



## abishai (Sep 5, 2016)

I have internal speakers and headphones jack on XPS13 laptop. The problem is that sound in headphones is broken. It's hard to explain, it's still recognizable, but distorted as with some electric noise on background or like bad quality radio. Also, sound is very quiet and can be heard with maxed volume.

```
abishai@sphinx:~ % cat /dev/sndstat
Installed devices:
pcm0: <Realtek (0x0256) (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Intel (0x2809) (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```
dmesg

```
hdac0: <Intel Sunrise Point-LP HDA Controller> mem 0xdc228000-0xdc22bfff,0xdc200000-0xdc20ffff at device 31.3 on pci0
hdacc0: <Realtek (0x0256) HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek (0x0256) Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek (0x0256) (Analog 2.0+HP/2.0)> at nid 20,33 and 18 on hdaa0
hdacc1: <Intel (0x2809) HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel (0x2809) Audio Function Group> at nid 1 on hdacc1
pcm1: <Intel (0x2809) (HDMI/DP 8ch)> at nid 3 on hdaa1
```
I added hint.hdac.0.cad0.nid33.config="as=2 seq=15" to get jack sense, but this is not the root of the problem, sound was distorted before I merged pcm devices.


```
abishai@sphinx:~ % sysctl -a | grep hda
device   snd_hda
dev.pcm.1.%parent: hdaa1
dev.pcm.0.%parent: hdaa0
dev.hdaa.1.reconfig: 0
dev.hdaa.1.gpo_config:
dev.hdaa.1.gpo_state:
dev.hdaa.1.gpio_config:
dev.hdaa.1.gpio_state:
dev.hdaa.1.gpi_state:
dev.hdaa.1.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.1.nid3_original: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3_config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3: pin: Digital-out (Jack)
dev.hdaa.1.nid2: audio output
dev.hdaa.1.%parent: hdacc1
dev.hdaa.1.%pnpinfo: type=0x01 subsystem=0x80860101
dev.hdaa.1.%location: nid=1
dev.hdaa.1.%driver: hdaa
dev.hdaa.1.%desc: Intel (0x2809) Audio Function Group
dev.hdaa.0.reconfig: 0
dev.hdaa.0.gpo_config:
dev.hdaa.0.gpo_state:
dev.hdaa.0.gpio_config: 0=keep 1=keep 2=keep
dev.hdaa.0.gpio_state: 0=disabled 1=disabled 2=disabled
dev.hdaa.0.gpi_state:
dev.hdaa.0.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.0.nid36: audio selector
dev.hdaa.0.nid35: audio mixer [DISABLED]
dev.hdaa.0.nid34: audio mixer [DISABLED]
dev.hdaa.0.nid33_original: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33_config: 0x0221102f as=2 seq=15 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33: pin: Headphones (Black Jack)
dev.hdaa.0.nid32: vendor widget [DISABLED]
dev.hdaa.0.nid31: vendor widget [DISABLED]
dev.hdaa.0.nid30_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid30_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid30: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid29_original: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29_config: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29: beep widget
dev.hdaa.0.nid28: vendor widget [DISABLED]
dev.hdaa.0.nid27_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid26_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid25_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid24_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid23: vendor widget [DISABLED]
dev.hdaa.0.nid22: vendor widget [DISABLED]
dev.hdaa.0.nid21: vendor widget [DISABLED]
dev.hdaa.0.nid20_original: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed)
dev.hdaa.0.nid19_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid19_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid19: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid18_original: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18_config: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18: pin: Mic (Fixed)
dev.hdaa.0.nid17: vendor widget [DISABLED]
dev.hdaa.0.nid16: vendor widget [DISABLED]
dev.hdaa.0.nid15: vendor widget [DISABLED]
dev.hdaa.0.nid14: vendor widget [DISABLED]
dev.hdaa.0.nid13: vendor widget [DISABLED]
dev.hdaa.0.nid12: vendor widget [DISABLED]
dev.hdaa.0.nid11: vendor widget [DISABLED]
dev.hdaa.0.nid10: vendor widget [DISABLED]
dev.hdaa.0.nid9: audio input [DISABLED]
dev.hdaa.0.nid8: audio input [DISABLED]
dev.hdaa.0.nid7: audio input
dev.hdaa.0.nid6: audio output [DISABLED]
dev.hdaa.0.nid5: vendor widget [DISABLED]
dev.hdaa.0.nid4: vendor widget [DISABLED]
dev.hdaa.0.nid3: audio output [DISABLED]
dev.hdaa.0.nid2: audio output
dev.hdaa.0.%parent: hdacc0
dev.hdaa.0.%pnpinfo: type=0x01 subsystem=0x10280704
dev.hdaa.0.%location: nid=1
dev.hdaa.0.%driver: hdaa
dev.hdaa.0.%desc: Realtek (0x0256) Audio Function Group
dev.hdaa.%parent:
dev.hdacc.1.%parent: hdac0
dev.hdacc.1.%pnpinfo: vendor=0x8086 device=0x2809 revision=0x00 stepping=0x00
dev.hdacc.1.%location: cad=2
dev.hdacc.1.%driver: hdacc
dev.hdacc.1.%desc: Intel (0x2809) HDA CODEC
dev.hdacc.0.%parent: hdac0
dev.hdacc.0.%pnpinfo: vendor=0x10ec device=0x0256 revision=0x00 stepping=0x02
dev.hdacc.0.%location: cad=0
dev.hdacc.0.%driver: hdacc
dev.hdacc.0.%desc: Realtek (0x0256) HDA CODEC
dev.hdacc.%parent:
dev.hdac.0.polling: 0
dev.hdac.0.pindump: 0
dev.hdac.0.wake: 0
dev.hdac.0.%parent: pci0
dev.hdac.0.%pnpinfo: vendor=0x8086 device=0x9d70 subvendor=0x1028 subdevice=0x0704 class=0x040380
dev.hdac.0.%location: slot=31 function=3 dbsf=pci0:0:31:3 handle=\_SB_.PCI0.HDAS
dev.hdac.0.%driver: hdac
dev.hdac.0.%desc: Intel Sunrise Point-LP HDA Controller
dev.hdac.%parent:
```

Maybe anyone has some ideas? I booted Linux Mint from pen drive to verify that headphones work and tried CURRENT.


----------



## good-beastie (Sep 6, 2016)

> Maybe anyone has some ideas?


Hi, The FreeBSD Handbook has something about default playback device. Something like `sysctl hw.snd.default_unit=n`. In section 7.2.3. Troubleshooting Sound.


----------



## scobiehague (Sep 6, 2016)

Did you check the igain and ogain levels with `mixer` command? I lowered one of those (can't remember which) and the distortion in my headphones went away.


----------



## abishai (Sep 6, 2016)

Yes, I did. ogain is 0.


----------



## scobiehague (Sep 9, 2016)

abishai said:


> Yes, I did. ogain is 0.



Do you use pulseaudio? I remember an issue with jittery sound that was fixed by adding these lines to /usr/local/etc/pulse/daemon.conf:


```
default-fragments = 8
default-fragment-size-msec = 5
```

You might then need to restart the pulseaudio daemon.


----------



## abishai (Sep 11, 2016)

scobiehague said:


> Do you use pulseaudio?


No, I use OSS only.  
That topic looks aligned perfectly with this one (pins are the same)
https://forums.freebsd.org/threads/57528/#post-328389


----------

