I am not good at writing guides, but will do my best.
The point of this guide-for-noobs-like-me is, by using the tips from a link in the OP to set up a separate sys-audio-like domain for USB audio cards in Qubes OS 4.1, so to avoid the need to attach-detach USB card from qube to qube when needed.
Instead, a single qube will be set, to which the USB card and microphone will be permanently attached, so all other qubes could use USB card without the need of direct attach.
I have named the domain usb-audio for obvious reasons and analogy.
Thanks to original contributor stroberrysugar.
I haven’t thoroughly searched the forum for such a guide, so please apologize if the one already exists.
I) Whole procedure is described as if sys-audio is already set up, like it was on my system. No step described is depended on this, so applicable even when there’s no sys-audio set.
II) I have tried to create
usb-audio domain based on fedora-35-xfce, but didn’t succeed at first (which is related to my remarks in OP). Then, I successfully created it based on fedora-34-xfce, on which my
sys-audio is already based. The fact made me to compare lists of all installed packages in both versions of Fedora, to
diff them and to install in fedora-35-xfce those packages found only in fedora-34-xfce which were installable for v35. After this, I was able to successfully build
working usb-audio qube based on
fedora-35-xfce. Basically, you should take care that in both you have installed following
List is not exhausted, nor all the entries are mandatory most probably. It’s just what I have of them installed and found significant to mention.
usb-audio app qube based on fedora-34-xfce, or fedora-35-xfce.
- I have used default settings, except I have set memory balancing from 400-800MB purely guessing, still to investigate. The less the better.
For those who don’t have sys-audio, steps 3. and 4. are most probably unnecessary, but will not harm if taken just in case.
dom0 as default
[user@dom0 ~]$ qvm-prefs usb-audio audiovm dom0.
Set dom0 as the default audiovm for any other qube, at least for one more which will serve to test. Let’s call it
dom0, add a new null sink (
[user@dom0 ~]$ pactl load-module module-null-sink sink_name=my_usb_audio
Start playing some audio in
usb-audio qube, via Qube Manager, or via
qvm-start usb-audio in dom0 terminal.
For those using sys-audio, steps 8. and 9. are most probably unnecessary to take, since there should be no sinks in dom0, and the newly created sinks would be the default ones.
pavucontrol and in the
Playback tab change the output device of the
audio-test to the null sink you just created.
dom0 go to the
Recording tab and change the input device of
usb-audio to the monitor of the null sink you just created.
- Attach both the USB audio device and
usb-audio via device widget, or in terminal:
[user@dom0 ~]$ qvm-usb attach --persistent usb-audio sys-usb:<BDF_of_the_USB_audio_device>
[user@dom0 ~]$ qvm-device mic attach --persistent usb-audio dom0:mic
We need to attach
dom0:mic in order
usb-audio could actually receive the audio from the null sink monitor in step 9.
Please note that
--persistent is purely optional, and it should serve both USB audio device and microphone to be automatically attached on
usb-audio, we need to find the name of the USB audio device. This should serve the best:
[user@usb-audio ~]$ pacmd list-sinks | grep -e 'name:' -e 'index:'
The output should be something like:
* index: 1
So, there’s the name of our USB device to be used in final step.
* in front of the index indicates the current default output.
usb-audio, we now need to create a loopback module in
PulseAudio to redirect audio from the
mic to the
USB audio device:
[user@usb-audio ~]$ pactl load-module module-loopback source=vchan_input sink=alsa_output.usb-0e2d_USB_Sound_Device-00.analog-stereo
- You should now hear the sound of your beloved song played in
Any qube for which
dom0 is set as default
audiovm will use now
usb-audio without any additional actions taken. It’s even possible to create a separate sink per qube, so to avoid mixing sounds from 2 or more qubes at the same time. It is just needed to select proper output and monitor sinks in
Sinks won’t survive Qubes reboot, so they have to be recreated upon each start up. This can be automated via scripts on start up, but I am not willing at the moment to invest more time for this, since I’m preparing my laptop for a full transition to a sys-gui-gpu.
You are welcome and feel free to contribute the scripts to automate the process on startup. Salt-like formulas preferred so we could have them more and more in the forum thus be able to faster learn it.
Please let me know if anything have to be corrected in this noobs-guide, either it’s terminology, or essentially.