Solved Headphones work but not loudspeakers

Hello.

cat /dev/sndstat returns:

Code:
Installed devices:
pcm0: <Realtek ALC256 (Analog)> (play/rec) default
pcm1: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
No devices installed from userspace.

cat some.file > /dev/dsp

sounds only in headphones and not in loudspeakers. Same in DE (KDE).

Code:
FreeBSD 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64


Please help! Thank you in advance.
 
May be you have to change the audio output by
Code:
sysctl hw.snd.default_unit=X
with X as a number. To get the current setting just type sysctl hw.snd.default_unit.
 
FreeBSD switches the output from speakers to headphones automaticly if the headphones are plugged in (at least since FreeBSD 13.0, maybe even earlier). Have you tried unplugging the headphones? Is there still no sound from your speakers?

The default unit is set correctly, as we can see from the OP's cat /dev/sndstat.
 
FreeBSD switches the output from speakers to headphones automaticly if the headphones are plugged in (at least since FreeBSD 13.0, maybe even earlier). Have you tried unplugging the headphones? Is there still no sound from your speakers?

The default unit is set correctly, as we can see from the OP's cat /dev/sndstat.

Yes. I've tried unplugging them. There is no sound coming out the loudspeakers then.
 
Please share the output of sysctl dev.hdaa
Here we go:
Code:
dev.hdaa.1.init_clear: 0
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)
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
    Association: 0 (0x0001)
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
    Pin control: 0x00000040 OUT
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

dev.hdaa.1.nid2: audio output
     Widget cap: 0x00006611 PWR DIGITAL 8CH
    Association: 0 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000005 AC3 PCM
        PCM cap: 0x001a07f0 16 24 32 bits, 32 44 48 88 96 176 192 KHz

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 Kaby Lake Audio Function Group
dev.hdaa.0.init_clear: 0
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
     Widget cap: 0x00300101 STEREO
    Association: 0 (0x0001)
            OSS: monitor
    Connections: 2
          + <- nid=18 [pin: Mic (Fixed)] (selected)
          + [DISABLED] <- nid=19 [pin: Line-out (None)] [DISABLED]

dev.hdaa.0.nid35: audio mixer [DISABLED]
     Widget cap: 0x0020010b STEREO
      Input amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 6
          + [DISABLED] <- nid=24 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=25 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]
          + [DISABLED] <- nid=18 [pin: Mic (Fixed)]

dev.hdaa.0.nid34: audio mixer [DISABLED]
     Widget cap: 0x0020010b STEREO
      Input amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 5
          + [DISABLED] <- nid=24 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=25 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]

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: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33: pin: Headphones (Black Jack)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 1 (0x0001)
        Pin cap: 0x0001001c PDC HP OUT EAPD
     Pin config: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
    Pin control: 0x000000c0 HP OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 2
          + <- nid=2 [audio output] (selected)
          + [DISABLED] <- nid=3 [audio output] [DISABLED]

dev.hdaa.0.nid32: vendor widget [DISABLED]
     Widget cap: 0x00f00040 PROC

dev.hdaa.0.nid31: vendor widget [DISABLED]
     Widget cap: 0x00f00000

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]
     Widget cap: 0x00400781 PWR DIGITAL UNSOL STEREO
        Pin cap: 0x00000014 PDC OUT
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000040 OUT
    Connections: 1
          + <- nid=6 [audio output] [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
     Widget cap: 0x00700400 PWR
    Association: -2 (0x0000)
            OSS: speaker (speaker)
        Pin cap: 0x00000020 IN
     Pin config: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
    Pin control: 0x00000020 IN

dev.hdaa.0.nid28: vendor widget [DISABLED]
     Widget cap: 0x00f00000

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]
     Widget cap: 0x0040058f PWR UNSOL STEREO
        Pin cap: 0x00013734 PDC OUT IN VREF[ 50 80 100 GROUND HIZ ] EAPD
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000020 IN
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)
    Connections: 2
          + [DISABLED] <- nid=2 [audio output] (selected)
          + <- nid=3 [audio output] [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]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

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]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000020 IN
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

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]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000020 IN
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid23: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid22: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid21: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid20_original: 0x90170140 as=4 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170140 as=4 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed) [DISABLED]
     Widget cap: 0x0040058d PWR UNSOL STEREO
        Pin cap: 0x00010014 PDC OUT EAPD
     Pin config: 0x90170140 as=4 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000000
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + [DISABLED] <- nid=2 [audio output]

