When mixxx is running the audio output can't be switched to other audio from the computer

Bug #1962479 reported by mYnDstrEAm
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Confirmed
Wishlist
Unassigned

Bug Description

When I run Mixxx on Debian11/KDE with PulseAudio I can't switch back and forth between audio from Mixxx and other audio from the computer such as a movie in Kodi, other music in a music player or Youtube videos in the browser. There's also no way to configure it to allow for concurrent audio output.

Depending on how Mixxx is used, this can be very cumbersome as you need to quit Mixxx to play other audio and restart it afterwards if you'd like to use it again. For example, you can't take a pause of mixing music at home and watch a few videos then go back to playing music (or leaving a set playing with low volume).

It does make sense to limit audio output to Mixxx by default when music is playing there. But it would be useful to allow for audio output from other sources if:
- configured in the preferences (not by default; maybe the option should get reset at every Mixxx startup) and/or
- when no audio is playing in Mixxx and/or
- when the audio stream output is changed somehow in the PulseAudio settings in the traybar (under devices there it only shows the mixer as Analog Output and when Mixxx is not running it does play other audio just fine; the application/browser/music-player is not muted under Applications in these settings when Mixxx is running so the audio is muted otherwise)

This only occurs with Mixxx but it could also be a problem with PulseAudio or KDE. If so, please comment so that I can move the issue.

Tags: jack portaudio
Revision history for this message
Daniel Schürmann (daschuer) wrote :

This happened due to the pasuspender call in the Mixxx starter.
For optimal latency, Mixxx needs exclusive access tho the Alsa audio device.
If this is occupied by another media player via Pulsaudio, Mixxx cannot be configured. That's the reason.
As workaround you can start Mixxx from the command line and bypass pasuspender.
Than you can for instance use jack/pipewire or the pulse Alsa device which works like you describe but with a latency penalty.

We have also this bug to fix the usability issue:
https://bugs.launchpad.net/mixxx/+bug/1414456

Revision history for this message
mYnDstrEAm (myndstream) wrote :

Thanks for the info! Yes Mixxx also can't be started if music is playing but this issue is about playing music after (or during) music was (or is) playing in Mixxx (the info as well as the linked other issue are relevant though).

So to start Mixxx from the command line and bypass pasuspender one simply runs `mixxx` instead of clicking on the application icon which runs `sh -c "pasuspender -- mixxx -platform xcb || mixxx -platform xcb"`?

This doesn't work: the waveforms are not showing. If I run `mixxx -platform xcb` the waveforms are showing but I have the same problem: I can't output any other audio from the computer once Mixxx has been started.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

You need to select the "pulse" Alsa device to free up the original audio device for PulseAudio.

Revision history for this message
mYnDstrEAm (myndstream) wrote :

Thanks, that worked!

After I set this under Preferences->Sound Hardware, it didn't load tracks and didn't recognize mixer inputs so I restarted Mixxx twice and now it works (it took a bit longer to load the track the first time; and maybe it was because I needed to restart the mixer). Now audio from multiple sources can be output (including concurrently) without having to manually switch between when using the command `mixxx -platform xcb`.

I don't think people are/would be aware of this. Would it be possible to set pulse as the default output if PulseAudio is used? I think this is probably also the initial difficulty to get Mixxx working and setting this (and later similar things for other audio stacks) by default would make things much easier for newcomers and less tech-savvy people. I'll probably put this in a stackexchange question so people can find this info.

Could pasuspender then become not used by default, and instead for example some option in the preferences?

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Your opinion is valid from your perspective and for your use case. However Mixxx is designed as a DJ tool for life performance. In this regards we want low latency and never play any system sound like an Email notification sound or such. This would be embarrassing in a live situation.

While the described main use case works good, it is no reason that the other two common use cases are that hard. It is:
* Use Mixxx as media player
* Mix output of streaming players into your mix

The recently released Pipewire sound server seems to be a good foundation for such a solution. However Mixxx cannot unlash the full power because of the long Audio Stack: Portaudio -> Jack -> Pipewire -> ALSA

For this Mixxx may access Pipewire directly using the Jack or Pulse API
https://bugs.launchpad.net/mixxx/+bug/1172299

Do you have interest to help here?

Changed in mixxx:
status: New → Confirmed
importance: Undecided → Wishlist
tags: added: jack
tags: added: portaudio
Revision history for this message
mYnDstrEAm (myndstream) wrote :

Thanks, these are very constructive useful infos.

I made the solution more easily discoverable for people looking for it (albeit I think the proper solution would be to make it discoverable within the preferences somehow; adding it to a FAQ or documentation could be useful too): https://unix.stackexchange.com/questions/692527/how-to-play-audio-from-other-sources-like-the-browser-or-a-music-player-while/692528

I understand why it shouldn't become the default. Sorry, I can't help there at the moment.

By the way: in terms of optimizing for live performance, here is one of the worst bugs in GNU/Linux imo that is relevant to and maybe could be addressed within Mixxx to some extent: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1331 There may also be various things one could build to improve the viability of mixxx as a music player, such as to the auto-DJ feature and combination with streaming sources.

If there is a similar solution for pipewire, please let me know so I can update the answer to the above Q&A.

Be (be.ing)
Changed in mixxx:
status: Confirmed → Won't Fix
Revision history for this message
Be (be.ing) wrote :

Applications can't do anything about the OS's audio APIs.

The best solution is replacing both PulseAudio and JACK with Pipewire. You can then configure Mixxx to use the JACK sound API in Mixxx's preferences and it will Just Work.

Unfortunately Debian does not make this convenient like Fedora and Arch where you simply replace the PulseAudio and JACK packages with Pipewire packages:
https://wiki.debian.org/PipeWire

If you would like this situation to improve, I'd suggest advocating for Debian to package Pipewire better so that doesn't require manual configuration, and furthermore switching to Pipewire by default

Revision history for this message
Be (be.ing) wrote :

Unfortunately Debian still has not updated to PortAudio 19.7. If the JACK device created by Pipewire has any regular expression tokens (any of the characters \()[]{}*+?|$^.) it will not work with Mixxx. I have notified the Debian maintainers about this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991023#17

If you are affected by this, Pipewire has a workaround available:
https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-JACK#jackfilter-name

Revision history for this message
Daniel Schürmann (daschuer) wrote :

This is a valid feature request. A fix with a preferences would be a good solution instead of our app starter hack. So let's keep it open for reference.

Changed in mixxx:
status: Won't Fix → Confirmed
Revision history for this message
Be (be.ing) wrote :

Why bother... just install Pipewire and be done with it.

Revision history for this message
Terry Belton (tezzy) wrote :

Will Be change the dependencies to include Pipewire?

Revision history for this message
Be (be.ing) wrote :

I don't know what you mean. I am not a Debian packager, do not use Debian nor Debian derived distros, nor have any intention to do these.

Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/10675

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.