# no sound play local music in vlc ,but could work in firefox online video



## realneet (Feb 4, 2022)

the problem confuse me and tried any way but usefulless

```
cat /dev/sndstat
Installed devices:
pcm0: <Intel Broadwell (HDMI/DP 8ch)> (play)
pcm1: <Conexant CX20751/2 (Analog)> (play/rec) default
pcm2: <Conexant CX20751/2 (Left Analog)> (play/rec)
Installed devices from userspace:
dsp: <Virtual OSS> (play/rec)
```


----------



## drr (Feb 4, 2022)

I have noticed that VLC uses the default playback device. Changing the default playback device with `sysctl hw.snd.default_unit=n` or changing audio device in VLC's settings (Audio > Audio Device), both work for me.

More on setting up the sound device at https://docs.freebsd.org/en/books/handbook/multimedia/#sound-setup.


----------



## hbsd (Feb 4, 2022)

I enabled sound with this:
`sysrc sound_load=yes
sysrc snd_hda_load=yes`
Make sure your system sound volume is at the highest level:
`mixer vol 100`


----------



## drr (Feb 4, 2022)

drr said:


> I have noticed that VLC uses the default playback device.


Forgot to mention that Firefox uses the playback device selected by pulse audio; I have KDE desktop with pulse audio mixer. I have seen similar behavior when the output device selected in pulse audio mixer is different from system's default playback device - VLC uses system's settings and Firefox uses pulse audio settings.


----------



## realneet (Feb 4, 2022)

drr said:


> I have noticed that VLC uses the default playback device. Changing the default playback device with `sysctl hw.snd.default_unit=n` or changing audio device in VLC's settings (Audio > Audio Device), both work for me.
> 
> More on setting up the sound device at https://docs.freebsd.org/en/books/handbook/multimedia/#sound-setup.


thanks i will try !
today i use pkg install cmus to test a.mp3 then echo "ERROR selecting output plugin '': no such plugin "
BUT then i use ports to get source code of cmus,make package add the pulse support , it work very well without any mode change !
so strange


----------



## eternal_noob (Feb 4, 2022)

hbsd said:


