Skip to content

feat(plugins): add Slowed playback plugin#4400

Open
The-Kryz wants to merge 8 commits intopear-devs:masterfrom
The-Kryz:plugin-slowed-oficial
Open

feat(plugins): add Slowed playback plugin#4400
The-Kryz wants to merge 8 commits intopear-devs:masterfrom
The-Kryz:plugin-slowed-oficial

Conversation

@The-Kryz
Copy link
Copy Markdown

@The-Kryz The-Kryz commented Apr 1, 2026

Description:
This PR introduces a lightweight "Slowed" plugin that adds a floating UI to control playback rate and pitch preservation, allowing users to easily simulate Slowed or Nightcore effects directly in the app.

Technical Decisions:
I intentionally avoided using the Web Audio API (AudioContext, BiquadFilterNode) for Reverb or Bass effects. Since the browser only allows the audio stream to be captured by createMediaElementSource once, doing so would cause InvalidStateError conflicts with existing plugins like the native Equalizer or Crossfade.

By relying solely on HTMLMediaElement.playbackRate and preservesPitch, this plugin is 100% compatible with the rest of the ecosystem and won't break other audio plugins.

@ArjixWasTaken
Copy link
Copy Markdown
Member

ArjixWasTaken commented Apr 1, 2026

By relying solely on HTMLMediaElement.playbackRate and preservesPitch, this plugin is 100% compatible with the rest of the ecosystem and won't break other audio plugins.

Maybe we should introduce a unified way for all plugins to use the audio context, w/o having conflicts.
Just noting this as a future improvement.

Copy link
Copy Markdown
Member

@ArjixWasTaken ArjixWasTaken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past, I'd say LGTM, but since we moved strictly to using solidjs a while ago, I unfortunately have to ask you to make changes.

Otherwise, nice job

@ArjixWasTaken
Copy link
Copy Markdown
Member

ArjixWasTaken commented Apr 1, 2026

PS: If you need help with the solidjs stuff, I can help.

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 1, 2026

Done! I've fully refactored the plugin to follow the SolidJS standards:

Replaced manual DOM injection with Solid's render and JSX.

Implemented createSignal and createEffect for reactive state management.

Switched to the native stylesheets option for CSS.

Added a proper stop() method and onCleanup to ensure all intervals and UI elements are destroyed when the plugin is disabled.

Thanks for the guidance, @ArjixWasTaken! Let me know if there's anything else to adjust.

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 1, 2026

And I fixed some bugs BTW xD

Copy link
Copy Markdown
Member

@ArjixWasTaken ArjixWasTaken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more stuff I could point out using my phone

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 1, 2026

Sorry about the changes to package.json! I was encountering a TypeError: Cannot read properties of undefined (reading 'date') error in my local Windows environment when trying to compile the application, and adding ajv-formats was a workaround I tried to fix the problem.

I am now reverting package.json and pnpm-lock.yaml to their original states, as I realized it was a problem in my local environment that shouldn't affect the main repository. Thank you for noticing this!

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 1, 2026

All set! I've replaced the conditional rendering with the component to ensure reactivity works as intended in SolidJS. I also double-checked the cleanup logic and it's working smoothly now.

Everything should be in line with the project's standards now. Thanks, @ArjixWasTaken!

Copy link
Copy Markdown
Member

@ArjixWasTaken ArjixWasTaken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than this, everything looks good to me.

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 1, 2026

All done!! thks again @ArjixWasTaken!

@ArjixWasTaken
Copy link
Copy Markdown
Member

Great, I'll check this out on my computer once I have the time, to see if there are any bugs left.

@ArjixWasTaken
Copy link
Copy Markdown
Member

Just a note: this is an electron app, aka chromium, we can't use Firefox/safari specific stuff.

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 1, 2026

Fixed!

@ImMALWARE
Copy link
Copy Markdown

I realized it was a problem in my local environment

Is it really problem in your local environment? I get same error when building. And even Actions in this repo get it xd
https://github.com/pear-devs/pear-desktop/actions/runs/23715577687/job/69082005570

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 1, 2026

Honestly, I'm relieved to see that the compilation error is also happening in the Actions. I spent a lot of time thinking the problem was my Windows environment! 😂

Apparently it seems to be a problem across the entire repository; I reverted all my workarounds in package.json to keep this PR clean. I've officially given up on fixing the build environment for now and am now fully committed to pnpm start! It works on my machine, and that's where the magic happens.

While the plugin isn't in the main, I'm using it like this to listen to my music xD

Copy link
Copy Markdown
Author

@The-Kryz The-Kryz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished

@ArjixWasTaken
Copy link
Copy Markdown
Member

ArjixWasTaken commented Apr 8, 2026

Plugin works fine and I don't see any obvious bugs.
But I am not a fan of the floating control

@The-Kryz would it be ok to you if I rework the UI?

PS: The reason I am not a fan of it, is because it is too present, if other plugins also did that, it'd make a mess of the screen real estate. It'd be better if it was integrated with the player controls.

@The-Kryz
Copy link
Copy Markdown
Author

The-Kryz commented Apr 8, 2026

Hey @ArjixWasTaken! Sure, you can go ahead and rework the UI, no problem at all. I totally understand your point about the screen real estate, and integrating it into the player controls makes a lot of sense. Glad the core logic is working fine! Feel free to make any necessary changes.

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

Successfully merging this pull request may close these issues.

4 participants