Bug 486533

Summary: On X11, QML SoundEffect from plasmoid in panel or desktop playing sound becomes choppy when screen is in dpms off
Product: [Plasma] plasmashell Reporter: C Schell <kdebugs>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: minor CC: kde, nate
Priority: NOR Keywords: X11-only
Version First Reported In: 6.0.4   
Target Milestone: 1.0   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Example plasmoid that demonstrates the problem

Description C Schell 2024-05-03 23:27:14 UTC
I have a custom plasmoid that plays a sound when an event occurs.  It uses QML SoundEffect's play method to play the sound.

If the screen is in dpms "off" state the sound plays choppy, like a thread is waking up every half a second (not an exact time just an example) and playing a snippet then sleeping.  I assume it is a power saving mode as it plays fine when the screen is on.  This is a desktop not a laptop anyway, the system itself is not in a power saving mode.


STEPS TO REPRODUCE
1. Create a plasmoid that plays a sound with QML SoundEffect
2. Let the screen go to power saving mode such as "xset dpms force off"
3. Call the SoundEffect play() method in the plasmoid with a sound long to hear the effect.

OBSERVED RESULT
Sound plays choppy, like a portion is played, then stop, then next portion, then stop, etc.

EXPECTED RESULT
Sound plays normally.  (Worked fine prior to Plasma/Qt 6.)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  openSuse Tumbleweed since Plasma 6 was rolled out a couple months ago
(available in About System)
KDE Plasma Version: Current 6.0.4 but happened since Plasma 6 first released on Tumbleweed
KDE Frameworks Version:  Current 6.1.0
Qt Version: Current 6.7.0

ADDITIONAL INFORMATION
This bug did not happen under Plasma/KDE/Qt 5.  

It makes no sense to have a sound effect play in snippets even when in power saving mode.  Delay the start until you wake up and detect the even sure, but once a sound is playing the thread needs to stay active long enough to play the sound for a good user experience.
Comment 1 Nate Graham 2024-05-05 02:23:11 UTC
Are any other sources of audio exhibiting the same issue when the screen is in DPMS off mode? How about apps, or other audio-playing widgets like Advanced Radio Player?

If none of them do, then the issue is very likely going to be in the code for your custom widget.
Comment 2 C Schell 2024-05-05 03:53:52 UTC
Created attachment 169202 [details]
Example plasmoid that demonstrates the problem
Comment 3 C Schell 2024-05-05 03:56:06 UTC
(In reply to Nate Graham from comment #1)
> If none of them do, then the issue is very likely going to be in the code
> for your custom widget.
I just attached a very simple example plasmoid that demonstrates the problem.  You might have to replace the sound path with something else if you don't have the alsa sound test files installed / in the same location.

When I install this and then add the plasmoid to my desktop or panel the sound plays normally when the timer triggers until the display enters dpms off state.  The the sound starts playing choppy.

Please let me know if there's something wrong with this very simple custom plasmoid.
Comment 4 C Schell 2024-05-05 04:54:00 UTC
I should also point out it does have to be installed to show the bug.  If run with plasmoidviewer it works fine even in dpms off state.
Comment 5 Nate Graham 2024-05-07 04:05:54 UTC
Thanks. Cannot reproduce on my laptop when I let the screen turn off.
Comment 6 C Schell 2024-05-07 19:48:09 UTC
(In reply to Nate Graham from comment #5)
> Thanks. Cannot reproduce on my laptop when I let the screen turn off.

This is installed and not from plasmoidviewer?

And if you don't mind, I'm on x86_64, opensuse tumbleweed, using pipewire, and x11.  Any differences for you?
Comment 7 Nate Graham 2024-05-07 19:50:45 UTC
Yep installed in ~/.local/share/plasma/plasmoids. My system is x86_64, Fedora KDE 40, PipeWire, and Wayland. All KDE code is built from git master.
Comment 8 C Schell 2024-05-07 20:03:43 UTC
(In reply to Nate Graham from comment #7)
> Yep installed in ~/.local/share/plasma/plasmoids. My system is x86_64,
> Fedora KDE 40, PipeWire, and Wayland. All KDE code is built from git master.

Thanks for that.  If I switch to Wayland the problem doesn't occur.  Seems to be an X11 interaction.   Not sure if you have X11 installed and can easily switch to it for a test or not.
Comment 9 TraceyC 2025-02-24 17:58:56 UTC
Adding the x11-only keyword
Comment 10 Nate Graham 2025-08-19 20:11:56 UTC
Closing as not worth fixing due to esoteric nature and a shift of focus away from X11.