# No audio on freeBSD 11.1



## joachin (Aug 26, 2017)

I installed FreeBSD today and I have no sound, I can't play youtube, play videos or something like that, when I do `dmesg | grep pcm` I have the following:

```
dmesg | grep pcm
pcm0: <Realtek ALC255 (Internal Analog)> at nid 20 and 18 on hdaa0
pcm1: <Realtek ALC255 (Front Analog Headphones)> at nid 33 on hdaa0
pcm2: <Intel (0x2883) (HDMI/DP 8ch)> at nid 5 on hdaa1
pcm0: <Realtek ALC255 (Internal Analog)> at nid 20 and 18 on hdaa0
pcm1: <Realtek ALC255 (Front Analog Headphones)> at nid 33 on hdaa0
pcm2: <Intel (0x2883) (HDMI/DP 8ch)> at nid 5 on hdaa1
pcm0: chn_write(): pcm0:virtual:dsp0.vp0: play interrupt timeout, channel dead
pcm0: chn_write(): pcm0:virtual:dsp0.vp1: play interrupt timeout, channel dead
pcm0: chn_write(): pcm0:virtual:dsp0.vp2: play interrupt timeout, channel dead
pcm0: chn_write(): pcm0:virtual:dsp0.vp0: play interrupt timeout, channel dead
```
Thanks!


----------



## k.jacker (Aug 27, 2017)

Hei joachin,
Where do you want your sound to come from? HDMI or frontpanel?


----------



## Minbari (Aug 27, 2017)

Did you load the driver at boot or in kernel?

Place this in /boot/loader.conf

```
sound_load="YES"
snd_hda_load="YES"
```

then reboot, or on a live system type: *kldload snd_driver *for a "generic" sound driver.


----------



## rigoletto@ (Aug 27, 2017)

Had you checked sound(4), mixer(8), and the Handbook?


----------



## Deleted member 9563 (Aug 27, 2017)

Agreed, the mixer is often too obvious and thus forgotten as a source of such a problem.


----------



## joachin (Aug 28, 2017)

Thanks for your answers, I did all the above, and I still have not sound, It's a laptop, so I want the sound from my speakers, also if I play a video on Firefox I have something like: Can't playback, try to reboot your system, I can't watch videos on vlc too.


----------



## rigoletto@ (Aug 28, 2017)

The front speakers should be *pcm0*, based on the information you shared in your first post.

Try running `sysctl hw.snd.default_unit=0` to see if the sound come up.

Also, just in case the mixer be muted:

`mixer vol 100
mixer pcm 100`

EDIT:
However there is a problem related with pcm0:


```
pcm0: chn_write(): pcm0:virtual:dsp0.vp0: play interrupt timeout, channel dead
```


----------



## rigoletto@ (Aug 28, 2017)

May be a better idea, if you can, try using *pcm1*, what seem to be the headphone out. If it work we will know the pcm0 issue should be the only one to deal with, however I do not know how to fix that.

`sysctl hw.snd.default_unit=1`


----------



## joachin (Aug 28, 2017)

I can't play any audio file, vlc says --:--, gstreamer doesn't play it, I don't know how can I play my music now, and youtube still says: If playback doesn't begin shortly, try restarting your device, I don't know what else can I do


----------



## rigoletto@ (Aug 28, 2017)

joachin neither the headphones worked setting `sysctl hw.snd.default_unit=1`?


----------



## joachin (Aug 28, 2017)

It's seems like the sound now it's ok, when I open the wisker menu and press the Backspace key now I have something like beep on headphones and Speaker, but I can't play mp3 and youtube


----------



## rigoletto@ (Aug 28, 2017)

Try running `sysctl hw.snd.feeder_rate_quality=4`.

Look, those sysctl configurations need to be included at /etc/sysctl.conf to become permanent.

Also, try playing with multimedia/mpv. It is a mplayer fork and so it uses different codecs.

Are you using www/firefox and multimedia/vlc from ports or pkg?


