No sound with FreeBSD 14.1-RELEASE

Hello everyone, I am a long-time Gentoo Linux user that I use as the main OS on all my home computers. However, I have long since come to appreciate FreeBSD and currently have it installed in version 14.1-RELEASE and am trying to use it exclusively under Wayland with Wayfire compositor (base system + wayland + wayfire, without xorg). Everything works fine, except for the audio that I cannot activate and make work. I apologize if I will be a bit verbose in the following, but I think a simple formulation can be useful for those FreeBSD beginners like me who want to use it at its best.

My reference computer gives me these responses on pcm when I query with “dmesg | grep pcm”:
pcm0: <NVIDIA (0x0080) (HDMI/DP 8ch)> at nid 4 on hdaa0
pcm1: <NVIDIA (0x0080) (HDMI/DP 8ch)> at nid 5 on hdaa0
pcm2: <NVIDIA (0x0080) (HDMI/DP 8ch)> at nid 6 on hdaa0
pcm3: <Rtoealtek ALC1220 (Rear Analog 5.1/2.0)> at nid 20,22,21 and 24,26 on hdaa1
pcm4: <Realtek ALC1220 (Front Analog)> at nid 27 and 25 on hdaa1
pcm5: <Realtek ALC1220 (Rear Digital)> at nid 30 on hdaa1
pcm6: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa2

