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

The volume level of 'PulseEffects(apps)' decreases on its own #235

Closed
flipwise opened this issue Jun 13, 2018 · 43 comments
Closed

The volume level of 'PulseEffects(apps)' decreases on its own #235

flipwise opened this issue Jun 13, 2018 · 43 comments
Labels

Comments

@flipwise
Copy link
Contributor

Problem: Seemingly without doing anything the level of the 'PulseEffects(apps)' stream will decrease from the default 100% value.

Effect: PulseEffects stream is quieter than just using built-in audio.

Fix: pavucontrol -> output devices -> set the level back to 100%

Of course, I am not sure if this is related to PulseEffects at all, but rather to PulseAudio or even KDE maybe (which I use).

@wwmm
Copy link
Owner

wwmm commented Jun 13, 2018

I never saw this happening. There are know issues with KDE but I am not sure how it could do that. Take a look at FAQ.

PulseEffects only loads the null sink and lets the rest to Pulseaudio. So if its volume is changing something else is doing that. Do you have PulseEffects(apps) set as default output device? If yes do not do that.

@ghost
Copy link

ghost commented Jun 13, 2018

i experience this problem too, pulseeffects is set as the output device for my media player and it just turns down the volume and has to be reset via pavucontrol

setting PulseEffects(apps) as default for all output (in kde's systemsettings or pavucontrol) isn't an option because i experience really bad stutter when playing multiple streams at the same time

@wwmm
Copy link
Owner

wwmm commented Jun 13, 2018

Setting PulseEffects(apps) as default output can break PulseEffects routing or produce other side effects like the ones you had. The sound card should be always set as default output.

Could you paste here the information listed at Reporting Bugs? Maybe there are some clues in the logs

@flipwise
Copy link
Contributor Author

Yeah, I use the 'pactl unload-module module-device-manager' workaround and do not use PE as the default output stream. I should mention the workaround fixes the recording stream, but PE playback will regardless sometimes start on the wrong stream (e.g. when testing for this comment it started on 'Monitor of PulseEffects (mic)). Not as big of an issue as with the recording stream because once you set it properly it won't change to something else IIRC.

Actually thinking some more on what's been going in related to the reported issue, this might be yet another issue with KDE and wrong streams being used. Instead of the known problems that result in no sound, in this case I think the stream priorities sometimes get messed up because when I'm hitting the keyboard volume keys I find myself changing volume levels for some unknown (to me) stream. This happens, I think, when I'm using my headphones (@n-root do you use headphones and does the same happen to you sometimes?). Then I have to go into plasma-pa, set my headphones as the default output, which turns off PE so I have to turn it on again and all is fine. I just managed to reproduce it now as I was writing this comment and yes, the volume keys are for some reason wrongly affecting 'Pulse Effects (apps)'. The stream becomes the default one even though I didn't set it as such anywhere.

Yet another oddity: when I change the level of 'Pulse Effects (apps)' in pavucontrol, the FFT based equalizer sink also changes exactly the same.

Here's the bug reporting information:

  1. Distribution and Desktop Environment -> Manjaro Linux, Plasma 5.12.5

  2. PulseEffects version and how you installed it. -> 4.0.4, AUR

  3. Messages printed by PulseEffects when executed from command line in debug mode G_MESSAGES_DEBUG=pulseeffects pulseeffects. -> here is a file from a few mins of use, unfortunately I did not capture it when the streams got messed up
    pulseeffects_issue235.txt

  4. pactl and pacmd commands' output is here ->
    pulseeffects_issue235-2.txt

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

Your log shows that PulseEffects(mic) is set as default output. This is something that should not happen. And once this is set as default it makes no sense at all that your volume keys affect PulseEffects(apps). They should change PulseEffects(mic) volume.

Usually module module-switch-on-connect is the one that wrongly sets PulseEffects(mic) as default device. But you do not have it loaded. I am wondering now if the fact you have Pulseaudio built-in equalizer loaded is somehow causing this. I do not have it loaded here.

In any case this is definitely caused by a process external to PulseEffects. There is no code in it that would do this. The question now is what could cause this if module-switch-on-connect and module-device-manager are not loaded.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

In order to use PE KDE users have to unload module-device-manager but there is probably a reason why KDE uses it in the first place... Maybe phonon is not capable of handling every situation by itself and when you plug/unplug your headphones it makes wrong assumptions about which device it should use as default and ends up taking PulseEffects(mic).

@flipwise
Copy link
Contributor Author

Sometimes the PE playback stream will even start on PulseAudio's FFT stream. Other times it does properly start on Built-in Analog Stereo. I will unload the FFT module to see if this is interfering in any way.

@flipwise
Copy link
Contributor Author

OK, so I can confirm it happens even when not using headphones and that it's not related to the FFT stream. Aside from the variant of the problem which I describe above, when the default stream permanently gets switched to PulseEffects (apps), this can also happen only intermittently.

In this variant I'm usually adjusting the volume before playing e.g. a YouTube clip and then the volume keys are affecting the PE(apps) stream, but as soon as the clip starts playing it goes back to the right default stream. Of course, as with the first variant of the problem, the PE(apps) level gets messed up.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

I think we will have to increase pulseaudio verbosity and take a look at its logs. It was that way we found out the conflicting modules. Maybe we will have a hint about who is changing the default device in this case. Try to do the following in a terminal:

pacmd

this will take you to pulseaudio command shell. There you can increase its verbosity with the command:

set-log-level 4

Now close PulseEffects and in another terminal execute:

sudo journalctl -fb | grep -i pulse

You should see lots of lines printed by pulseaudio whenever you do something related to audio like changing volumes for example. I suggest you increase the number of lines shown by your terminal. Now you can see the logs execute PulseEffects. Try to paste here what Pulseaudio prints from this point on. It should tell us who is telling it to change the default device

@flipwise
Copy link
Contributor Author

Hmm I did that, but I'm only getting really a few lines of output and no output when the bug occurs. I even rebooted but to no avail.

This was all I got now:

lip 14 17:23:47 centurion-raider dbus-daemon[812]: [session uid=1000 pid=812] Activating via systemd: service name='org.a11y.Bus' unit='at-spi-dbus-bus.service' requested by ':1.54' (uid=1000 pid=1567 comm="/bin/pulseeffects ")
lip 14 17:23:47 centurion-raider at-spi-bus-launcher[1570]: dbus-daemon[1575]: Activating service name='org.a11y.atspi.Registry' requested by ':1.0' (uid=1000 pid=1567 comm="/bin/pulseeffects ")
lip 14 17:23:47 centurion-raider plasmashell[891]: org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_00_1f.3.analog-stereo.monitor"
lip 14 17:23:47 centurion-raider plasmashell[891]: org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_00_1f.3.analog-stereo.monitor"
lip 14 17:23:47 centurion-raider plasmashell[891]: org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_00_1f.3.analog-stereo.monitor"
lip 14 17:23:48 centurion-raider kactivitymanagerd[883]: Creating the cache for: "applications:com.github.wwmm.pulseeffects.desktop"
lip 14 17:23:48 centurion-raider kactivitymanagerd[883]: ResourceScoreUpdated: "6b41b0a4-99ac-4dfc-b0e5-cba7bea3a7e7" "org.kde.krunner" "applications:com.github.wwmm.pulseeffects.desktop"
lip 14 17:23:52 centurion-raider pulseaudio[908]: E: [alsa-sink-ALC236 Analog] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write.
lip 14 17:23:52 centurion-raider pulseaudio[908]: E: [alsa-sink-ALC236 Analog] alsa-sink.c: Most likely this is a bug in the ALSA driver 'snd_hda_intel'. Please report this issue to the ALSA developers.
lip 14 17:23:52 centurion-raider pulseaudio[908]: E: [alsa-sink-ALC236 Analog] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

Pulseaudio logging level was not increased. Are you sure you ran the command set-log-level 4 inside pacmd command prompt? When I do that here Pulseaudio prints a lot of lines. I know that when the user is using KDE Pulseaudio is started with a different script. Maybe this has some influence over the steps necessary to enable verbose mode

@flipwise
Copy link
Contributor Author

I apologize, I did not realize I have to keep the pacmd command open.

Here is the log now -> (
pulseeffects_issue235-3.txt

I managed to reproduce it very quickly and easily. I actually even forgot to turn PulseEffects on, but the problem still happened.

The easiest way to reproduce it on my machine is btw to just open a Youtube audio tab and then until you switch to it, the default output will be PulseEffects(app). That means the volume keys will be affecting it. Once you click on the tab and the audio starts playing the default device is automatically restored to Built-in Analog Stereo.

@flipwise
Copy link
Contributor Author

Sorry, in this case PulseEffects(mic) was affected by volume keys.

@flipwise
Copy link
Contributor Author

flipwise commented Jun 14, 2018

My hunch is telling me this is an issue with plasma-pa so I removed it and replaced it with kmix. Even when "pactl unload-module module-device-manager" is used, plasma-pa can affect stream priorities, which are indicated by the order in which the stream appears in the UI. It often puts both PulseEffects streams at the top. Right now I can't reproduce the issue with kmix but will give it some time to confirm the finding.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

I didn't know plasma-pa did more than just control volumes. It is possible that its automated routing is the source of the problem as it probably do not have rules to not touch PE sinks

I am still reading your logs but I have already found something strange. There are two lines with:

module-switch-on-connect.c: No sink inputs to move away.

This does not make sense. In your previous logs this module was not loaded. I don't understand how it seems to be active. In any case I didn't find lines related to it after PE was loaded. So it does not seem to be affecting PE

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

As soon as PE starts we have:

core.c: configured_default_sink: alsa_output.pci-0000_00_1f.3.analog-stereo -> PulseEffects_apps
core.c: default_sink: alsa_output.pci-0000_00_1f.3.analog-stereo -> PulseEffects_apps
module-switch-on-connect.c: No sink inputs to move away.

When PE loads the other null sink the default device is changed again:

core.c: configured_default_sink: PulseEffects_apps -> PulseEffects_mic
core.c: default_sink: PulseEffects_apps -> PulseEffects_mic
module-switch-on-connect.c: No sink inputs to move away.

It feels like module-switch-on-connect is the one changing the default device. Maybe pa-plasma makes use of it somehow

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

I decided to take a quick look at plasma-pa sources. They load module-switch-on-connect https://github.com/KDE/plasma-pa/blob/master/src/modulemanager.cpp#L105. Reading the sources it seems that there should be an configuration option in pa-plasma interface to disable the loading of this module. Could you check if there is a config for this?

@flipwise
Copy link
Contributor Author

Yes that puzzled me so I now went back and reinstalled plasma-pa to double check. The problem definitely does happen with the switch-on-connect module unloaded. As soon as I start PulseEffects plasma-pa prioritizes streams in this way:

image

This is clearly wrong and indeed by checking at the three dots the PE(mic) output is the default one. But when audio is playing the volume keys are properly affecting Built-in Analog Stereo. I reproduce the bug and now it's affecting the PE(apps) stream! Makes no sense.

I don't believe the modules are to blame here. Plasma-pa started out as a very barebones piece of software but now it can set default outputs and even lets you choose the stream for each application. Oddly enough I never remember it messing up the FFT stream's level when I wasn't using PE so who knows what's troubling it. Kmix behaves properly on the other hand.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

What do you have in pa-plasma settings window?

@flipwise
Copy link
Contributor Author

Here's all of them:

screenshot_20180614_230830
screenshot_20180614_230841
screenshot_20180614_230859
screenshot_20180614_230905

It definitely switches the default streams on its own. What I can do is put Built-in Analog Stereo as the default. This switches off PulseEffects immediately. When PE is toggled on again, all is fine until it messes up the priorities again on it own somehow.

@flipwise
Copy link
Contributor Author

flipwise commented Jun 14, 2018

Yeah, worse actually, even when it clearly says that Built-in Analog Stereo is the default output you can still mess up the PE streams in special situations. Doesn't matter which stream is the default one.

EDIT: And I tried it now with the "Automatically switch all running streams when a new output becomes available" option turned off and it's the same.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

The problem is the option in the Advanced Settings:

Automatically switch all running streams when a new output becomes available

I can see clearly in pa-plasma code that what this option does is loading module-switch-on-connect. How the hell this module is not shown in the output of pactl list modules short I have no idea. But both Pulseaudio logs and pa-plasma source code points to this module being used

@flipwise
Copy link
Contributor Author

Oh. I will try to restart (didn't do that above) after I've turned it off, make sure those two modules are unloaded and report back.

@ghost
Copy link

ghost commented Jun 14, 2018

i have that option (automatically switch all running streams...) turned off and plasma-pa only ever controls the built in audio (in my case HDMI) volume, so no issue here

the pulseeffects volume in pavucontrol does still go down after a while gradually on its own but plasma-pa doesn't give me a say in the matter so it feels like a completely separate issue :D

@flipwise
Copy link
Contributor Author

No go. After turning off the option, restarting and making sure the two problematic modules are turned off, I can still reproduce the bug with the youtube method I described.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

@n-root could you try to follow the steps a few posts above to get Pulseaudio logs in your installation?

@ghost
Copy link

ghost commented Jun 14, 2018

sure thing

$ sudo journalctl -fb | grep -i pulse
Jun 15 00:36:04 r00jaro-m pulseaudio[791]: I: [pulseaudio] source.c: Freeing source 2 "PulseEffects_mic.monitor"
Jun 15 00:36:04 r00jaro-m pulseaudio[791]: I: [pulseaudio] module.c: Unloaded "module-null-sink" (index: #29).
Jun 15 00:36:04 r00jaro-m pulseaudio[791]: I: [pulseaudio] client.c: Freed 64 "PulseEffects"
Jun 15 00:36:04 r00jaro-m pulseaudio[791]: I: [pulseaudio] protocol-native.c: Connection died.
Jun 15 00:36:04 r00jaro-m pulseaudio[791]: I: [pulseaudio] client.c: Freed 65 "PulseEffects"
Jun 15 00:36:04 r00jaro-m pulseaudio[791]: I: [pulseaudio] protocol-native.c: Connection died.
Jun 15 00:36:04 r00jaro-m plasmashell[768]: org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1.monitor"
Jun 15 00:36:04 r00jaro-m plasmashell[768]: org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1.monitor"

i'm running it as a daemon though so i killed it before turning it on and off again

@ghost
Copy link

ghost commented Jun 14, 2018

and here's the unabridged version (i did turn it on and off again several times here too), sorry for making you sift through it 😅

log.txt

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

Could you try to get the logs with pavucontrol closed? It creates a lot of things under the hood that makes the log a little harder to read. Try also start Pulseaudio with PulseEffects closed and then open PE to take the logs.

@ghost
Copy link

ghost commented Jun 14, 2018

log-2.txt

i'm not experiencing the stream-switching bug though, and i'm using plasma-pa
the only problem i experience is that the volume for pulseeffects(apps) gets turned down occasionally (and i really don't know why)

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

There is no mention in your log to module-switch-on-connect or to the default device being changed. It makes sense considering you do not have the stream change problem. There is only one line about PulseEffects_apps volume:

module-device-restore.c: Restoring volume for sink PulseEffects_apps: front-left: 65536 / 100%, front-right: 65536 / 100%

At least in this log everything is fine. PulseEffects_apps volume is 100% as it should be.

@wwmm
Copy link
Owner

wwmm commented Jun 14, 2018

Do you have flat-volumes=yes in /etc/pulse/daemon.conf?

@ghost
Copy link

ghost commented Jun 14, 2018

soon thereafter it went down to 90% though :D
nope, it says flat-volumes=no

@flipwise
Copy link
Contributor Author

I think @n-root also gets the issue with plasma-pa allowing PE stream level modification via volume keys, but it could be in a fraction of a second so he doesn't notice it. I can't possibly understand how the levels would change on their own.

@ghost
Copy link

ghost commented Jun 15, 2018

i installed kmix too and haven't experienced the volume go down on me unawares yet

@flipwise
Copy link
Contributor Author

Here's yet another intriguing bit in the KDE story: there are (so far) also no issues with streams with KMix. It starts on the proper streams and doesn't mess them up with use. This means I no longer have to unload module-device-manager or module-switch-on-connect. Of course, this is just on my setup, but whatever the problems with KDE are, they might not be related to Phonon, but actually just to plasma-pa.

@wwmm
Copy link
Owner

wwmm commented Jun 15, 2018

Maybe it would be good to report this to pa-plasma developers

@flipwise
Copy link
Contributor Author

I think so too. I spoke to soon about KMix not having issues with the device-manager module, but it certainly does not interfere with the volume level of PulseEffects' streams. Thank you for reading through all this, I know you've already put in a lot of effort in troubleshooting for us KDE users.

@wwmm
Copy link
Owner

wwmm commented Jun 15, 2018

No problems. I used KDE for many years before switching to GNOME and part of me gets happy when I see PE working there :-) It is just unfortunate that KDE deals with Pulseaudio in a way that is different than anybody else.

I follow Pulseaudio mailing list and version 12 should be released soon. After this device-manager should not be a problem anymore

@flipwise
Copy link
Contributor Author

flipwise commented Jun 15, 2018

Yeah, hopefully it comes out soon, things will be better. It just occurred to me that because many KDE users with plasma-pa might not actually notice that this volume problem is happening, you might get a bug report that the Limiter plugin is making audio sound very weird. This happened to me when the PulseEffects(app) stream was at cca 20% so the Limiter overcompensated for this.

But anyway, I've reported this bug here: https://bugs.kde.org/show_bug.cgi?id=395466

Of course, if I made some mistake or there is something else to add, please correct me!

@wwmm
Copy link
Owner

wwmm commented Jun 16, 2018

It seems fine to me. Let me know in case they need technical information about how PulseEffects operates

@flipwise
Copy link
Contributor Author

This specific issue with volume keys affecting PE's stream has now been fixed with plasma-pa version 5.13.2, according to upstream and my tests.

Also, I'm happy to report that all KDE Plasma specific issues with wrong streams being used are now gone with PulseAudio 12.

In short, PulseEffects works great and as intended!

@wwmm
Copy link
Owner

wwmm commented Jun 27, 2018

:-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants