forwarding audio from a (bhyve) vm
Greg Veldman
freebsd at gregv.net
Fri Jul 24 15:49:51 UTC 2020
On Wed, Jul 22, 2020 at 05:50:31PM -0700, Russell L. Carter wrote:
> sndio, if it can be made to work, also appears perfect. In summary, I
> want to run multiple vm's in a Facebook cast-off server that has 32
> threads and 128GB of memory... but no audio hardware. Adding the hda
> device to bhyve doesn't seem to work, I am guessing, because there is
> no physical audio hw in the bhyve host.
This certainly sounds like a use case for sndio. FYI my use
case is passing audio from various bhyve VMs to my desktop
system, as needed.
> The latest tarball of sndio compiles and installs cleanly on ancienne
> Debian 9. But what about sound devices?
I'm not sure exactly how to set this up on Debian, I've only
ever run sndiod in server mode on FreeBSD. There, it was as
simple as setting a few flags in my rc.conf (see previous post).
> A couple of questions inline, if possible:
Further responses also inline.
> On 2020-07-20 19:27, Greg Veldman wrote:
> > On Mon, Jul 20, 2020 at 04:00:22PM -0700, Russell L. Carter wrote:
> >> On 2020-07-20 15:06, Russell L. Carter wrote:
> >>> Seren looks perfect.?? However it uses alsa to access the "sound card",
> >>> which I see from googling should be achievable in a bhyve vm by
> >>> configuring the HDA emulation. Evidently, after consulting
> >>> https://wiki.freebsd.org/SummerOfCode2016/HDAudioEmulationForBhyve
> >>> and
> >>>
> https://forums.freebsd.org/threads/what-is-the-current-status-of-audio-emulation-in-bhyve.74557/
> >>>
> >>>
> >>> I should be able to achieve this using vm-bhyve by setting
> >>>
> >>> bhyve_options="-s 9,hda,play=/dev/dsp1,rec=/dev/dsp1"
> >>>
> >>> in the vm template file.
> >>
> >> Oh well, the vm fails to start with this template configuration.
> >> I am not sure how to fix it. There is only one vm running, so
> >> I don't think bhyve should be running out of slots/devices.
> >> There is no audio hardware in the bhyve host... is that a
> >> problem? I don't want to listen on the bhyve host, I want to
> >> ship the audio over the physical network to another FreeBSD
> >> system.
> >>
> >> Both the bhyve host and the target system are running FreeBSD
> >> 12/stable from the beginning of July.
> >
> > I currently do this with some of my systems, I use sndio and
> > have had no issues at all. My current setup is all FreeBSD
> > hosts, but sndio runs on GNU/Linux and NetBSD, OpenBSD (in
> > fact it's originally from OpenBSD I believe).
> >
> > On the host you wish to send the audio from:
> >
> > $ grep -i audio .bashrc
> > export AUDIODEVICE="snd at 10.0.2.1/0"
>
> You don't need to start sndiod on the audio server
> system for the client system to connect?
Yes, you do, but that is the only place you need to start the
daemon. In my example, the lines above are on the client, the
lines below are from the audio server (my FreeBSD desktop box).
On the client, all you need to do is set the environment variable
with the location of the sndiod server, then any sndio-aware
application will forward the audio over the network to that
address.
> > On the host you wish to hear the audio on:
> >
> > $ grep -i sndio /etc/rc.conf
> > sndiod_enable="YES"
> > sndiod_dev="rsnd/$($SYSCTL -n hw.snd.default_unit)"
> > sndiod_flags="-f ${sndiod_dev} -c 0:7 -j off -s default -m mon -s
> > monitor -L 10.0.2.1"
>
> That looks very good. My target system has a non-default "default".
Yes, I also had to explicitly set mine, that's the sysctl.conf
snippet below.
> > $ grep -i snd /etc/sysctl.conf
> > # Default sound device (from /dev/sndstat)
> > hw.snd.default_unit=2
> >
> > See the sndio(7) manpage for setting up the cookie on both
> > hosts to handle authentication.
> >
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
--
Greg Veldman
freebsd at gregv.net
More information about the freebsd-questions
mailing list