The beauty of all this is to be able to participate in figuring out how to do it yourself.
You may have QEMU installed on your system. Incus however has its own installation of QEMU. We need to figure out the devices and audio systems of QEMU by Incus.
$ incus create images:ubuntu/24.04/cloud --vm sound
Creating sound
$ incus config set sound raw.qemu -- "-device INVALID"
user@user-desktop:~$ incus start sound
Error: Failed to run: forklimits limit=memlock:unlimited:unlimited fd=3 fd=4 -- /opt/incus/bin/qemu-system-x86_64 -S -name sound -uuid 8fb0ac18-2b61-4423-89e8-38af6c7aec13 -daemonize -cpu host,hv_passthrough -nographic -serial chardev:console -nodefaults -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=allow,resourcecontrol=deny -readconfig /run/incus/sound/qemu.conf -spice unix=on,disable-ticketing=on,addr=/run/incus/sound/qemu.spice -pidfile /run/incus/sound/qemu.pid -D /var/log/incus/sound/qemu.log -smbios type=2,manufacturer=LinuxContainers,product=Incus -runas incus -device INVALID: : exit status 1
Try `incus info --show-log sound` for more info
$
Up to now we have created a Linux VM for our tests, and we put some invalid parameter in order to obtain the command line for the QEMU package by Incus. We can now run -device help to get a list of all emulated sound devices.
$ sudo /opt/incus/bin/qemu-system-x86_64 -S -name sound -uuid 8fb0ac18-2b61-4423-89e8-38af6c7aec13 -daemonize -cpu host,hv_passthrough -nographic -serial chardev:console -nodefaults -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=allow,resourcecontrol=deny -readconfig /run/incus/sound/qemu.conf -spice unix=on,disable-ticketing=on,addr=/run/incus/sound/qemu.spice -pidfile /run/incus/sound/qemu.pid -D /var/log/incus/sound/qemu.log -smbios type=2,manufacturer=LinuxContainers,product=Incus -runas incus -device help
...
Sound devices:
name "AC97", bus PCI, alias "ac97", desc "Intel 82801AA AC97 Audio"
name "adlib", bus ISA, desc "Yamaha YM3812 (OPL2)"
name "cs4231a", bus ISA, desc "Crystal Semiconductor CS4231A"
name "ES1370", bus PCI, alias "es1370", desc "ENSONIQ AudioPCI ES1370"
name "gus", bus ISA, desc "Gravis Ultrasound GF1"
name "hda-duplex", bus HDA, desc "HDA Audio Codec, duplex (line-out, line-in)"
name "hda-micro", bus HDA, desc "HDA Audio Codec, duplex (speaker, microphone)"
name "hda-output", bus HDA, desc "HDA Audio Codec, output-only (line-out)"
name "ich9-intel-hda", bus PCI, desc "Intel HD Audio Controller (ich9)"
name "intel-hda", bus PCI, desc "Intel HD Audio Controller (ich6)"
name "sb16", bus ISA, desc "Creative Sound Blaster 16"
name "usb-audio", bus usb-bus
name "vhost-user-snd", bus virtio-bus
name "vhost-user-snd-pci", bus PCI
name "virtio-sound-device", bus virtio-bus
name "virtio-sound-pci", bus PCI, alias "virtio-sound", desc "Virtio Sound"
...
$
Now let’s do the audio drivers.
$ sudo /opt/incus/bin/qemu-system-x86_64 -S -name sound -uuid 8fb0ac18-2b61-4423-89e8-38af6c7aec13 -daemonize -cpu host,hv_passthrough -nographic -serial chardev:console -nodefaults -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=allow,resourcecontrol=deny -readconfig /run/incus/sound/qemu.conf -spice unix=on,disable-ticketing=on,addr=/run/incus/sound/qemu.spice -pidfile /run/incus/sound/qemu.pid -D /var/log/incus/sound/qemu.log -smbios type=2,manufacturer=LinuxContainers,product=Incus -runas incus -audio help
Available audio drivers:
none
dbus
oss
spice
wav
$
At this stage we can edit the raw.qemu parameter, try out options and then start the VM. What’s missing is to install some utilities in the VM that will help us try out the audio.
I think this is a first step in testing things out.