# FreeBSD 13.0 HDMI audio slow motion



## herbertpfp (Feb 24, 2021)

Good morning, I have a stable FreeBSD 13.0 and I am very happy with my operating system that I met in October 2020 when my PC was very slow because the computer's battery was (dead) going into Powersave mode (at the time I didn't know it existed, my computer was very slow and I looked for a more efficient system. Some time later, I found out that I could change the processor governor and the computer become fast again, but I was fall in love with FreeBSD, that's uses Powerd). I looked for other operating system and saw one that was very interesting, FreeBSD, although people don't use it as the day-to-day operating system and youtube videos mostly just install on virtual machines. It is amazing to build your own operating system in every detail. Everyone who knows my operating system is delighted: it has an XFCE4 environment, it has XScreensaver, free games, a printer, folders and videos open faster than the blink of an eye, mount a USB stick, ext4 external disk and even the shared Iphone folders (I couldn't get the pictures folder).
But something bothers me a lot, which is that the audio doesn't work properly, in this case, only the HDMI audio, which works, but the audio is in slow motion, I've been trying to fix it for months. I know that there are several very cheap alternatives like buying a speaker via cable or even Bluetooth, or, even buying devices that combine HDMI and audio. I am unemployed, no matter how cheap I can't spend on anything. When I worked, I was a teacher (chemistry) and to transport a speaker for 40 people to listen quality audio is difficult because we already carry a lot of material. 
As an alternative to unemployment I would like very much to format computers (R$ 100.00 = US$ 20.00 each), but I want to install only FreeBSD because of the impressive speed of this system that never crashes, but it is difficult to sell something that sin in any detail. Without Netflix you can still try to convince, but without perfect audio, I missed 6 opportunities because of this defect.
In short: The audio works well, except HDMI (/dev/dsp0) which works in slow motion. My sound card is Broadwell. The best driver I tested was pulse audio (songs in flac format are in slow motion with other drivers even for /dev/dsp3 (internal) or /dev/dsp4 (headphones)). 

There is my `cat /dev/sndstat`:

```
Installed devices:
pcm0: <Intel Broadwell (HDMI/DP 8ch)> (play) default
pcm1: <Intel Broadwell (HDMI/DP 8ch)> (play)
pcm2: <Intel Broadwell (HDMI/DP 8ch)> (play)
pcm3: <Realtek ALC255 (Internal Analog)> (play/rec)
pcm4: <Realtek ALC255 (Front Analog Headphones)> (play)
No devices installed from userspace.
```
There is my /etc/rc.conf:

```
oss_enable="YES" 
pulseaudio_enable="YES"
sndiod_enable="YES"
sndiod_flags="-a on"
linux_enable="YES"
linux64_enable="YES"
jackd_enable="YES"
jackd_user="herbert"
jackd_rtprio="YES"
jackd_args="-r -d oss -r48000 -p1024 -n3 -w16 -o8 \
                  --capture /dev/dsp3 --playback /dev/dsp4"
```
And finally, there is my /etc/sysctl.conf:

```
debug.debugger_on_panic=0
hw.snd.default_unit=0
vfs.usermount=1
hw.snd.vpc_0db=45
hw.snd.vpc_mixer_bypass=1
hw.snd.latency=4
hw.snd.feeder_rate_quality=2
hw.snd.maxautovchans=2
hw.snd.vpc_autoreset=0
hw.syscons.bell=0
```
I would like to thank the FreeBSD community, which is small but very welcoming.


----------



## Alexander88207 (Feb 24, 2021)

Hello herbertpfp,

nice to see that you are happy about FreeBSD.

To narrow down the problem more: Can you also confirm this problem if only the base sound system is in use? (No jack, pulseaudio etc.. and testing sound with apps that do use OSS like mpv, firefox etc..)

BTW: I dont know if you know it already but 
	
	



```
oss_enable="YES"
```
 is for audio/oss which is an different implementation. FreeBSD uses OSS in the base and the other thing is OSSv4.

From package description:


> "Not to be confused with sound(4)() which is a different implementation with the same API."


----------



## herbertpfp (Feb 25, 2021)

Alexander88207 said:


> Hello herbertpfp,
> 
> nice to see that you are happy about FreeBSD.
> 
> ...


Yes, I've already tested this and all the possible combinations rebooting my Machine and sometimes causing strong songs and crashes. OSS_Enable causes a kernel warning, that the message is that I need to build a custon Kernel. I migrate from FreeBSD 13 alpha2 to the stable version via github, but I don 't know why I generate a custon kernel (without the sound), if you know where I can find this information, I not tested yet.


----------



## Alexander88207 (Feb 25, 2021)

herbertpfp said:


> if you know where I can find this information











						Chapter 9. Configuring the FreeBSD Kernel
					

This chapter covers how to configure the FreeBSD Kernel. When to build a custom kernel, how to take a hardware inventory, how to customize a kernel configuration file, etc




					docs.freebsd.org


----------



## herbertpfp (Feb 25, 2021)

I will return to say if it's worked or not, I have a lot of fear to compile a kernel. Thank you!


----------



## tyson (Feb 25, 2021)

Compiling FreeBSD kernel is nothing compared to linux kernel configuration madness. Its pure joy. Also easiest configs can be made by just including GENERIC and undefining options.


----------



## wolffnx (Feb 25, 2021)

Welcome  herbertpfp
a pair of things,that may be help you
one, (first make a backup of the files that modified)

1) remove everything relating to 
	
	



```
hw.snd
```
 except 
	
	



```
hw.snd.default_unit=0
```

2) leave rc.conf like this


```
oss_enable="YES"
linux_enable="YES"
linux64_enable="YES"
```

for now lets focus on OSS

3) the slow sound is like the "too fast" device rate configuration
    add to your sysctl.conf


```
dev.pcm.0.play.vchanrate=44100
```

reboot and see what happen with for example audacious playing a song,etc

*and remember , before modify anything make backups of the files*

good luck!!!

I forgot, for compiling the kernel just place it in /usr/src
and run

```
make clean
make buildkernel KERNCONF=GENERIC
make installkernel KERNCONF=GENERIC
```
and reboot


----------



## herbertpfp (Feb 25, 2021)

wolffnx said:


> Welcome  herbertpfp
> a pair of things,that may be help you
> one, (first make a backup of the files that modified)
> 
> ...


Thank you a lot!!!! The user manual is too orientated to the developer, it's a week to me to understand. Preparing myself to do this operation for the first time without backup 1Tb of information.


----------



## herbertpfp (Feb 25, 2021)

tyson said:


> Compiling FreeBSD kernel is nothing compared to linux kernel configuration madness. Its pure joy. Also easiest configs can be made by just including GENERIC and undefining options.


I only need to undefine audio.


----------



## wolffnx (Feb 25, 2021)

herbertpfp said:


> Thank you a lot!!!! The user manual is too orientated to the developer, it's a week to me to understand. Preparing myself to do this operation for the first time without backup 1Tb of information.


maybe,but there is a lot of sources on google, dont worry, one thing take you to another and before notice your journey begin (sounds like a hobbit movie   )


----------



## herbertpfp (Feb 25, 2021)

Since I'm going to get my hands to risk my system terribly, I thought of two scenarios: 

1) Standard /compat/linux settings that everyone in the FreeBSD uses which is to call in /etc/fstab: 

#Device Mountpont FStype Options Dump Pass
fdesc              /dev/fd                      fdescfs         rw                   0       0
proc               /proc                          procfs          rw                   0       0
linprocfs        /compat/linux/proc     linprocfs      rw,late            0       0
linsysfs         /compat/linux/sys       linsysfs        rw,late            0       0



2) Take a risk and bring a bit by bit copy of an Ubuntu 20.04 LTS totally updated and with all the programs compiled from the github repository, a show that everything works. However, it is known that all GUI interface programs (except synaptic) do not go up (systemd is not mounted). You can install any program via synaptic or apt-get or binary .deb (or use alien to convert RPM packages). Compiling on the basis of Cmake I was not able to native on FreeBSD (even less inside a virtual machine). Follows the required configuration in /etc/fstab: 