> I enabled sound with this:
> 
> ```
> sysrc sound_load=yes
> ...


These are already included with the GENERIC kernel, so no need to load them.


----------



## realneet (Feb 4, 2022)

drr said:


> Forgot to mention that Firefox uses the playback device selected by pulse audio; I have KDE desktop with pulse audio mixer. I have seen similar behavior when the output device selected in pulse audio mixer is different from system's default playback device - VLC uses system's settings and Firefox uses pulse audio settings.


So complex
alway lack of any useful tool to solve similar problems


----------



## drr (Feb 4, 2022)

realneet said:


> alway lack of any useful tool to solve similar problems


I wouldn't call these problems. These software are designed to work with different options/configurations. They come with some defaults, which can be changed as needed.

Firefox on my machine was installed from packages (with `pkg`), which has been compiled to work with pulseaudio, sndio, etc. It probably uses pulseaudio because it is available on my machine. VLC on the other hand, again installed from packages, has been compiled with pulseaudio off. I am sure both these software can be compiled with my choice of options if I use ports.


----------



## drr (Feb 4, 2022)

realneet said:


> today i use pkg install cmus to test a.mp3 then echo "ERROR selecting output plugin '': no such plugin "
> BUT then i use ports to get source code of cmus,make package add the pulse support , it work very well without any mode change !


Probably due to different options used at compile time, as I mentioned above.

BTW, I think it is not recommended to mix packages and ports, if I am not mistaken.


----------



## monwarez (Feb 4, 2022)

You are enabling virtual_oss (or something is starting it), what configuration did you give it ? Since your default output device seems to be dsp1 I wonder which argument you give to the rc settings: virtual_oss_dsp.
What is the output of `sysrc virtual_oss_dsp`


----------



## drr (Feb 4, 2022)

drr said:


> I have noticed that VLC uses the default playback device





drr said:


> Forgot to mention that Firefox uses the playback device selected by pulse audio


In hindsight, I should have mentioned that this is the behavior on my machine. I have Firefox and VLC binary packages installed with `pkg`, pulse audio installed as part of KDE desktop and I do not have virtual_oss installed.


----------



## bsduck (Feb 6, 2022)

realneet said:


> So complex


True: unnecessarily complex. PulseAudio is useless most of the time and shouldn't be installed automatically with a desktop environment.


----------



## drr (Feb 6, 2022)

The Plasma pulse audio mixer, installed as part of KDE desktop, works partially for me - it controls the volume of system speaker/headphones and switches audio device, which works for Firefox. However, the volume sliders do not change volume for HDMI output or the mic. For that, I switch device with `sysctl` and use `mixer`. As I can very easily run these commands with Krunner, I did not try other mixers like audio/dsbmixer yet. There may be a better/easier approach than mine.


----------



## realneet (Feb 7, 2022)

monwarez said:


> You are enabling virtual_oss (or something is starting it), what configuration did you give it ? Since your default output device seems to be dsp1 I wonder which argument you give to the rc settings: virtual_oss_dsp.
> What is the output of `sysrc virtual_oss_dsp`


Yestoday i deinstalled oss and viturl_oss  then delete related sets in rc.conf, it works well except my externel speaker, but i can live with that


----------



## realneet (Feb 7, 2022)

I tried to install this desktop environment, but VLC is the only one that works 
KDE is beautiful but resource intensive, so i had to switch back
Freebsd is a great system, but desktop applications still take a lot of effort on the part of users（me）


----------



## Alain De Vos (Feb 7, 2022)

What are the results with "smplayer" and "audacious" ?


----------



## realneet (Feb 8, 2022)

Alain De Vos said:


> What are the results with "smplayer" and "audacious" ?


Mplayer will crash during playback and Audacious will play properly


----------



## drr (Feb 8, 2022)

realneet, do you have pulse audio running now? If you have installed these audio/video players as binary packages, you may use `pkg info` to find out what output options they were compiled with.


----------



## realneet (Feb 8, 2022)

drr said:


> realneet, do you have pulse audio running now? If you have installed these audio/video players as binary packages, you may use `pkg info` to find out what output options they were compiled with.


    ALSA           : off
    AVAHI          : on
    GCONF          : off
    GDBM           : off
    GSETTINGS      : off
    JACK           : off
    SIMD           : on
    SIMPLE         : on
    SOXR           : on
    SPEEX          : on
    TDB            : off
    TEST           : off
    WEBRTC_AEC     : on
    X11            : on
should i use the pipewire to replace this? I heard it is a new platform
So many functions be off


----------



## drr (Feb 8, 2022)

realneet, I think the above info is for pulseaudio. I meant that you can check the package info for the players (vlc, mplayer, audacious, etc.) to see why some are working for you and some are not.



realneet said:


> KDE is beautiful but resource intensive, so i had to switch back


Do you currently use a graphical mixer to control audio?

Could you please share the output from the following commands?
`cat /dev/sndstat`
`sysctl hw.snd.default_unit`
`mixer`
`dmesg | grep hda*`



realneet said:


> should i use the pipewire to replace this? I heard it is a new platform


I think pipewire is developed for Linux to handle video similar to what pulse audio does for audio in Linux. I see that a port is available for pipewire, but I have no experience with it to comment on it.


----------



## realneet (Feb 9, 2022)

there's not many grafical mixer of mate desktop  i use alsamixer in teminal
cat /dev/sndstat
Installed devices:
pcm0: <Intel Broadwell (HDMI/DP 8ch)> (play)
pcm1: <Conexant CX20751/2 (Analog)> (play/rec) default
pcm2: <Conexant CX20751/2 (Left Analog)> (play/rec)
No devices installed from userspace.

dmesg | grep hda
hdac0: <Intel Broadwell HDA Controller> mem 0xf731c000-0xf731ffff irq 16 at device 3.0 on pci0
hdac1: <Intel Broadwell HDA Controller> mem 0xf7318000-0xf731bfff irq 22 at device 27.0 on pci0
hdacc0: <Intel Broadwell HDA CODEC> at cad 0 on hdac0
hdaa0: <Intel Broadwell Audio Function Group> at nid 1 on hdacc0
pcm0: <Intel Broadwell (HDMI/DP 8ch)> at nid 3 on hdaa0
hdacc1: <Conexant CX20751/2 HDA CODEC> at cad 0 on hdac1
hdaa1: <Conexant CX20751/2 Audio Function Group> at nid 1 on hdacc1
pcm1: <Conexant CX20751/2 (Analog)> at nid 23 and 26 on hdaa1
pcm2: <Conexant CX20751/2 (Left Analog)> at nid 22 and 25 on hdaa1

mixer
Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to  97:97
Mixer speaker  is currently set to  98:98
Mixer rec      is currently set to 100:100
Mixer monitor  is currently set to  97:97

sysctl hw.snd.default_unit
hw.snd.default_unit: 1


----------



## grahamperrin@ (Feb 9, 2022)

drr said:


> BTW, I think it is not recommended to mix packages and ports, if I am not mistaken.



<https://old.reddit.com/r/freebsd/comments/sn44xj/-/hw6tblw/?context=1> _mixture by design_

<https://old.reddit.com/r/freebsd/comments/sn44xj/-/hw6skbf/?context=1> an example.


----------



## drr (Feb 9, 2022)

realneet said:


> there's not many grafical mixer of mate desktop


audio/mate-media provides mate-volume-control. There are other graphical mixers available too, like audio/dsbmixer; you can find them with `pkg search` or on FreshPorts.



realneet said:


> i use alsamixer in teminal


I think `mixer` is more appropriate for FreeBSD.

From your previous outputs, it seems your sound devices are detected, but you may also have pulse audio running, which some applications like Firefox may be using as default. You may use `pactl` commands to investigate this further.


----------



## drr (Feb 9, 2022)

grahamperrin said:


> mixture by design


Thanks grahamperrin; I have not ventured into poudriere yet, but I definitely intend to do so in the near future.


----------

