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

Feature request: Powersave/Standby mode #3472

Open
Massimo-B opened this issue Oct 25, 2024 · 16 comments
Open

Feature request: Powersave/Standby mode #3472

Massimo-B opened this issue Oct 25, 2024 · 16 comments

Comments

@Massimo-B
Copy link

Please add kind of an automatic standby/powersave mode.

Usually EE is quite CPU efficient, but still it has some continuous load, especially when using about 6 effects and having quite old systems like Core-i 3. or 4. gen. Systems are always running (24/7), sound input/output is only required ~3% per day.

How could the standby/powersave be enabled? There could be a button of course. But there should be some automatic suspending/resuming. That could be watching the input or output sources, if all are muted, then suspend the EE processing. When one source is unmuted, resume EE.

When suspended, EasyEffects should just stop processing and do a bypass, just like when terminating the EE processes.

Currently using easyeffects-7.1.6 on Gentoo.

@violetmage
Copy link
Contributor

This feature already exists, it can be adjusted in the "General" settings in EasyEffects: Inactivity Timeout

@wwmm
Copy link
Owner

wwmm commented Oct 25, 2024

This feature already exists, it can be adjusted in the "General" settings in EasyEffects: Inactivity Timeout

And on top of that PipeWire tries to stop the filters when there is nothing playing to or recording from our virtual devices. The only case where I know it fails to do this is when the echo canceller plugin is in the pipeline.

@Massimo-B
Copy link
Author

This feature already exists, it can be adjusted in the "General" settings in EasyEffects: Inactivity Timeout

Thanks, I didn't know this feature. It's enabled here with 10s.

I have 6 effects in the input chain only, that are Noise Reduction, Bass Loudness, Bass Enhancer, Exciter, Crytalizer, Stereo tools and some disabled effects.

I'm surprised when watching top, I can't see any difference. The CPU usage is always above 2% and does not make any difference when processing or when having all input and output sources muted. But when watching in htop, the effect is completely different. This is the situation when all devices are muted:
top:
image
htop:
image

And this is the situation when having input and output unmuted processing input noise monitored to the output:
top:
image
htop:
image

In htop I can see increasing CPU usage as expected, but top is showing a completely different result.

@wwmm
Copy link
Owner

wwmm commented Oct 28, 2024

top and htop may be using different measurement units. By this I mean that sometimes one of them may be using a scale that goes up to (cpu count) * 100% while the other is using a scale that stops at 100%.

What is the output of pw-top ? It will show if the filters are doing something.

@Massimo-B
Copy link
Author

Massimo-B commented Oct 30, 2024

Usually I always have the EasyEffects GUI running, because I need the Input Monitoring button here and there to check my microphone quality before starting a webcall.
This morning I started the machine and see easyeffects service is running in the background but having zero load in top and htop. (I prefer htop because I can filter for process names there)
So I thought maybe it's the GUI preventing the service to detect inactivity. But after closing the GUI again and muting inputs and outputs, I can't reduce the load anymore, even when waiting for 10 seconds.
Do I actually need to mute all devices? Right now looking at pavucontrol which is also always running, I don't see any level on any input or output source.

Now I close both, easyeffects gui and pavucontrol. That's it, after closing pavucontrol I have 0 CPU load. Doing a conference call with input/output I see some load, and load is 0 again after closing the call. Good.
It seems to be pavucontrol. Right after starting pavucontrol with all sources muted I have data-loop using CPU:
image

