Editing Using JACK and PipeWire
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
First, you must make sure your distro's QEMU is built with JACK support: | First, you must make sure your distro's QEMU is built with JACK support: | ||
− | * On Debian, this is not the case until QEMU 6.1. This is currently only in unstable | + | * On Debian, this is not the case until QEMU 6.1. This is currently only in unstable. In the meantime, you can use [https://apt.quantum2.xyz/qemu-jack/ this repository]. |
Normally, you can run applications with PipeWire's JACK support by running it with <code>pw-jack</code>, but this is not possible when using libvirt. Instead, you need PipeWire to provide drop-in JACK support. To do this: | Normally, you can run applications with PipeWire's JACK support by running it with <code>pw-jack</code>, but this is not possible when using libvirt. Instead, you need PipeWire to provide drop-in JACK support. To do this: | ||
* on Debian: run <code>sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/; sudo ldconfig</code> | * on Debian: run <code>sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/; sudo ldconfig</code> | ||
− | * on Arch: install the | + | * on Arch: install the [https://aur.archlinux.org/packages/pipewire-jack-dropin/ pipewire-jack-dropin] AUR package. |
Once this is done, you have two options. You could run your virtual machines under your user, or you could set it up so that the QEMU user has access to your PipeWire socket. The former is easier, while the latter is more secure. | Once this is done, you have two options. You could run your virtual machines under your user, or you could set it up so that the QEMU user has access to your PipeWire socket. The former is easier, while the latter is more secure. | ||
Line 21: | Line 21: | ||
Then, you can run <code>virsh edit win10</code>, and perform the following changes: | Then, you can run <code>virsh edit win10</code>, and perform the following changes: | ||
− | # If the <code><domain></code> line doesn't already contain <code>xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'</code>, | + | # If the <code><domain></code> line doesn't already contain <code>xmlns:qemu</code>, add <code><nowiki>xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'</nowiki></code>. The line should look like: |
+ | #: <syntaxhighlight lang="xml"><domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'></syntaxhighlight> | ||
+ | # Add the following block to the <code><devices></code> section: | ||
+ | #: <syntaxhighlight lang="xml"> | ||
+ | <audio id="1" type="jack"> | ||
+ | <input clientName="win10" connectPorts="input-name"/> | ||
+ | <output clientName="win10" connectPorts="output-name"/> | ||
+ | </audio> | ||
+ | <sound model="ich9"> | ||
+ | <alias name="sound0"/> | ||
+ | </sound> | ||
+ | </syntaxhighlight> | ||
+ | #: <code>input-name</code> and <code>output-name</code> should be replaced with a regular expression that matches the name of the JACK input and output ports. Essentially, these are the names of microphone and speaker devices that the VM would connect to. You can get the names by looking at your patchbay, or run <code>jack_lsp</code>. | ||
#: If there is an existing <code><sound></code> block, it should be removed. | #: If there is an existing <code><sound></code> block, it should be removed. | ||
# Finally, we need to set PipeWire's runtime directory and latency. These are configured by environment variables. To do this, the following block right before <code></domain></code>: | # Finally, we need to set PipeWire's runtime directory and latency. These are configured by environment variables. To do this, the following block right before <code></domain></code>: | ||
Line 39: | Line 51: | ||
/run/user/1000/pipewire-0 rw, | /run/user/1000/pipewire-0 rw, | ||
</source> | </source> | ||
− | |||
− | |||
− | |||
Once you shutdown your VM and restart it, you should see an emulated HD audio device, and any sound should go into PipeWire. If you don't hear anything, check your patchbay connections. | Once you shutdown your VM and restart it, you should see an emulated HD audio device, and any sound should go into PipeWire. If you don't hear anything, check your patchbay connections. | ||
Line 56: | Line 65: | ||
$ chmod 700 /srv/win10 | $ chmod 700 /srv/win10 | ||
$ setfacl -m u:libvirt-qemu:rx /srv/win10 | $ setfacl -m u:libvirt-qemu:rx /srv/win10 | ||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 105: | Line 113: | ||
/srv/win10/pipewire-0 rw, | /srv/win10/pipewire-0 rw, | ||
</source> | </source> | ||
− | |||
− | |||
Once you shutdown your VM and restart it, you should see an emulated HD audio device, and any sound should go into PipeWire. If you don't hear anything, check your patchbay connections. | Once you shutdown your VM and restart it, you should see an emulated HD audio device, and any sound should go into PipeWire. If you don't hear anything, check your patchbay connections. |