If I query with cat /dev/sndstat, I get in response:
pcm0: <NVIDIA (0x0080) (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA (0x0080) (HDMI/DP 8ch)> (play)
pcm2: < NVIDIA (0x0080) (HDMI/DP 8ch)> (play)
pcm3: <Realtek ALC1220 (Rear Analog 5.1/2.0)> (play/rec) default
pcm4: <Realtek ALC1220 (Front Analog)> (play/rec)
pcm5: <Realtek ALC1220 (Rear Digital)> (play)
pcm6: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
No devices installed from userspace.

In /boot/loader.conf I have:
kern.vty=vt
hw.vga.textmode=3
snd_driver_load="YES"

In /etc/rc.conf:
........
kld_list= "i915kms"
seatd_enable="YES"
dbus_enable="YES"

In /etc/sysctl.conf: hw.snd.default_unit=3

So I have an NVIDIA graphics card (that I don't use) that has 3 pcm, and a sound card which pciconf tells me about: 'Intel Corporation' '200 Series PCH HD Audio' subclass HDA.

What should I do to have audio output, especially to listen to youtube.com? I mean in particular "how" and "where" to set every cad and nid (in /boot/device.hints?). I installed Pulseaudio. I have no response with beeps and other tests. I would like to be able to use the speakers of the monitor (HDMI).
Thanks in advance to anyone who can help me with simple suggestions.
 
hi mate

whats the output of the following command on your system

Code:
cat /dev/sndstat

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

Code:
/etc/sysctl.conf

set pcm1 to the default output

Code:
# default audio output - headphones
hw.snd.default_unit=1
# use new audio devices automatically
hw.snd.default_auto=1
# dont autoreset vol to default
hw.snd.vpc_autoreset=0

firefox and obs studio are the only 2 apps i know of that use pulseaudio by default on freebsd
freebsd use oss for audio and not pulseaudio

if you are using chromium it doesnt use pulseaudio
it uses oss audio

firefox uses pulseaudio by default but you can change the output to oss audio

otherwise you need to start pulseaudio by running

Code:
pulseaudio --start --daemonize 2>/dev/null

then check pulseaudio is running

Code:
pactl info

Code:
Server String: /var/run/xdg/djwilcox/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: djwilcox
Host Name: pollux
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp1
Default Source: oss_input.dsp0
Cookie: 8c88:8264

set firefox to use oss audio instead of pulseaudio

in firefox url bar open

Code:
about:config

and create

Code:
media.cubeb.backend

set the option to string and

Code:
oss

also check the output of the mixer command

Code:
mixer

you might also want to check out mixertui
which is a tui audio app that looks like alsamixer

Code:
sudo pkg install mixertui

Code:
sudo sysrc -f /boot/loader.conf sysctlinfo_load="YES"
sudo sysrc -f /boot/loader.conf sysctlbyname_improved="YES"
 
hi mate

whats the output of the following command on your system

Code:
cat /dev/sndstat

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

Code:
/etc/sysctl.conf

set pcm1 to the default output

Code:
# default audio output - headphones
hw.snd.default_unit=1
# use new audio devices automatically
hw.snd.default_auto=1
# dont autoreset vol to default
hw.snd.vpc_autoreset=0

firefox and obs studio are the only 2 apps i know of that use pulseaudio by default on freebsd
freebsd use oss for audio and not pulseaudio

if you are using chromium it doesnt use pulseaudio
it uses oss audio

firefox uses pulseaudio by default but you can change the output to oss audio

otherwise you need to start pulseaudio by running

Code:
pulseaudio --start --daemonize 2>/dev/null

then check pulseaudio is running

Code:
pactl info

Code:
Server String: /var/run/xdg/djwilcox/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 0
Tile Size: 65472
User Name: djwilcox
Host Name: pollux
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: oss_output.dsp1
Default Source: oss_input.dsp0
Cookie: 8c88:8264

set firefox to use oss audio instead of pulseaudio

in firefox url bar open

Code:
about:config

and create

Code:
media.cubeb.backend

set the option to string and

Code:
oss

also check the output of the mixer command

Code:
mixer

you might also want to check out mixertui
which is a tui audio app that looks like alsamixer

Code:
sudo pkg install mixertui

Code:
sudo sysrc -f /boot/loader.conf sysctlinfo_load="YES"
sudo sysrc -f /boot/loader.conf sysctlbyname_improved="YES"

Thanks for the suggestions, but unfortunately I still can't get sound. In particular, I have a doubt about which of the pcm indicated in my /dev/sndstat I should set as default. I remember that I would like the sound output to be through the monitor's HDMI. By the way, I add that in FreeBSD both chromium and firefox use pulseaudio, but this shouldn't have a negative impact on the lack of sound activation. Hoping to receive other suggestions, thanks again.
 
If I query with cat /dev/sndstat, I get in response:
pcm0: <NVIDIA (0x0080) (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA (0x0080) (HDMI/DP 8ch)> (play)
pcm2: < NVIDIA (0x0080) (HDMI/DP 8ch)> (play)
pcm3: <Realtek ALC1220 (Rear Analog 5.1/2.0)> (play/rec) default
pcm4: <Realtek ALC1220 (Front Analog)> (play/rec)
pcm5: <Realtek ALC1220 (Rear Digital)> (play)
pcm6: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
No devices installed from userspace
So I have an NVIDIA graphics card (that I don't use) that has 3 pcm, and a sound card which pciconf tells me about: 'Intel Corporation' '200 Series PCH HD Audio' subclass HDA.

What should I do to have audio output, especially to listen to youtube.com? I mean in particular "how" and "where" to set every cad and nid (in /boot/device.hints?).

So you are using the HDMI output using the integrated Intel GPU from your motherboard to your monitor. In this case pcm6 is the correct sound device to use. You can test it directly with beep(1):
Code:
$ beep -d /dev/dsp6
Make sure that your monitor isn't muted itself (it happened to me once... two hours of my life for troubleshooting I'll never get back...), and that the audio device /dev/dsp6 isn't muted and the volume is sufficiently high:
Code:
$ mixer -f /dev/dsp6
If you get sound, then you can adjust your /etc/sysctl.conf:
Code:
hw.snd.default_unit=6

Regarding pin configuration (nids and friends), everything seems to be set correctly already, as far as I can see.
 
chromium audio output options

by default chromium uses sndio
but can also use pulseaudio and alsa


20241004_13h41m48s_grim.png
 
pcm6: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
So I have an NVIDIA graphics card (that I don't use) that has 3 pcm, and a sound card which pciconf tells me about: 'Intel Corporation' '200 Series PCH HD Audio' subclass HDA.
So you are using the HDMI output using the integrated Intel GPU from your motherboard to your monitor. In this case pcm6 is the correct sound device to use.
giocitta, you should try setting the default sound device to pcm6: <Intel Kaby Lake (HDMI/DP 8ch)> (play), but don't be surprised if there is no sound. Kaby Lake HDMI sound is known not to work.

There is a open bug report addressing this issue: Bug 237340 Unable to make HDMI sound works with HD630

See also https://github.com/freebsd/drm-kmod/issues/187 No sound over HDMI.

Apparently there was a patch commited from a user (Aug 16, 2022), but no recent feedback from developers (last commented on 2023-10-18 from patch committer). If you feel like testing, you can try out the patch, in case there is no sound from pcm6.

The nVIDIA card, with the proper driver, has no issues producing sound, but only in Xorg.
 
giocitta, you should try setting the default sound device to pcm6: <Intel Kaby Lake (HDMI/DP 8ch)> (play), but don't be surprised if there is no sound. Kaby Lake HDMI is known not to work.

There is a open bug report addressing this issue: Bug 237340 Unable to make HDMI sound works with HD630

See also https://github.com/freebsd/drm-kmod/issues/187 No sound over HDMI.

Apparently there was a patch commited from a user (Aug 16, 2022), but no recent feedback from developers (last commented on 2023-10-18 from patch committer). If you feel like testing, you can try out the patch, in case there is no sound from pcm6.

The nVIDIA card, with the proper driver, has no issues producing sound, but only in Xorg.
I understand what you say. So, my next attempt will be to repeat all the procedure in my second computer that has a more advanced 9th generation Intel® Core™ (Geekom it13). I'll keep you informed. Many thanks.
 
So you are using the HDMI output using the integrated Intel GPU from your motherboard to your monitor. In this case pcm6 is the correct sound device to use. You can test it directly with beep(1):
Code:
$ beep -d /dev/dsp6
Make sure that your monitor isn't muted itself (it happened to me once... two hours of my life for troubleshooting I'll never get back...), and that the audio device /dev/dsp6 isn't muted and the volume is sufficiently high:
Code:
$ mixer -f /dev/dsp6
If you get sound, then you can adjust your /etc/sysctl.conf:
Code:
hw.snd.default_unit=6

Regarding pin configuration (nids and friends), everything seems to be set correctly already, as far as I can see.
BtW many thanks for your time. Your suggestions have helped me to make some progress, but still no sound. I checked everything and everything seems fine, except the response to "mixer -f /dev/dsp6" which is: "mixer: /dev/dsp6: no such mixer", but /dev/dsp6 is there. In the meantime I hear from T-Daemon that the root of the problem is probably the fact that HDMI does not work with the HD630 of Kaby Lake.
 
on my macbook pro retina i had to use the nid numbers to get the audio working

check the output of dmesg with grep for nid

Code:
sudo dmesg | grep nid

add write permissions to the device.hints file

Code:
sudo chmod +w /boot/device.hints

device hints for speaker and headphones on my macbook pro retina
using the nid numbers from dmesg

Code:
hint.hdac.1.cad0.nid18.config="as=2 seq=0 device=Speaker"
hint.hdac.1.cad0.nid24.config="as=2 seq=0 device=Speaker"
hint.hdac.1.cad0.nid16.config="as=4 seq=15 device=Headphones"
hint.hdaa.1.gpio_config="0=set"

remove write permissions to the device.hints file

Code:
sudo chmod -w /boot/device.hints
 
9th generation Intel® Core™ (Geekom it13)
The 9th generation seems to be Raptor Lake, which is apparently supported by graphics/drm-61-kmod [1].

You must install the driver from ports, the 14.1 kernel and the i915kms kernel module must match. The current packages were build for 14.0.

14.0 got end-of-life recently (September 30), the latest packages however were distributed on September 29, still built for 14.0. Until the servers have build 14.1 packages and packages are distributed, kernel modules need to be build from ports.



[1] https://github.com/freebsd/drm-kmod/issues/307#issuecomment-2161786785
 
Last edited:
BtW many thanks for your time. Your suggestions have helped me to make some progress, but still no sound. I checked everything and everything seems fine, except the response to "mixer -f /dev/dsp6" which is: "mixer: /dev/dsp6: no such mixer", but /dev/dsp6 is there. In the meantime I hear from T-Daemon that the root of the problem is probably the fact that HDMI does not work with the HD630 of Kaby Lake.
Said and done! With the VGA display device 'Raptor Lake-P [Iris Xe Graphics]' the audio works perfectly both in FreeBSD 14.1-RELEASE and in 15.0-CURRENT.
 
Make sure that your monitor isn't muted itself (it happened to me once... two hours of my life for troubleshooting I'll never get back...), and that the audio device /dev/dsp6 isn't muted and the volume is sufficiently high:
Very good advice. So much BTDT (been there, done that). Make sure nothing is muted.
As an alternative, perhaps try testing the headphone device to check whether the sound service is operational.
Once you can get sound from some device, it should be easy to redirect it to other device/s.
(I'm loving my toslink digital audio output to Schiit Audio DAC, connected to stereo amplifier and floorstanding speakers.)
YMMV
 
when you try to install chromium, pulseaudio is simultaneously installed.

www/chromium library dependencies include accessibility/speech-dispatcher.

Code:
===> The following configuration options are available for speech-dispatcher-0.11.5:
     ALSA=off: ALSA audio architecture support
     AO=off: libao audio library support
     DOCS=on: Build and/or install documentation
     ESPEAK=on: eSpeak speech synthesizer support
     FESTIVAL=off: Festival Speech Synthesis System support
     FLITE=off: Flite speech synthesis engine support
     NAS=off: Network Audio System support
     PULSEAUDIO=on: PulseAudio sound server support
     VOXIN=off: Voxin speech synthesis engine support (not yet ported)
 
… an NVIDIA graphics card (that I don't use) that has 3 pcm, … I would like to be able to use the speakers of the monitor (HDMI). …

If you revert to this computer, can you use the NVIDIA card?

1728211395077.pngWith FreeBSD 15.0-CURRENT I have audio over DisplayPort ("HDMI/DP"):

Code:
% pciconf -lv | grep -B 2 -A 2 HDMI\ Audio
hdac0@pci0:1:0:1:       class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x0e1b subvendor=0x103c subdevice=0x2256
    vendor     = 'NVIDIA Corporation'
    device     = 'GK107 HDMI Audio Controller'
    class      = multimedia
    subclass   = HDA
% pciconf -lv | grep -B 3 -A 1 display
vgapci0@pci0:1:0:0:     class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x0ff6 subvendor=0x103c subdevice=0x2256
    vendor     = 'NVIDIA Corporation'
    device     = 'GK107GLM [Quadro K1100M]'
    class      = display
    subclass   = VGA
%
 
Back
Top