#Device      Mountpont                          FStype   Options                                  Dump  Pass
fdesc          /dev/fd                                 fdescfs     rw                                             0       0
proc            /proc                                    procfs      rw                                             0       0
devfs          /compat/linux_her/dev         devfs       rw,late                                      0       0
tmpfs         /compat/linux_her/dev/shm  tmpfs      rw,late,size=1g,mode=1777    0       0
fdescfs       /compat/linux_her/dev/fd     fdescfs    rw,late,linrdlnk                          0       0
/tmp          /compat/linux_her/tmp         nullfs       rw,late                                       0       0
/home        /compat/linux_her/home     nullfs       rw,late                                        0       0

Which of the two options do you suggest me to try?


----------



## wolffnx (Feb 25, 2021)

none of both, a good backup and fresh FreeBSD install, but is just me, I am closer to be purist in my system
I dont want to mix the Linux compatibility layer with Freebsd
but here there is a lot of users that make amazing thinks mixing the 2 worlds and make Linux application run on FreeBSD


----------



## herbertpfp (Feb 25, 2021)

PS: the second scenario gives me the opportunity to put the original module from intel video driver, because mine on FreeBSD complains about loss of power on boot, and it 's true: with Ubuntu my machine was able to have an HDMI conexion to transmit a virtual class, FreeBSD freezes only in this situation, and, in addition, the app on internet is heavier than the binary .deb app


----------



## herbertpfp (Feb 25, 2021)

wolffnx said:


> none of both, a good backup and fresh FreeBSD install, but is just me, I am closer to be purist in my system
> I dont want to mix the Linux compatibility layer with Freebsd
> but here there is a lot of users that make amazing thinks mixing the 2 worlds and make Linux application run on FreeBSD


We need a copy of wine with WOW64 too...


----------



## herbertpfp (Feb 25, 2021)

wolffnx said:


> none of both, a good backup and fresh FreeBSD install, but is just me, I am closer to be purist in my system
> I dont want to mix the Linux compatibility layer with Freebsd
> but here there is a lot of users that make amazing thinks mixing the 2 worlds and make Linux application run on FreeBSD


I agree with you, the important is my sound working fine. I use a copy of virtualbox everytime inside the startx to have 200Mb more memory than in startxfce4 and use a full upgraded win10 with about 2Gb of ram and the speed is good.


----------



## debguy (Feb 26, 2021)

I run freeBSD raw - no emulation.  I haven't had time to install sound.  I use my remote to switch my Sony X80H from HDMI1 to built-in Google Smart Android TV to watch TV or do Google Play things.  I wonder how many will be seeking "easy up and running multimedia" for freeBSD in the future, when pressing "HDMI2" solves all the media needs.

Audio HDMI compatibility is nothing minor.  It's IEEE stuff - there are many HDMI out there and they are all "machines".  The specifications are very deep.

