Solved Sound works with Kodi but not with YouTube or VLC

It's been a year since I fiddled with FreeBSD, but have just got myself a new system.... a Lenovo ThinkCentre M73 and have installed a disk which already had FreeBSD installed. The system booted up straightaway, and I've only just started playing with it, although I did a FreeBSD update first, so it is now at 12.2-RELEASE.

What I have found is that I can't get any sound out of the system, that is, not from YouTube, VLC, one mpv or even mpg123. I can however play music through Kodi.

Can any suggest what I need to look at to enable sound in the other apps?

Here is some multimedia related stuff from pciconf which may help sort things out:-

Code:
hdac0@pci0:0:3:0:<----->class=0x040300 card=0x309e17aa chip=0x0c0c8086 rev=0x06
    vendor     = 'Intel Corporation'
    device     = 'Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller'
    class      = multimedia
    subclass   = HDA
hdac1@pci0:0:27:0:<---->class=0x040300 card=0x309e17aa chip=0x8c208086 rev=0x04
    vendor     = 'Intel Corporation'
    device     = '8 Series/C220 Series Chipset High Definition Audio Controller'
    class      = multimedia
    subclass   = HDA

Any ideas on what to look for?
 

cat /dev/sndstat

Code:
Installed devices:
pcm0: <Intel Haswell (HDMI/DP 8ch)> (play)
pcm1: <Realtek ALC283 (Front Analog)> (play/rec) default
pcm2: <Realtek ALC283 (Rear Analog Mic)> (rec)
No devices installed from userspace.
 
The fact that one application does play sound (multimedia/kodi) while others do not, shows that in principle the OS's sound setup should be (more or less) ok, but it's an issue with encodings. I.e., the dumb applications are missing the neccessary decoder plugins. psearch -c audio -c multimedia plugin | less
 
No, the system uses a DP-HDMI connection to a TV.
Try setting sysctl hw.snd.default_unit=0. Boot computer with HDMI audio connected.
Never tried to use audio over hdmi, but i can google and seen many people had problems with that in FreeBSD.

EDIT: There is very high chance u gona need
Code:
kld_list="/boot/modules/i915kms.ko"
in your /etc/rc.conf.
 
Code:
sudo sysctl hw.snd.default_unit=0
to make it permanent add the following lines to: /etc/sysctl.conf
Rich (BB code):
hw.snd.default_unit=0
hw.snd.feeder_rate_quality=1
hw.snd.vpc_0db=45
hw.snd.vpc_mixer_bypass=1
hw.snd.vpc_autoreset=0
hw.snd.latency=5
hw.snd.maxautovchans=16
 
Code:
sudo sysctl hw.snd.default_unit=0
to make it permanent add the following lines to: /etc/sysctl.conf
Rich (BB code):
hw.snd.default_unit=0
hw.snd.feeder_rate_quality=1
hw.snd.vpc_0db=45
hw.snd.vpc_mixer_bypass=1
hw.snd.vpc_autoreset=0
hw.snd.latency=5
hw.snd.maxautovchans=16
I don't really understand what any of this means, but I did as you said and it works fine.

Very grateful, thanks.
 
Your sound output was settled on pcm1 (default) and since you wanted to use the built in HDMI all what was needed to switch to that HDMI output which in your case is pcm0 is that command sysctl hw.snd.default_unit. If you run again cat /dev/sndstat you'll see that the (default) is now pcm0 instead of pcm1. Glad I could help!
 
Your sound output was settled on pcm1 (default) and since you wanted to use the built in HDMI all what was needed to switch to that HDMI output which in your case is pcm0 is that command sysctl hw.snd.default_unit. If you run again cat /dev/sndstat you'll see that the (default) is now pcm0 instead of pcm1. Glad I could help!
Thanks for the explanation, but can you explain why I was able to hear output from Kodi?
 
multimedia/kodi can access the audio output device as listed by cat /dev/sndstat directly and on the fly, without depending on the system wide sysctl(8) setting, from the Kodi system audio settings, as does multimedia/vlc (play a audio/video file, open "Audio - Audio Devices"). I can't tell about multimedia/mpv, it might be similar there.
Just for the sake of my understanding I checked multimedia/vlc
selecting Audio->Audio Device->pcm0:virtual:dsp0.vp0
and indeed it enabled sound using the default /etc/sysctl.conf settings, so, thanks for pointing out this option.
 
Back
Top