FS#68112 - [qemu] Add JACK audio support

Attached to Project: Arch Linux
Opened by Netboy3 (Netboy3) - Monday, 05 October 2020, 16:43 GMT
Last edited by Andreas Radke (AndyRTR) - Wednesday, 27 January 2021, 15:41 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
Anatol Pomozov (anatolik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
JACK audiodev backend was merged to qemu since v5.1.0-rc0 (May 2020) and is reported as working well in qemu 5.1.0. Based on user feedback, JACK audiodev seems to fix stuttering/desync/crackling audio issues with emulated qemu audio devices and looks as the current superior way to achieve audio connectivity (better than pulseaudio). Considering that the Arch qumu build audio driver list hasn't been updated in 4 years, it might be a good time to revisit it.
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Wednesday, 27 January 2021, 15:41 GMT
Reason for closing:  Implemented
Additional comments about closing:  5.1.0-2
Comment by Anatol Pomozov (anatolik) - Monday, 05 October 2020, 18:47 GMT
> and is reported as working well in qemu 5.1.0

could you please provide links with the user's feedback?
Comment by Netboy3 (Netboy3) - Tuesday, 06 October 2020, 01:00 GMT
Here's a link to the developer's thread that includes his testing and experience and other users feedback
https://forum.level1techs.com/t/qemu-native-jack-audio-support/156494
Comment by Anatol Pomozov (anatolik) - Tuesday, 06 October 2020, 01:06 GMT
Thank you for the link. The request sounds reasonable to me.

Could you please check if the patch below works for you? If yes then I will move with adding the feature to the official package.


```
Index: PKGBUILD
===================================================================
--- PKGBUILD (revision 397386)
+++ PKGBUILD (working copy)
@@ -13,7 +13,7 @@
_headlessdeps=(seabios gnutls libpng libaio numactl libnfs
lzo snappy curl vde2 libcap-ng spice libcacard usbredir libslirp
libssh zstd liburing)
-depends=(virglrenderer sdl2 vte3 libpulse brltty "${_headlessdeps[@]}")
+depends=(virglrenderer sdl2 vte3 libpulse jack brltty "${_headlessdeps[@]}")
makedepends=(spice-protocol python ceph libiscsi glusterfs python-sphinx xfsprogs)
source=(https://download.qemu.org/qemu-$pkgver.tar.xz{,.sig}
qemu-ga.service
@@ -36,7 +36,7 @@

build() {
_build full \
- --audio-drv-list="pa alsa sdl"
+ --audio-drv-list="pa alsa sdl jack"

_build headless \
--audio-drv-list= \
```
Comment by Anatol Pomozov (anatolik) - Tuesday, 06 October 2020, 01:07 GMT
Slightly off-topic. I see that QEMU has "spice" audio driver as well. Is it something useful for Arch user?
Comment by Netboy3 (Netboy3) - Tuesday, 06 October 2020, 13:23 GMT
Below is my patch.
1. You need to increase pkgrel to get current 5.1.0 installs updated.
2. You should really use jack2 instead of jack. jack is now in bugfix only mode and most users install and use jack2.

===================>8========================

--- ./PKGBUILD.o 2020-08-03 09:02:06.137695904 -0400
+++ PKGBUILD 2020-08-03 09:04:43.242426008 -0400
@@ -6,14 +6,14 @@
qemu-block-{iscsi,rbd,gluster} qemu-guest-agent)
pkgdesc="A generic and open source machine emulator and virtualizer"
pkgver=5.1.0
-pkgrel=1
+pkgrel=2
arch=(x86_64)
license=(GPL2 LGPL2.1)
url="https://wiki.qemu.org/"
_headlessdeps=(seabios gnutls libpng libaio numactl libnfs
lzo snappy curl vde2 libcap-ng spice libcacard usbredir libslirp
libssh zstd liburing)
-depends=(virglrenderer sdl2 vte3 libpulse brltty "${_headlessdeps[@]}")
+depends=(virglrenderer sdl2 vte3 libpulse jack2 brltty "${_headlessdeps[@]}")
makedepends=(spice-protocol python ceph libiscsi glusterfs python-sphinx xfsprogs)
source=(https://download.qemu.org/qemu-$pkgver.tar.xz{,.sig}
qemu-ga.service
@@ -36,7 +36,7 @@

build() {
_build full \
- --audio-drv-list="pa alsa sdl"
+ --audio-drv-list="pa alsa sdl jack"

_build headless \
--audio-drv-list= \
Comment by Netboy3 (Netboy3) - Tuesday, 06 October 2020, 13:30 GMT
The drivers you specify in the "--audio-drv-list" are backend drivers (drivers that work on the hypervisor/host side, not the guest). The spice backend driver is used in rare cases where you need to connect hypervisors over spice. I never used it and don't believe it is necessary for most users.
Comment by Anatol Pomozov (anatolik) - Tuesday, 06 October 2020, 15:02 GMT
"jack2" package provides "jack". You can install jack2 and use it here.

So it is ok to specify "jack" here. It is what all the packages in Arch repo do.
Comment by Netboy3 (Netboy3) - Tuesday, 06 October 2020, 15:50 GMT
You are correct. both jack and jack2 are protocol interchangeable and it's ok to specify jack
Comment by David Runge (dvzrv) - Tuesday, 06 October 2020, 16:39 GMT
@anatolik: If you add jack support, please also add `libjack.so` (as this is most likely what qemu will link against - if in doubt, check with `find-libdeps`) to depends in package().
Comment by Netboy3 (Netboy3) - Tuesday, 06 October 2020, 18:02 GMT
libjack.so is not an Arch package. It is provided by the "jack" package which is now going to be a dependency of qemu.
Comment by Anatol Pomozov (anatolik) - Tuesday, 06 October 2020, 18:03 GMT
My question is "why to use libjack.so as a dependency instead of just 'jack'"?
Comment by David Runge (dvzrv) - Tuesday, 06 October 2020, 21:38 GMT
@Netboy3: The libprovides [1] are specifically added for the purpose for being able to tie dependants [2] to specific versions of a shared object and are part of the Arch packaging guidelines.

@anatolik: It guards against soname bumps as makepkg automatically includes the shared object version.
However, currently the only way (IMHO) to only have e.g. libjack.so in depends, jack needs to be added to makedepends and libjack.so added to depends in package() as there makepkg will have been able to have figured out the shared object version.
The sodep can also be added right after the package providing it (e.g. `depends=('jack' 'libjack.so')`), with the "downside" that both are then in depends.

[1] https://wiki.archlinux.org/index.php/Arch_package_guidelines#Package_relations
[2] https://wiki.archlinux.org/index.php/Arch_package_guidelines#Package_dependencies
Comment by Anatol Pomozov (anatolik) - Tuesday, 06 October 2020, 22:38 GMT
Alright, I enabled JACK in SVN revision 397454. It will be available to the users with the next package build (e.g. 5.1.1 or 5.1.0-2).

Loading...