Solved Sound works with Kodi but not with YouTube or VLC

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

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?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,357
Messages: 38,883

Look at the output from cat /dev/sndstat.
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024


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.
 

tyson

Member

Reaction score: 41
Messages: 79

Funny question : do you have speakers/headphones connected to that computer mini jack output ?
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

No, the system uses a DP-HDMI connection to a TV.
 

Mjölnir

Daemon

Reaction score: 1,505
Messages: 2,114

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
 

tyson

Member

Reaction score: 41
Messages: 79

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.
 

Minbari

Aspiring Daemon

Reaction score: 307
Messages: 569

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
 

Mjölnir

Daemon

Reaction score: 1,505
Messages: 2,114

sysctl -d hw.snd.default_auto: assign default unit to a newly attached device
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

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.
 

Minbari

Aspiring Daemon

Reaction score: 307
Messages: 569

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!
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

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?
 

T-Daemon

Daemon

Reaction score: 883
Messages: 1,762

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.
 
OP
B

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

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.
 
Top