Your trying to get HDMI working in a virtual box.  I think that's "not fair to expect freeBSD to do".  You are using a linux based virtual machine if I understand correctly.  That's a linux question for QEMU, if that is the VM your using.  QEMU has "drivers" which pass (or perhaps block) hardware information going from your linux emulated sound driver (which very likely doesn't support HDMI audio totally) and passes that to Microsoft windows QEMU, which again doesn't totally support HDMI to Windows to (perhaps your video card, which again may flub HDMI audio in some video formats or when talking to a broken request not completely IEEE compliant).

In short.  I would try what these people are saying to do not ignore them.  But your time is better spent getting something that does work

Now, intracting a "windows has audio ergo it has no probles", well, my Windows 10  continually updates and has root consoles opening when I'm working ... And I don't like Disney icons.  Let's not start with whether a platform which has drivers is "the winner of end all".


----------



## herbertpfp (Feb 26, 2021)

debguy said:


> I run freeBSD raw - no emulation.  I haven't had time to install sound.  I use my remote to switch my Sony X80H from HDMI1 to built-in Google Smart Android TV to watch TV or do Google Play things.  I wonder how many will be seeking "easy up and running multimedia" for freeBSD in the future, when pressing "HDMI2" solves all the media needs.
> 
> Audio HDMI compatibility is nothing minor.  It's IEEE stuff - there are many HDMI out there and they are all "machines".  The specifications are very deep.
> 
> ...





debguy said:


> I run freeBSD raw - no emulation.  I haven't had time to install sound.  I use my remote to switch my Sony X80H from HDMI1 to built-in Google Smart Android TV to watch TV or do Google Play things.  I wonder how many will be seeking "easy up and running multimedia" for freeBSD in the future, when pressing "HDMI2" solves all the media needs.
> 
> Audio HDMI compatibility is nothing minor.  It's IEEE stuff - there are many HDMI out there and they are all "machines".  The specifications are very deep.
> 
> ...


I'm not inside a virtual box, quite the contrary, I'm making FreeBSD my system, which even runs windows inside a virtual box and that can even format a pen drive or start the webcam. Sorry if my English is not clear. 

I prefer it with minimal emulation, like you, but windows binaries are always needed to work in almost any company. I am still taking courage to install this custom kernel, but I believe it is a conflict problem, and that disabling the conflict will transmit perfect audio. Here at home I turn on my computer to a 1990s sound with 4 speakers and four small horns, or the analog sound of my old TV with VGA input. But when I teach, the class cannot remotely drop, it loses recording, and live I need the television in the classroom to release audio, you can't load a device that generates sound for a room with 40 students, cause you carry books, dyaries, tests, HDMI cable.


----------



## herbertpfp (Mar 1, 2021)

Thank you very much wolffnx, Alexander88207, Debguy and tyson. I finally compiled a new kenel, but with no effect. When the sound module is uninstalled, no other module can be installed. Removing all modules is an option that compiles, however, no audio mixer is available, so there is no sound. Then OSS_enable continue genarating conflict. I didn't get HDMI audio working 100%.


----------



## tyson (Mar 1, 2021)

I did read this thread once again. My main language isn't English, but looks like herbertpfp isn't too, but i think we will find common ground.
FreeBSD is not Linux. It don't need any 'outside' tools to have sound. So OSS from ports is not needed, and i think its so old implementation it wouldn't work good for you anyway.
Pulseaudio - its another layer of adding complexity/bugs which isn't really needed if your program support oss (FreeBSD integrated one of course).
Please explain your use case with apps you use to play audio, your hardware, etc.

PS. About installing kernel- did you use same src as your machine is running atm.? For example is it 13-BETA3 with this sources installed in /usr/src? Did u run `make buildkernel KERNCONF=yourconfig` when yourconfig is placed in /usr/src/sys/*ARCH*/conf/ than installing it with `make installkernel KERNCONF=yourconfig`?
PS2. Of course none of above shouldnt be needed, if you just use build-in OSS.


----------



## wolffnx (Mar 1, 2021)

like tyson  I see the post again and again..until I got it
you shoud have sound with a fresh install of FreeBSD , with OSS and without compile nothing

only change the default sound output to hdmi , to my setup only 2 steps:

1)identify the output number 

```
# cat /dev/sndstat

Installed devices:
pcm0: <NVIDIA GTX550 (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA GTX550 (HDMI/DP 8ch)> (play) default
pcm2: <NVIDIA GTX550 (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA GTX550 (HDMI/DP 8ch)> (play)
pcm4: <Realtek ALC887 (Rear Analog)> (play/rec)
pcm5: <Realtek ALC887 (Front Analog)> (play/rec)
No devices installed from userspace.
```

2)make the number 2 in this case the default output


```
hw.snd.default_auto=0
hw.snd.default_unit=1
dev.pcm.1.play.vchanrate=44100 #for the "sound playing too fast"
```