dev.hdaa.0.nid19_original: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19_config: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19: pin: Line-out (None) [DISABLED]
     Widget cap: 0x0040040b PWR STEREO
        Pin cap: 0x00000020 IN
     Pin config: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid18_original: 0x90a60110 as=1 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18_config: 0x90a60110 as=1 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18: pin: Mic (Fixed)
     Widget cap: 0x0040040b PWR STEREO
    Association: 0 (0x0001)
            OSS: monitor (monitor)
        Pin cap: 0x00000020 IN
     Pin config: 0x90a60110 as=1 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
    Pin control: 0x00000020 IN
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid17: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid16: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid15: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid14: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid13: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid12: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid11: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid10: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid9: audio input [DISABLED]
     Widget cap: 0x0010051b PWR STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + [DISABLED] <- nid=34 [audio mixer] [DISABLED]

dev.hdaa.0.nid8: audio input [DISABLED]
     Widget cap: 0x0010051b PWR STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + [DISABLED] <- nid=35 [audio mixer] [DISABLED]

dev.hdaa.0.nid7: audio input
     Widget cap: 0x0010051b PWR STEREO
    Association: 0 (0x0001)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + <- nid=36 [audio selector]

dev.hdaa.0.nid6: audio output [DISABLED]
     Widget cap: 0x00000611 PWR DIGITAL STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e05e0 16 20 24 bits, 44 48 88 96 192 KHz

dev.hdaa.0.nid5: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid4: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid3: audio output [DISABLED]
     Widget cap: 0x0000041d PWR STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
     Output amp: 0x00025757 mute=0 step=87 size=2 offset=87 (-65/0dB)

dev.hdaa.0.nid2: audio output
     Widget cap: 0x0000041d PWR STEREO
    Association: 1 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
     Output amp: 0x00025757 mute=0 step=87 size=2 offset=87 (-65/0dB)

dev.hdaa.0.%parent: hdacc0
dev.hdaa.0.%pnpinfo: type=0x01 subsystem=0x102808d0
dev.hdaa.0.%location: nid=1
dev.hdaa.0.%driver: hdaa
dev.hdaa.0.%desc: Realtek ALC256 Audio Function Group
dev.hdaa.%parent:

Thanks in advance!
 
Code:
dev.hdaa.0.nid33: pin: Headphones (Black Jack)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 1 (0x0001)
        Pin cap: 0x0001001c PDC HP OUT EAPD
     Pin config: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
    Pin control: 0x000000c0 HP OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 2
          + <- nid=2 [audio output] (selected)
          + [DISABLED] <- nid=3 [audio output] [DISABLED]
... this is your working headphones output.

Code:
dev.hdaa.0.nid29: beep widget
     Widget cap: 0x00700400 PWR
    Association: -2 (0x0000)
            OSS: speaker (speaker)
        Pin cap: 0x00000020 IN
     Pin config: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
    Pin control: 0x00000020 IN
... you don't get a "speaker" line in mixer, do you?

Code:
dev.hdaa.0.nid20: pin: Speaker (Fixed) [DISABLED]
     Widget cap: 0x0040058d PWR UNSOL STEREO
        Pin cap: 0x00010014 PDC OUT EAPD
     Pin config: 0x90170140 as=4 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000000
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + [DISABLED] <- nid=2 [audio output]
... this looks like the speaker we're looking for.

Let's try to group it together with the output jack.

In /boot/device.hints add
Code:
hint.hdaa.0.nid20.config="as=2 seq=0"
hint.hdaa.0.nid33.config="as=2 seq=15"
and reboot to apply.

