bhyve How to enable the audio emulation with vm-bhyve

Hello.

I'm trying to emulate the audio using vm-bhyve /and not bhyve,because it does not fully work for me/ ; and I've found this post that I think can be useful :

https://forums.freebsd.org/threads/what-is-the-current-status-of-audio-emulation-in-bhyve.74557/

The part that I find interesting is the following :
HD sound works perfectly fine in bhyve and sound quality is as good as the host in my case.You need commit 349335 and 350255 from FreeBSD head, you can get them at the following links: patch1 and patch2. Alternatively, you can get them by using svn
Code:
$ cd $HOME
$ svn co [URL='https://svn.freebsd.org/base/head?fbclid=IwAR2jnDhjWiBtWMX2wBOAe0j_c8VDac9SgByilAFe8ERpm2aGSm5YTFEGLD8']https://svn.FreeBSD.org/base/head[/URL] freebsd-head
$ cd freebsd-head
$ svn diff -c 349335 > patch1.diff
$ svn diff -c 350255 > patch2.diff
Then apply those patches to /usr/src/usr.sbin/bhyve.
Code:
# cd /usr/src/usr.sbin/bhyve
# patch -Np2 -i $HOME/freebsd-head/patch1.diff
# patch -Np2 -i $HOME/freebsd-head/patch2.diff
# make
# make install
Then choose which dsp you want to use for play and rec

-s 6,hda,play=/dev/dsp0,rec=/dev/dsp0

I'm even using it at dsp2 (HDMI output) and it works perfectly fine. I use it mostly for my Linux guest for running google chrome in order to be able to use a proprietary web conferecing used by my company.

I would like to make an experiment. Without patching bhyve,I would like to check if this parameter -s 6,hda,play=/dev/dsp0,rec=/dev/dsp0 is able to enable the audio on the emulated Ubuntu. Now the problem is that, as I said, I can't use bhyve because there is something that is not working for me when I use it (the linux vm can't connect to internet: I've asked help but no one has been able at the moment to understand why), so there is only one thing that I can do: to use vm-bhyve and find the way to add the parameters -s 6,hda,play=/dev/dsp0,rec=/dev/dsp0 to the conf file. But how? I'm pretty sure that this vm-bhyve conf file will not work :

Code:
loader="uefi"
cpu=8
memory=8GB
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="ubuntu-budgie-gpu.img"
uuid="ca6be87e-eed2-11eb-abbb-e0d55ee21f22"
network0_mac="58:9c:fc:0a:b1:92"
graphics="yes"
graphics_res="1440x900"
xhci_mouse="yes"
-s 6,hda,play=/dev/dsp0,rec=/dev/dsp0

I've looked inside the vm-bhyve config file "config.sample", to check if there is a trigger that I can activate to enable the audio with all the parameters needed. But I didn't find it.
 
yes. I know that vm-bhyve is a bhyve wrapper. But for some reason if I use bhyve my ubuntu virtual machine can't connect to internet. But it does if I use vm-bhyve. So,I need to find the way to add the sound parameters to vm-bhyve. I think that I've found how. I have used this conf file,but it does not work,the vm does not boot :

Code:
loader="uefi"

cpu=8

memory=8GB

network0_type="virtio-net"

network0_switch="public"

disk0_type="virtio-blk"

disk0_name="ubuntu-budgie-gpu.img"

uuid="ca6be87e-eed2-11eb-abbb-e0d55ee21f22"

network0_mac="58:9c:fc:0a:b1:92"

graphics="yes"

graphics_res="1440x900"

xhci_mouse="yes"

bhyve_options="-s 6,hda,play=/dev/dsp,rec=/dev/dsp"

I don't know why it does not boot. Should I apply the patch ? I'm running freebsd 13.
 
No, no, I told you the patch was needed long before 13.0 became a RELEASE. Forget about it now.
Sound will only work THIS WAY if you connect via VNC. If you connect via RDP you don't get sound this way.
 
old post. it works adding this line bhyve_options="-s 20,hda,play=/dev/dsp8,rec=/dev/dsp8". It didn't work because the slot 6 was occupied,but vm-bhyve does not tell this,so you aren't sure what to do.
 
Back
Top