----------



## joachin (Aug 28, 2017)

Well I just installed kde to know if I have sound on that DE but now I dont have it on xfce or kde...

Im using firefox and vlc from pkg


----------



## k.jacker (Aug 28, 2017)

To sort out your sound problem I strongly advice to stick to the basics at first and leave all audio tools from desktop environments, browsers, youtube and such alone.

What you want for now is to get sound on the console.

Your speakers will most likely not work for now because of this:


joachin said:


> dmesg | grep pcm
> pcm0: <Realtek ALC255 (Internal Analog)> at nid 20 and 18 on hdaa0
> .....
> pcm0: chn_write(): pcm0:virtual:dsp0.vp0: play interrupt timeout, channel dead



So grab your headphones and insert them into you 3,5mm jack, if you haven't allready done, and set the volume to a medium value like this `mixer pcm 40 vol 40`.

Please just hold your headphones just near your ears and don't put them on/in your ears as what comes now might still be quite loud even with the volume lowered.
Type `cat /dev/random > /dev/dsp.1.0` to produce some noise on your headphones. Hit Ctrl+C to abort that.

If that works, you have a working sound driver at least. For sake of completeness  you could try the same with your speakers, but as said, I'm pretty sure it won't work. Try using the above command with _dsp0.0_ instead, anyway.

When done, tell us what worked and what did not and we'll continue...


----------



## SirDice (Aug 28, 2017)

Use `cat /dev/sndstat` to find out which output is used by default.


----------



## joachin (Aug 28, 2017)

Thanks for your answer, when I do:

```
cat /dev/random > /dev/dsp.1.0 it says: /dev/dsp.1.0 no operation supported

Installed devices:
pcm0: <Realtek ALC255 (Internal Analog)> (play/rec) default
pcm1: <Realtek ALC255 (Front Analog Headphones)> (play)
pcm2: <Intel (0x2883) (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```
When I connect the headphones says:

```
Installed devices:
pcm0: <Realtek ALC255 (Internal Analog)> (play/rec) 
pcm1: <Realtek ALC255 (Front Analog Headphones)> (play) default
pcm2: <Intel (0x2883) (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```


----------



## k.jacker (Aug 28, 2017)

Hei joachin,
That's weird...


joachin said:


> cat /dev/random > /dev/dsp.1.0 it says: /dev/dsp.1.0 no operation supported



Could you please set `sysctl hw.snd.verbose=2` and then post the output from `cat /dev/sndstat` and `ls -F /dev/|grep dsp`.


----------



## joachin (Aug 28, 2017)

ok the first one:

FreeBSD Audio Driver (64bit 2009061500/amd64)
Installed devices:
pcm0: <Realtek ALC255 (Internal Analog)> on hdaa0  (1p:1v/1r:1v) default
   snddev flags=0x2e2<AUTOVCHAN,BUSY,MPSAFE,REGISTERED,VPC>
   [pcm0lay:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
   interrupts 0, underruns 0, feed 0, ready 0 [b:4096/2048/2|bs:4096/2048/2]
   channel flags=0x2100<BUSY,HAS_VCHAN>
   {userland} -> feeder_mixer(0x00200010) -> {hardware}
   pcm0lay:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
   interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:65536/2048/32]
   channel flags=0x10000000<VIRTUAL>
   {userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> feeder_rate(0x00200010 q:4 44100 -> 48000) -> {hardware}
   [pcm0:record:dsp0.r0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000005
   interrupts 2, overruns 0, feed 4, hfree 4096, sfree 4096 [b:4096/2048/2|bs:4096/2048/2]
   channel flags=0x2100<BUSY,HAS_VCHAN>
   {hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {userland}
   pcm0:record:dsp0.r0[pcm0:virtual:dsp0.vr0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
   interrupts 0, overruns 0, feed 0, hfree 0, sfree 65536 [b:0/0/0|bs:65536/2048/32]
   channel flags=0x10000000<VIRTUAL>
   {hardware} -> feeder_root(0x00200010) -> feeder_rate(0x00200010 q:4 48000 -> 44100) -> feeder_volume(0x00200010) -> {userland}
pcm1: <Realtek ALC255 (Front Analog Headphones)> on hdaa0  (1p:1v/0r:0v)
   snddev flags=0x2e3<SIMPLEX,AUTOVCHAN,BUSY,MPSAFE,REGISTERED,VPC>
   [pcm1lay:dsp1.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
   interrupts 1, underruns 0, feed 1, ready 0 [b:4096/2048/2|bs:4096/2048/2]
   channel flags=0x2100<BUSY,HAS_VCHAN>
   {userland} -> feeder_mixer(0x00200010) -> {hardware}
   pcm1lay:dsp1.p0[pcm1:virtual:dsp1.vp0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
   interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:65536/2048/32]
   channel flags=0x10000000<VIRTUAL>
   {userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> feeder_rate(0x00200010 q:4 44100 -> 48000) -> {hardware}
pcm2: <Intel (0x2883) (HDMI/DP 8ch)> on hdaa1  (1p:1v/0r:0v)
   snddev flags=0x2e7<SIMPLEX,AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
   [pcm2lay:dsp2.p0]: spd 48000, fmt 0x00200010, flags 0x00006100, 0x00000004
   interrupts 0, underruns 0, feed 0, ready 0 [b:4096/2048/2|bs:4096/2048/2]
   channel flags=0x6100<BUSY,HAS_VCHAN,VCHAN_PASSTHROUGH>
   {userland} -> feeder_mixer(0x00200010) -> {hardware}
   pcm2lay:dsp2.p0[pcm2:virtual:dsp2.vp0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
   interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:65536/2048/32]
   channel flags=0x10000000<VIRTUAL>
   {userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> feeder_rate(0x00200010 q:4 44100 -> 48000) -> {hardware}
No devices installed from userspace.

The second one:

ls -F /dev/|grep dsp
dsp0.0
dsp0.1
dsp1.1
dsp2.1


----------



## tobik@ (Aug 28, 2017)

joachin said:


> Thanks for your answer, when I do:
> 
> ```
> cat /dev/random > /dev/dsp.1.0 it says: /dev/dsp.1.0 no operation supported
> ```


Is /dev/dsp.1.0 a typo? What happens when you run `cat /dev/random > /dev/dsp1`?


----------



## joachin (Aug 28, 2017)

It says:

cat: stdout: Invalid argument


----------



## k.jacker (Aug 28, 2017)

tobik@ thanks for pointing that out. Didn't see that and was a little confused. yes, is was I typo... 

Hei, joachin,
Thanks for posting the output.
Try `cat /dev/random > /dev/dsp1.1` with your headphones connected. That should produce noise on your headphones.
Then `cat /dev/random > /dev/dsp0.0`  (or dsp0.1) should give you noise from your speakers. The errors from your first post don't seem to be there any more. Looks good from /dev/sndstat you postet. 

When you hear the noise on your headphones and hopefully on your speakers, too, you could proceed installing a simple audio player like mpg321.
(easier to troubleshout sound with a player that got no brains).
Then try playing something with `mpg321 [I]youraudiotrack.mp3[/I]`


----------



## joachin (Aug 28, 2017)

I can't do it, it says: cat: stdout: Invalid argument, in both (speakers and headphones).


----------



## k.jacker (Aug 28, 2017)

I think your terminal is confused. Could you log out and in again and try again...?
You could try as root as well, even though it's usually not neccessary.


----------



## joachin (Aug 28, 2017)

I rebooted, logout, did it like user and root and have the same problem, I will going back to linux, thanks for your help guys!


----------



## Deleted member 9563 (Aug 28, 2017)

Saying "I installed FreeBSD" is a bit vague. My feeling is that there's some assumption that's not declared.


----------