What are the results?
 
In /boot/device.hints add
Code:
hint.hdaa.0.nid20.config="as=2 seq=0"
hint.hdaa.0.nid33.config="as=2 seq=15"
and reboot to apply.

What are the results?
Thanks, again.

Output of mixer
Code:
Mixer vol      is currently set to  85:85
Mixer pcm      is currently set to 100:100
Mixer rec      is currently set to  37:37
Mixer ogain    is currently set to 100:100
Mixer monitor  is currently set to  67:67
Recording source: monitor

/boot/device.hints is set to 444. Changing the permissions and editing it manually is the recommended way?
 
That's funny: permissions are indeed 444 but I can edit it without a problem as root, no need to change permissions. Don't ask me why :)
If anyone passing by has an explanation, you're welcome.

Anyway, just edit it manually, that's fine.
 
That's funny: permissions are indeed 444 but I can edit it without a problem as root, no need to change permissions. Don't ask me why :)
If anyone passing by has an explanation, you're welcome.

Anyway, just edit it manually, that's fine.
Well, for me without having to change the permissions, it would not let me change it.

Following https://forums.freebsd.org/threads/how-to-add-command-to-boot.49556/
I added those lines to /boot/loader.conf (any objection?)
and voila,
sound comes out from the loudspeakers and it switches smoothly over to the headphones once plugged in.

Appreciated!!!
 
Sound was working perfectly from the very first boot up of FreeBSD 13. I'm using the KDE Desktop and I can easily switch in between my headphones and my speakers.
However VLC would not even play the sound of any video I played. Weird. I fixed that with the entry into /etc/sysctl.conf

Code:
hw.snd.default_unit=X
Now VLC will play the sound from the speakers, but not the headphones. Every other app, like Firefox will switch sound output from the speakers and headphones depending on what I select. VLC just doesn't.

If anyone has a solution that will get VLC to change audio output like the rest, I would be interested.
 
Sound was working perfectly from the very first boot up of FreeBSD 13. I'm using the KDE Desktop and I can easily switch in between my headphones and my speakers.
However VLC would not even play the sound of any video I played. Weird. I fixed that with the entry into /etc/sysctl.conf

Code:
hw.snd.default_unit=X
Now VLC will play the sound from the speakers, but not the headphones. Every other app, like Firefox will switch sound output from the speakers and headphones depending on what I select. VLC just doesn't.

If anyone has a solution that will get VLC to change audio output like the rest, I would be interested.
You can choose the audio output channel in VLC from the menu, without hardcoding the default channel in your boot file.
 
You can choose the audio output channel in VLC from the menu, without hardcoding the default channel in your boot file.
Before hardcoding the default channel, I tried selecting all the different channels. None of them worked. VLC would not play any sound. Youtube on Firefox was working and I could switch in between the channels. VLC would not work.
Once I did the hardcoding and rebooted the system, VLC had audio playback. It is weird. You'd expect all the applications to use the settings you select in the DE.
 
I'm using the KDE Desktop
... which, in its current state on FreeBSD, comes with PulseAudio by default.

You'd expect all the applications to use the settings you select in the DE.
Here's why:
* audio configuration set in audio/plasma5-plasma-pa (default volume control in Plasma) applies to PulseAudio only
* Firefox outputs to PulseAudio by default and therefore follows your settings
* VLC doesn't output to PulseAudio (PA support is disabled in the default build) but directly to OSS, so your settings are bypassed

As PulseAudio itself outputs to OSS, it's a good idea to set at least the master volume in OSS directly, so that it applies to everything playing sound and not only to programs using PA. You can set OSS volume levels through mixer, audio/mixertui, audio/kmix, audio/dsbmixer...

As for the automatic switch not happening in VLC: PulseAudio is apparently configured to automatically switch between your headphones and speakers, but OSS isn't. This can be enabled through manual configuration like what I suggested to the OP.

Things would be easier if PulseAudio wasn't a thing and everything would output to OSS, wouldn't they?
 
Back
Top