Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass pasuspender via a preferences option #10675

Open
mixxxbot opened this issue Aug 23, 2022 · 14 comments
Open

Bypass pasuspender via a preferences option #10675

mixxxbot opened this issue Aug 23, 2022 · 14 comments

Comments

@mixxxbot
Copy link
Collaborator

mixxxbot commented Aug 23, 2022

Reported by: myndstream
Date: 2022-02-28T15:09:39Z
Status: Confirmed
Importance: Wishlist
Launchpad Issue: lp1962479
Tags: jack, portaudio


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.

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2022-02-28T15:35:21Z


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

@mixxxbot
Copy link
Collaborator Author

Commented by: myndstream
Date: 2022-02-28T16:11:56Z


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.

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2022-02-28T17:24:56Z


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

@mixxxbot
Copy link
Collaborator Author

mixxxbot commented Aug 23, 2022

Commented by: myndstream
Date: 2022-02-28T22:29:46Z


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?

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2022-02-28T23:23:52Z


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?

@mixxxbot
Copy link
Collaborator Author

Commented by: myndstream
Date: 2022-03-01T10:28:15Z


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.

@mixxxbot
Copy link
Collaborator Author

Commented by: Be-ing
Date: 2022-03-02T03:45:32Z


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

@mixxxbot
Copy link
Collaborator Author

Commented by: Be-ing
Date: 2022-03-02T04:03:41Z


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

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2022-03-02T08:17:56Z


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.

@mixxxbot
Copy link
Collaborator Author

Commented by: Be-ing
Date: 2022-03-02T15:10:00Z


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

@mixxxbot
Copy link
Collaborator Author

Commented by: tezzy
Date: 2022-05-19T12:54:24Z


Will Be change the dependencies to include Pipewire?

@mixxxbot
Copy link
Collaborator Author

Commented by: Be-ing
Date: 2022-05-23T20:34:51Z

@mixxxbot
Copy link
Collaborator Author

Commented by: Be-ing
Date: 2022-05-23T20:49:23Z


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.

@mixxxbot mixxxbot transferred this issue from another repository Aug 24, 2022
@mYnDstrEAm
Copy link

Please just make this an option in the settings. If you toggle it, it would display "requires restart to take effect". When you restart with that option set, it would also select the "pulse" Alsa device by default if PulseAudio is used.

The GitHub migration made some code-formatting for things that weren't code formatted in the original discussion, would be nice if you could fix that but it's probably not possible, neither is setting the same subscribers via the email addresses of prior subscribers to issues. For example this was code-formatted above:

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"?

@daschuer daschuer changed the title When mixxx is running the audio output can't be switched to other audio from the computer Bypass pasuspender via a preferences option Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants