feat(plugin): Pitch Shift #3291

Open
kimjammer wants to merge 4 commits from kimjammer/pitch-shift into master
kimjammer commented 2025-04-26 04:44:16 +00:00 (Migrated from github.com)

Pitch Shift

Implements shifting the pitch of the current song, like the Transpose extension.

I did what I could with my limited experience in this codebase, and the plugin is technically complete. But...

Help Wanted:

  1. Better UI: Currently the slider is implemented like playback-speed, but it would probably be beneficial to have a bigger slider since it's kinda hard right now to go up/down 1 semitone.
  2. Cent-wise control: Currently you can make sub-semitone changes with the scroll wheel that moves in increments of 0.01, but you might want that to move in units of cents instead. Probably not needed.
  3. Unified audio pipeline control: As currently implemented, you probably cannot have pitch-shift and the equalizer #2831 active at the same time (cuz I stole code from that pr).
  4. Per-song memory of pitch adjustment.

Related: #2005 #2186 #3168

Off-topic:
This took me waaaaay too long to implement, because I just could not find a good library for this until I used chatgpt deep research to find this port of rubberband with 33 weekly downloads 💀. And then it took me another eternity trying to get the renderer to load the script locally and not from the internet. But it's done and it works!

## Pitch Shift Implements shifting the pitch of the current song, like the Transpose extension. I did what I could with my limited experience in this codebase, and the plugin is technically complete. But... ### Help Wanted: 1. Better UI: Currently the slider is implemented like playback-speed, but it would probably be beneficial to have a bigger slider since it's kinda hard right now to go up/down 1 semitone. 2. ~~Cent-wise control: Currently you can make sub-semitone changes with the scroll wheel that moves in increments of 0.01, but you might want that to move in units of cents instead.~~ Probably not needed. 3. Unified audio pipeline control: As currently implemented, you probably cannot have pitch-shift and the equalizer #2831 active at the same time (cuz I stole code from that pr). 4. Per-song memory of pitch adjustment. Related: #2005 #2186 #3168 **Off-topic:** This took me waaaaay too long to implement, because I just could not find a good library for this until I used chatgpt deep research to find this port of rubberband with 33 weekly downloads :skull:. And then it took me another eternity trying to get the renderer to load the script locally and not from the internet. But it's done and it works!
JellyBrick (Migrated from github.com) reviewed 2025-04-26 04:44:16 +00:00
JellyBrick (Migrated from github.com) reviewed 2025-05-10 11:50:59 +00:00
kimjammer (Migrated from github.com) reviewed 2025-05-10 14:09:20 +00:00
kimjammer (Migrated from github.com) reviewed 2025-05-10 14:13:02 +00:00
Glebsin commented 2025-06-29 01:42:00 +00:00 (Migrated from github.com)

How can i easily download and install it right now? And will it work on the current version v3.9.0 ?

How can i easily download and install it right now? And will it work on the current version v3.9.0 ?
kimjammer commented 2025-06-29 03:14:58 +00:00 (Migrated from github.com)

@Glebsin This PR was last updated just after 3.9.0 released, so if you go to this branch on my fork, download, and build the project you could use it right now. But if you're not already a developer this is not worth the hassle of doing imo. So probably just wait until this is merged... eventually.

@Glebsin This PR was last updated just after 3.9.0 released, so if you go to this branch on my fork, download, and build the project you could use it right now. But if you're not already a developer this is not worth the hassle of doing imo. So probably just wait until this is merged... eventually.
JellyBrick commented 2025-07-13 07:31:16 +00:00 (Migrated from github.com)

Since Rubberband uses GPL 2.0, we cannot merge this PR. Please use another library

Since Rubberband uses GPL 2.0, we cannot merge this PR. Please use another library
kimjammer commented 2025-09-14 03:07:17 +00:00 (Migrated from github.com)

For tracking purposes, all libraries that have been tested/attempted in order of quality:

  • rubberband-web
  • soundtouchjs-audio-worklet
  • olvb/phaze
  • Tone.js
For tracking purposes, all libraries that have been tested/attempted in order of quality: - rubberband-web - soundtouchjs-audio-worklet - olvb/phaze - Tone.js
kimjammer commented 2025-09-14 03:12:24 +00:00 (Migrated from github.com)

The library has been switched to use SoundTouchJS, which has slightly inferior audio quality but is "good enough". SoundTouch is LGPL, but I believe that this usage follows the spirit of LGPL, as youtube-music connects with SoundTouch as a library and no modifications to the SoundTouch code have been made. If this is still a problem, you could theoretically just download the worker file from a web url at first launch or fetch the file from a web url every time to follow the letter of the license.

The library has been switched to use SoundTouchJS, which has slightly inferior audio quality but is "good enough". SoundTouch is LGPL, but I believe that this usage follows the spirit of LGPL, as youtube-music connects with SoundTouch as a library and no modifications to the SoundTouch code have been made. If this is still a problem, you could theoretically just download the worker file from a web url at first launch or fetch the file from a web url every time to follow the letter of the license.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin kimjammer/pitch-shift:kimjammer/pitch-shift
git switch kimjammer/pitch-shift

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff kimjammer/pitch-shift
git switch kimjammer/pitch-shift
git rebase master
git switch master
git merge --ff-only kimjammer/pitch-shift
git switch kimjammer/pitch-shift
git rebase master
git switch master
git merge --no-ff kimjammer/pitch-shift
git switch master
git merge --squash kimjammer/pitch-shift
git switch master
git merge --ff-only kimjammer/pitch-shift
git switch master
git merge kimjammer/pitch-shift
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: YTMD/youtube-music#3291
No description provided.