Skip to content

A NextJS lyrics translation/romanization app using Spotify Playback SDK. Not affiliated with Spotify.

License

Notifications You must be signed in to change notification settings

in-c0/spotify-lyrics-translator

Repository files navigation

Spotify Lyrics Translator (v0.1)

Spotify.Lyrics.Translator.v0.1.demo.-.Made.with.Clipchamp.mp4

MIT License Issues Pull Requests Latest Release

🎵 A NextJS/React lyrics translator app designed to work with Spotify Desktop 🎤🎵

Report a Bug · Request a Feature


Check out Moegi Spotify Web Extension made by @sglkc (Credits for the original idea & design inspiration)

This app communicates with Spotify Desktop through the Spotify Web Playback SDK, more native OS-level extension possibilities compared to the Chrome extension for the Spotify Web Player, which primarily modifies CSS.


Why build this?

This project was built primarily for educational purposes and to explore additional functionalities that could be extended into:

  • Audio reactions
  • AI-driven lyrics analysis
  • Community insights (e.g., integration with Genius)

The app should be portable to Mac, Linux, and mobile devices, although these platforms haven't been tested yet.


Current Issues (v0.1):

  • Japanese Romanization is incomplete due to the complexity of Kanji.

  • Language settings have not yet been implemented.


Setup Instructions

  1. Clone the repo
git clone https://github.com/in-c0/spotify-lyrics-translator.git
  1. Install dependencies
npm install
  1. Set up Environment Variables
NEXT_PUBLIC_SPOTIFY_CLIENT_ID=...
SPOTIFY_CLIENT_ID=...
SPOTIFY_CLIENT_SECRET=...
NEXT_PUBLIC_SPOTIFY_REDIRECT_URI=http://localhost:3000/callback
SPOTIFY_REDIRECT_URI=http://localhost:3000/callback
GOOGLE_TRANSLATE_API_KEY=...
  1. Run the development server
npm run dev

How To Set Up Environment Variables

To set up this app, you’ll need both Google Translate API and Spotify Developer credentials. If you are developing locally, create a new file in the root project directory named .env.local. (Do NOT share your API keys/Secret or commit the file!)

1. Google Translate API

  • Create a Google Cloud developer account and generate your API key.

    Note: The Google Translate API is not free. If you're looking for alternatives, check out google-translate-api-x.

GOOGLE_TRANSLATE_API_KEY=...(Set up here: https://cloud.google.com/apis)

2. Spotify Developer Account

Set up your Spotify Developer account and obtain your client secret.

SPOTIFY_CLIENT_SECRET=... (Set up here: https://developer.spotify.com/documentation/web-api)

Your final .env would look something like this for local development:

NEXT_PUBLIC_SPOTIFY_CLIENT_ID=...
SPOTIFY_CLIENT_ID=...
SPOTIFY_CLIENT_SECRET=...
NEXT_PUBLIC_SPOTIFY_REDIRECT_URI=http://localhost:3000/callback
SPOTIFY_REDIRECT_URI=http://localhost:3000/callback
GOOGLE_TRANSLATE_API_KEY=...

I’m exploring ways to make this app more accessible to users, as most cloud-based solutions incur costs. Some ideas for future development include:

  • Running everything locally, reducing dependency on cloud services (except for Spotify interaction), i.e.
  • Local LLM for translation (GPT4ALL)
  • Local transcription AI (e.g. Moises.ai or finetune Whisper, if there is a reliable way to somehow extract only the vocals out)

(... or I could host a server with a couple of ads, as long as it aligns with the license agreements... It probably won't in the current state given the Musixmatch API being difficult to obtain.)


Credits

A big thank you to @BlueCatSoftware for providing the Lyrix through Musixmatch, and to @sglkc for the inspiration behind this project (Chrome Extension).


License

MIT License

Credits appreciated but not necessary.


Have Questions or Feature Requests?

Feel free to start a new Discussion or create a new Issue. Contributions are welcome via issues or PRs!


Disclaimer

Please note that directly modifying the Spotify Desktop client may violate Spotify's Terms of Service. Although this app does not modify the Spotify client directly, please ensure that you comply with all relevant terms and conditions when using this app.

Spotify Developer Policy

Spotify Terms of Service