pyMusic is an experimental desktop player that combines local and online music with a chat side panel: each track can drive an LLM persona inspired by lyrics and background context, so you can explore a song through dialogue as well as normal playback (playlist, seek bar, loop, folder load, YouTube Music search, and yt-dlp downloads into a cache folder).
Where every song can speak, feel, and respond — but music playback works without any API keys; you only need keys for the chat / AI features.
| Item | Notes |
|---|---|
| Python | 3.11–3.13 recommended (prebuilt pygame wheels are most reliable; very new Python versions may lack wheels). |
| FFmpeg | Optional but strongly recommended for YouTube downloads and converting non-MP3 formats for pygame. ffmpeg.org — on Windows: winget install Gyan.FFmpeg or choco install ffmpeg. The app also honors FFMPEG_PATH / PYMUSIC_FFMPEG if ffmpeg is not on PATH. |
git clone https://github.com/UIU-Developers-Hub/pyMusic.git
cd pyMusic(Use your own fork or a downloaded ZIP if you prefer; the next steps assume the repository root contains requirements.txt and src/app.py.)
Windows (PowerShell):
python -m venv .venv
.\.venv\Scripts\Activate.ps1macOS / Linux:
python3 -m venv .venv
source .venv/bin/activateFrom the repository root (the folder that contains requirements.txt):
python -m pip install --upgrade pip
pip install -r requirements.txtThis installs the desktop UI (ttkbootstrap), audio (pygame), metadata (mutagen), YouTube Music search (ytmusicapi), downloads (yt-dlp), optional cache watching (watchdog), and the LLM-related packages used by the chat panel.
Still in the repo root, with the venv activated:
python src/app.pyOn Windows you can also double-click or run the same command from cmd after .\.venv\Scripts\activate.bat.
- Local MP3s: Click Load Folder and choose a directory of
.mp3files (other formats may work for the list, but MP3 is the most reliable for pygame; FFmpeg helps with conversion for streamed/downloaded tracks). - Playback: Select a track, press Play. Use the progress bar to seek; Loop repeats the current song; Prev / Next move in the playlist.
- Online: Use Search & play to find tracks via YouTube Music; audio is downloaded into the app cache and played like a local file.
- Playlist persistence: The playlist is saved automatically. Invalid paths are pruned on startup.
The right-hand chat needs a configured provider. You can set keys in the UI (Provider, Model, API key, Apply) or via environment variables:
| Provider | Environment variables |
|---|---|
| Groq (default) | GROQ_API_KEY. Optional: GROQ_MODEL (default llama-3.3-70b-versatile), PYMUSIC_LLM_PROVIDER=groq. |
| Google Gemini | PYMUSIC_LLM_PROVIDER=gemini and GEMINI_API_KEY or GOOGLE_API_KEY. Optional: GEMINI_MODEL (default gemini-2.0-flash). |
Keep secrets in the API key field or env vars — do not paste API keys into the Model field.
After you press Play, the app can gather song context (lyrics + snippets when possible) and the model replies in character as the song. If catalog lookup misses your file, naming files like Artist - Title.mp3 helps the fallback.
- Cache directory:
%APPDATA%\pyMusic\cache\audioon Windows, or~/.local/share/pyMusic/cache/audioon Linux (and similar XDG layouts elsewhere). - Playlist file:
%APPDATA%\pyMusic\playlist.jsonon Windows, or~/.local/share/pyMusic/playlist.jsonon Linux.Load Folderreplaces the in-memory playlist and overwrites the save. - With watchdog installed (included in
requirements.txt), new files that appear in the cache folder can be picked up and added to the playlist. - Downloads are typically named like
Artist - Title [videoId].extwhen metadata is available.
Use online search only for content you are allowed to access, and respect copyrights and service terms.
| Issue | What to try |
|---|---|
pip fails on pygame |
Use Python 3.11–3.13, upgrade pip, or install a pygame wheel matching your OS/arch from pygame releases. |
| Playback errors (ModPlug / “Couldn’t open”) | Install FFmpeg on PATH so non-MP3 streams can be transcoded to MP3, or use MP3 files only. |
Seek bar shows 0:00 / no duration |
Install mutagen (pip install mutagen) if you edited deps; duration comes from file metadata. |
| YouTube / search fails | Update yt-dlp: pip install -U yt-dlp. Check network and region restrictions. |