reboot if you want


----------



## herbertpfp (Mar 1, 2021)

tyson said:


> I did read this thread once again. My main language isn't English, but looks like herbertpfp isn't too, but i think we will find common ground.
> FreeBSD is not Linux. It don't need any 'outside' tools to have sound. So OSS from ports is not needed, and i think its so old implementation it wouldn't work good for you anyway.
> Pulseaudio - its another layer of adding complexity/bugs which isn't really needed if your program support oss (FreeBSD integrated one of course).
> Please explain your use case with apps you use to play audio, your hardware, etc.
> ...


So Tyson, my use of HDMI audio would be to show recordings of chemistry experiments in the classroom, or even, in remote classes by the computer. Remote classes are also a problem, which unfortunately, because there are no binaries for the Zoom and Teams programs, they run very poorly by the browser. And to make the row call of the students I used a Microsoft Program emulated by wine (not possible at FreeBSD).

I entered the folder /usr/src/sys/amd64/conf and copy the generic Kernel using sudo cp -r GENERIC ALANA, and edited the file:
# Sound support
device           sound                   # Generic sound driver (required)
#device         snd_cmi               # CMedia CMI8338/CMI8738
#device         snd_csa               # Crystal Semiconductor CS461x/428x
#device         snd_emu10kx      # Creative SoundBlaster Live! and Audigy
#device         snd_es137x         # Ensoniq AudioPCI ES137x
device           snd_hda               # Intel High Definition Audio
#device         snd_ich                # Intel, NVidia and other ICH AC'97 Audio
#device         snd_via8233        # VIA VT8233x Audio

Then I ran the following commands in /usr/src:
make clean
make buildkernel KERNCONF=ALANA
make installkernel KERNCONF=ALANA

If I comment device sound, the kernel warning disappears, but I can't install device snd_hda and I have no mixer and no sound. I must install them.

I liked FreeBSD a lot, but when it comes to work it may be difficult for what I need. I need the computer not to crash while taking online classes, audio and video work well. Compatibility with an version of wine with WOW 64.

PS. My kernel version was updated to stable version 13.0 two weeks ago via github.


----------



## herbertpfp (Mar 1, 2021)

wolffnx said:


> like tyson  I see the post again and again..until I got it
> you shoud have sound with a fresh install of FreeBSD , with OSS and without compile nothing
> 
> only change the default sound output to hdmi , to my setup only 2 steps:
> ...


My audio is too slow, I tried vchanrate 44100, 48000, 96000 and 192000, no effect.


----------



## tyson (Mar 1, 2021)

herbertpfp said:


> So Tyson, my use of HDMI audio would be to show recordings of chemistry experiments in the classroom, or even, in remote classes by the computer. Remote classes are also a problem, which unfortunately, because there are no binaries for the Zoom and Teams programs, they run very poorly by the browser. And to make the row call of the students I used a Microsoft Program emulated by wine (not possible at FreeBSD).
> 
> I entered the folder /usr/src/sys/amd64/conf and copy the generic Kernel using sudo cp -r GENERIC ALANA, and edited the file:
> # Sound support
> ...



Did you reboot after that ? Try commenting both sound and snd_hda entries, than rebuild, install, reboot with new kernel.
Next step would be install audio/oss to test, than enable oss service.
Try it with `service oss onestart` after you install that port.


----------



## herbertpfp (Mar 1, 2021)

tyson said:


> Did you reboot after that ? Try commenting both sound and snd_hda entries, than rebuild, install, reboot with new kernel.
> Next step would be install audio/oss to test, than enable oss service.
> Try it with `service oss onestart` after you install that port.


I tried without sound and snd_hda, the problem is that without snd_hda I have no mixer and no sound (I use DSB mixer and TrueOs mixer to change the channel, but I can also edit on /etc/sysctl). I already have audio/oss installed (and some linux-c7 ports too) and  oss_enable on /etc/rc.conf. I will do again the kernel, and reinstall audio/oss, but before, any other idea?


----------



## tyson (Mar 1, 2021)

Sorry man. I had to move my TV(good its only 32'') to be sure this thing is working good. Works perfectly fine here.
/dev/sndstat

```
Installed devices:
pcm0: <NVIDIA (0x0084) (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA (0x0084) (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA (0x0084) (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA (0x0084) (HDMI/DP 8ch)> (play)
pcm4: <Realtek ALC889 (Analog 7.1+HP/2.0)> (play/rec)
pcm5: <Realtek ALC889 (Rear Digital)> (play)
pcm6: <Realtek ALC889 (Onboard Digital)> (play)
pcm7: <Realtek ALC889 (Front Analog Mic)> (rec)
pcm8: <Intel Cougar Point (HDMI/DP 8ch)> (play)
pcm9: <Intel Cougar Point (HDMI/DP 8ch)> (play) default
No devices installed from userspace.
```
`kldstat` output: snd_hda built into kernel, little stripped GENERIC config.

```
Id Refs Address                Size Name
1  114 0xffffffff80200000  100d168 kernel
2    1 0xffffffff8120e000     8470 ipfw_nat.ko
3    2 0xffffffff81217000    4bdf8 ipfw.ko
4    2 0xffffffff81263000    15f48 libalias.ko
5    1 0xffffffff8127a000     ae38 cryptodev.ko
6    1 0xffffffff81285000   67eb80 zfs.ko
7    1 0xffffffff81e10000     c940 geom_eli.ko
8    1 0xffffffff81e1d000     639c linprocfs.ko
9    6 0xffffffff81e24000     db70 linux_common.ko
10    1 0xffffffff81e32000     3284 linsysfs.ko
11    1 0xffffffff81e36000   10b310 nvidia-modeset.ko
12    1 0xffffffff82000000  1e7b3c8 nvidia.ko
13    2 0xffffffff81f42000    388f8 linux.ko
14    1 0xffffffff81f7b000     39e8 sem.ko
15    1 0xffffffff81f7f000     20f0 coretemp.ko
16    1 0xffffffff81f82000     4700 nullfs.ko
17    1 0xffffffff83e7c000   157458 i915kms.ko
18    1 0xffffffff83fd4000    7f4c8 drm.ko
19    2 0xffffffff81f87000     c748 agp.ko
20    2 0xffffffff81f94000     cbc8 linuxkpi_gplv2.ko
21    2 0xffffffff81fa1000     2328 lindebugfs.ko
22    1 0xffffffff81fa4000     3378 acpi_wmi.ko
23    1 0xffffffff81fa8000     3250 ichsmb.ko
24    1 0xffffffff81fac000     2180 smbus.ko
25    1 0xffffffff81faf000     2340 uhid.ko
26    1 0xffffffff81fb2000     4350 ums.ko
27    1 0xffffffff81fb7000     3380 usbhid.ko
28    1 0xffffffff81fbb000     31f8 hidbus.ko
29    1 0xffffffff81fbf000    30ac8 linux64.ko
30    1 0xffffffff81ff0000     2260 pty.ko
31    1 0xffffffff81ff3000     3530 fdescfs.ko
32    1 0xffffffff81ff7000     2a08 mac_ntpd.ko
```
Version (ofc its not stable yet but something like BETA3)

```
FreeBSD 13.0-STABLE #0 stable/13-2947fc2cc: Wed Feb 24 15:03:24 CET 2021     root@kowalczt.ddns.net:/usr/obj/usr/src/amd64.amd64/sys/tyson-13-stable
```

I had to install graphics/drm-kmod to get it working tho, as my main display device is NVIDIA.
No need for fancy mixers, just did some multimedia/mpv test and it worked fine, my cpu is ivybridge i7-3770.


----------



## herbertpfp (Mar 3, 2021)

I reinstalled the kernel without the sound module and intel, but the audio is muted. It may be because my drm-kmod shows a warning told me an error and that performance will suffer. My video driver is intel onboard and uses 256Mb from RAM.


----------