S   30      0	   0    ---     ---   ---   ---     0                  Dummy-Driver
S   31      0	   0    ---     ---   ---   ---     0                  Freewheel-Driver
R   42   1024  48000  27,9us  16,4us  0,00  0,00    0     F32P 2 48000 easyeffects_sink
R  120      1     25   9,8us  11,3us  0,00  0,00    0       F32LE 1 25  + PulseAudio Volume Control
I   44      0	   0   0,0us   0,0us  ???   ???     0                  ee_soe_output_level
I   49      0	   0   0,0us   0,0us  ???   ???     0                  ee_soe_spectrum
R   91   1024  48000  40,4us   2,3us  0,00  0,00    0    S32LE 2 48000 alsa_input.pci-0000_00_1b.0.analog-stereo
R   81      1     25  15,3us  17,2us  0,00  0,00    0       F32LE 1 25  + PulseAudio Volume Control
R   88   1024  48000  40,9us   2,4us  0,00  0,00    0    S16LE 1 48000 alsa_input.usb-Microsoft_Microsoft___LifeCam_HD-3000-02.mono-fallback
R  251      1     25  16,6us  16,9us  0,00  0,00    0       F32LE 1 25  + PulseAudio Volume Control
R   89   1024  48000   8,8ms   3,2us  0,41  0,00  243    S16LE 1 48000 alsa_input.usb-Antlion_Audio_Antlion_Wireless_Microphone-00.mono-fallback
R   43      0	   0  14,0us  15,7us  0,00  0,00   24     F32P 2 48000  + easyeffects_source
R   54      0	   0   3,3us  12,3us  0,00  0,00    2                   + ee_sie_output_level
R   59      0	   0   3,6us   8,0us  0,00  0,00  113                   + ee_sie_spectrum
R   90      0	   0  24,6us  75,2us  0,00  0,00  200    S32LE 2 48000  + alsa_output.pci-0000_00_1b.0.analog-stereo
R  118      1     25  19,0us  13,5us  0,00  0,00    0       F32LE 1 25  + PulseAudio Volume Control
R  108      1     25   6,2us  12,7us  0,00  0,00    0       F32LE 1 25  + PulseAudio Volume Control
R  110      1     25  23,4us  19,5us  0,00  0,00    0       F32LE 1 25  + PulseAudio Volume Control
R  243      0	   0  20,5us   4,0ms  0,00  0,19    0                   + ee_sie_rnnoise
R  149      0	   0   9,1us  11,0us  0,00  0,00    0                   + ee_sie_echo_canceller
R  234      0	   0   2,6us   6,9us  0,00  0,00    0                   + ee_sie_speex
R  244      0	   0   2,3us   8,6us  0,00  0,00    0                   + ee_sie_filter
R  101      0	   0   2,5us   7,3us  0,00  0,00    0                   + ee_sie_bass_enhancer
R  209      0	   0   2,5us   7,3us  0,00  0,00    0                   + ee_sie_maximizer
R  123      0	   0   2,5us   4,2ms  0,00  0,20    0                   + ee_sie_crystalizer
R  227      0	   0   9,8us 302,0us  0,00  0,01    0                   + ee_sie_exciter
R  247      0	   0   3,6us  85,5us  0,00  0,00    0                   + ee_sie_stereo_tools
R  200      0	   0   2,9us   7,3us  0,00  0,00    0                   + ee_sie_pitch
R  160      0	   0   2,5us   7,6us  0,00  0,00    0                   + ee_sie_delay
R  162   1024  48000  52,3us  24,0us  0,00  0,00    0    S32LE 2 48000 alsa_output.pci-0000_00_03.0.hdmi-stereo
R  147      1     25  28,0us  15,5us  0,00  0,00    0       F32LE 1 25  + PulseAudio Volume Control

@violetmage
Copy link
Contributor

Yes, in this case it's pavucontrol causing the activity. You can see in the first column of pw-top labeled "S" various letters; they show the operating state of each node. pavucontrol always creates virtual nodes whenever it's running so that it can display it's volume meters.

Unlike easyeffects, pavucontrol does not implement a sleep mode, so whenever it's open it will cause easyeffects to switch to the running state. You can see this in pw-top, pavucontrol nodes never show anything other than "R" as their status. Since easyeffects simply checks if any input nodes are "running" to decide when to wakeup, and pavucontrol also puts virtual nodes on every input device (microphone, etc.), easyeffects will always be "running" when pavuvontrol is open, even if no sound is playing.

@wwmm
Copy link
Owner

wwmm commented Oct 30, 2024

Pavucontrol does that indeed. And EasyEffects logic isn't the only one broken by it. PipeWire's procedures to put nodes in the idle satate also do not work. The reason is that at the end of the day pavucontrol level meters are a recording stream like any other. We blocklist them internally in EasyEffets but they will still affect pipewire.

@Massimo-B
Copy link
Author

Massimo-B commented Oct 31, 2024

Ok, let me summarize what I understood, correct me if I'm wrong: The S column is showing the status, which are in cpu-usage increasing order: S = SUSPENDED, I = IDLE, R = RUNNING...
There is no global "EE is running" or "EE is suspended" state, the state is always per node in pw-top. Having output processing, EE can still suspend input nodes.

Btw. who actually does the suspending of effects, pipewire or EasyEffects? The setting you mentioned actually is inside EasyEffects.

About pavucontrol: I was unsure if it is a good idea to use old PulseAudio software for pipewire. Is there any better replacement for a basic Audio mixer? Does Pavucontrol prevent sleep mode only because of it's level meters? When having pavucontrol closed but still having the basic controls in the Xfce panel from:
https://gitlab.xfce.org/panel-plugins/xfce4-pulseaudio-plugin/

$ pgrep -alf pulseaudio
5548 /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libpulseaudio-plugin.so 4 6291475 pulseaudio PulseAudio Plugin Adjust the audio volume of the PulseAudio sound system

...this would have no impact on suspending pipewire nodes?

@wwmm
Copy link
Owner

wwmm commented Oct 31, 2024

Btw. who actually does the suspending of effects, pipewire or EasyEffects? The setting you mentioned actually is inside EasyEffects.

PipeWire is the one managing when each filter is idle or active. EasyEffects just makes the links between filters and devices. What the inactivity timeout does is removing the links. What is a last resort to put the nodes in the idle state. Nowadays we only do this in the microphone pipeline because as far as I could see PipeWire was doing a good job at putting the filters in the output pipeline in the idle state when they should be.

I was unsure if it is a good idea to use old PulseAudio software for pipewire. Is there any better replacement for a basic Audio mixer?

Using Pavucontrol is fine. And I do not remember if there is a better alternative. Just do not let it open all the time. Do what has to be done and close its window.

Does Pavucontrol prevent sleep mode only because of it's level meters?

Yes. Its level meters do the same any audio recorder would do. In other words they are a recording stream. And as a result they keep the pipeline active.

I am not familiar with the xfce plugin. Assuming it does not insert any recording or playback stream to measure audio levels it should be fine. Just controlling volumes or managing devices does not keep the pipeline active.

@violetmage
Copy link
Contributor

violetmage commented Oct 31, 2024

Edit: removed my answer in favor of wwmm's answer, see comment above

@Massimo-B
Copy link
Author

Massimo-B commented Nov 4, 2024

About pw-top, which column represents the CPU load? I guess the closest is BUSY as it represents processing time? WAIT is more like a responsiveness, big values are a bad responsiveness, right?

@wwmm
Copy link
Owner

wwmm commented Nov 4, 2024

About pw-top, which column represents the CPU load? I guess the closest is BUSY as it represents processing time? WAIT is more like a responsiveness, big values are a bad responsiveness, right?

I never took the time to read its documentation. But I doubt it measures CPU load. Probably just processing time like you have already guessed. But based on what I have seen in other cases big values in the busy and wait columns are not a good thing. As well as a huge error count in the error column.

@Massimo-B
Copy link
Author

What about keeping the EE gui up with spectrum disabled, does that break suspending or make any load?

@violetmage
Copy link
Contributor

No, suspension will work just fine in that case.

In fact, you can even leave the spectrum enabled, because everything in easyeffects adheres to the inactivity timeout, including the spectrum.

The reason pavucontrol prevents suspension from happening is because it doesn't try to detect inactivity; it never stops requesting samples to check the volume, even if there's nothing playing. Easyeffects does check if the target nodes are idle, allowing for suspension.

@Massimo-B
Copy link
Author

For pavucontrol, is there any modern or pipwire-specific replacement?

@wwmm
Copy link
Owner

wwmm commented Nov 15, 2024

For pavucontrol, is there any modern or pipwire-specific replacement?

The closest is probably Helvum. But I do not know if it can be used to set the default system devices too.

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

No branches or pull requests

3 participants