Skip to content

Conversation

kimjammer
Copy link
Contributor

@kimjammer kimjammer commented Apr 26, 2025

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 Add custom equalizer plugin with presets (bass booster, rock...) and the ability to add your own presets via a config.json file #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!

@kimjammer kimjammer changed the title feat(pitch-shift): Implement Pitch Shift feat(plugin): Pitch Shift Apr 26, 2025
@JellyBrick JellyBrick added the enhancement New feature or request label Apr 26, 2025
@Glebsin
Copy link

Glebsin commented Jun 29, 2025

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

@kimjammer
Copy link
Contributor Author

kimjammer commented Jun 29, 2025

@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
Copy link
Collaborator

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

@kimjammer
Copy link
Contributor Author

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

  • rubberband-web
  • soundtouchjs-audio-worklet
  • olvb/phaze
  • Tone.js

@kimjammer
Copy link
Contributor Author

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.

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

Successfully merging this pull request may close these issues.

4 participants