Cave is a Python‑based audio manager that imports music tracks, standardizes and enriches metadata (tags, MBIDs, ReplayGain, etc.), and provides a flexible system for favorites, curation, and playback. It also automatically creates symlinks for all imported tracks to enable universal playlist functionality.
- Cave
-
Audio Import & Standardization:
Import audio files (AAC, ALAC, FLAC, MP4) and convert them to a standardized M4A format. During import, Cave:- Cleans and repackages audio using ffmpeg, MP4Box, and bs1770gain (for ReplayGain).
- Automatically extracts, canonicalizes, and enriches metadata including MusicBrainz IDs, AcoustID fingerprints, and Spotify track IDs.
- Computes album‑level ReplayGain and assigns a unique 8‑digit hexadecimal Spawn ID to each track.
- Generates advanced track embeddings (using a Deej‑AI‑inspired encoder) for improved playlist curation.
-
Favorites System:
Manage and update your favorite artists, albums, or tracks. Favorites are stored in JSON files and can be used to filter curated playlists. -
Curated Playlists:
Cave supports several playlist curation methods:- Basic Curation: Groups tracks by genre (using a comprehensive genre dictionary with subgenre and synonym support), then shuffles tracks within each cluster.
- Feature‑Based Curation: Uses numeric audio features (e.g. tempo, loudness) to reorder tracks in each genre cluster.
- Advanced Curation: Leverages track embeddings and a trained ML model to implement a “chain‑based” nearest‑neighbor approach for smooth transitions between tracks, based on the Deej-AI project (https://github.com/teticio/Deej-AI)
- Personalized Recommendations: After filtering by favorites, users can opt to generate a playlist of tracks with a high
like_likelihoodscore, selecting tracks similar to their favorites.
-
M3U Playback (via mpv):
Easily play curated playlists with mpv. Spawn scans for.m3ufiles and launches mpv with the selected playlist. -
Symlink Generation:
During import, Spawn automatically creates symbolic links for every track with a unique Spawn ID. These symlinks are stored directly in theSpawn/aux/user/linx/folder (named<SpawnID>.m4a) to enable consistent file paths for universal playlists. -
Embeddings & Metadata Storage:
- Track embeddings are stored in
mp4tovec.p, a pickle file located inSpawn/aux/glob/, and updated whenever new tracks are added. - Track metadata is stored in
spawn_catalog.db(for all cataloged tracks) andspawn_library.db(for user-specific tracks).
- Track embeddings are stored in
-
API Integrations:
Spawn integrates with external services such as Spotify, Last.fm, MusicBrainz, and AcoustID for enhanced metadata and audio fingerprinting. -
Admin vs. User Mode:
- Admin Mode: New or updated tracks are written to
spawn_catalog.db, embeddings are generated, and all metadata is updated. - User Mode: Users access a subset of the catalog via
spawn_library.db, wherecat_tracksholds catalog tracks andlib_tracksholds unique user tracks.
- Admin Mode: New or updated tracks are written to
- Python 3.6 or higher (tested with Python 3.10).
- ReplayGain:
- macOS:
brew install rsgain - Ubuntu/Debian:
sudo apt install rsgain - Windows: see rsgain on GitHub
- macOS:
- mpv (for playlist playback):
- macOS:
brew install mpv - Ubuntu/Debian:
sudo apt-get install mpv - Windows: see mpv installation guide
- macOS:
- Optional (for audio conversion and fingerprinting):
- ffmpeg
- MP4Box
- chromaprint/fpcalc
Install via pip from the repository or after cloning:
git clone https://github.com/SpawnID0000/Spawn.git
cd Spawn
pip install -r requirements.txtOr, if using setup.py:
git clone https://github.com/SpawnID0000/Spawn.git
cd Spawn
python setup.py installDependencies include:
- mutagen
- spotipy
- musicbrainzngs
- requests, Pillow, python-dotenv, python-mpv
- numpy, torch
- …and others listed in requirements.txt.
- Make sure to have
git lfsin your system. Installation Steps - Run
git lfs installif you have not already. - Run
git lfs pull. - Now the
diffusion_pytorch_model.safetensorsshould be the actual file instead of the Git LFS pointer file.
- In Python 3.13, some modules like
aifcandsunauhave been removed. These modules are used in generating the embeddings. As a workaround, please run this:
pip install standard-aifc standard-sunauWhen you import tracks, Cave organizes your library under your LIB_PATH/Spwen directory. An example structure is as follows:
LIB_PATH/Spawn
├── Music
│ └── Artist
│ └── Album
│ ├── D-TT [spawn_id] - Title.m4a
│ └── cover.jpg
├── Playlists
│ ├── Curated
│ │ └── curate_YYYY-MM-DD_HHMMSS.m3u
│ └── Imported
│ └── import_YYYY-MM-DD_HHMM.m3u
└── aux
├── glob
│ ├── mp4tovec.p
│ └── spawn_catalog.db
├── temp
│ └── import_log.txt
└── user
├── favs
│ ├── fav_albums.json
│ ├── fav_artists.json
│ └── fav_tracks.json
├── hart
│ └── Artist
│ └── Album
│ └── cover_hi-res.jpg
├── linx
│ └── spawn_id.m4a
└── spawn_library.db
After installation, you can run Spawn from the command line:
spawnOr from source:
python -m spawn.mainYou will see a text menu:
Select one of the following options:
(or type 'quit' to exit)
1) Import tracks
2) Update favorites
3) Create curated playlist
4) Play M3U playlist
- Purpose:
Repackage raw audio, standardize metadata (including MBIDs, ReplayGain, and embeddings), and assign a unique Spawn ID to each track. - Details:
The import process supports both Admin and User modes. In Admin Mode, new tracks are stored in the main catalog database; in User Mode, they are stored in the user library database. - Usage:
Select “1” from the main menu and follow the prompts.
- Purpose:
Manage your favorite artists, albums, and tracks. - Usage:
Select “2” and follow the prompts to update your JSON‑formatted favorites lists, which are stored underSpawn/aux/user/favs/.
- Purpose:
Generate an.m3uplaylist from your library. You can choose between basic, feature‑based, or advanced (Deej‑AI) curation. - Usage:
Select “3” from the main menu. You may filter by favorites and then choose between advanced or feature‑based ordering. - Note:
In User Mode, only tracks stored in the user library database (those with Spawn IDs in thecat_trackstable) are included.
- Purpose:
Launch mpv to play a selected.m3uplaylist. - Usage:
Select “4” and choose a playlist from the displayed list or enter a custom path.
- main.py
The central CLI menu that integrates all functionalities. - track_importer.py
Handles audio file processing, metadata standardization, MBID and ReplayGain lookups, embedding generation, file renaming, and symlink creation. - favs.py
Manages your JSON‑formatted favorites lists (fav_artists.json, fav_albums.json, fav_tracks.json). - curator.py
Provides multiple curation methods (basic, feature‑based, advanced) for grouping tracks by genre, ordering clusters via relationships or embeddings, and writing curated M3U playlists. - audiodiffusion/
Contains Deej-AI–inspired modules for embedding generation. - likey.py
Computeslike_likelihoodscores based on embeddings to recommend new tracks similar to the user’s favorites. - symlinker.py
Ensures every track with a unique Spawn ID has a symlink for universal playlist support. - player.py
Finds.m3ufiles and plays them with mpv.
- Environment Files:
UseAPId.envorsettings.envto set API keys (Spotify, Last.fm, etc.) and other configuration values (such as LIB_PATH). - Database:
Track metadata is stored in SQLite databases:- Admin mode uses
Spawn/aux/glob/spawn_catalog.db(table “tracks”). - User mode uses
Spawn/aux/user/spawn_library.db(table “cat_tracks”).
- Admin mode uses
- Auxiliary Directories:
- Library path: Typically LIB_PATH/Spawn/Music.
- Logs and temporary files are saved under
Spawn/aux/temp/. - Custom cluster orders for curation are stored in
Spawn/aux/user/cur8/.
- ReplayGain (optional):
For album-level loudness balancing, install bs1770gain. - Audio Feature-based Curation (optional):
For advanced track ordering, librosa and/or a Deej‑AI model are used.
Distributed under the GNU General Public License v3 (GPLv3). See the LICENSE file for details.
Contributions are welcome! To contribute:
- Open an issue or pull request on GitHub: https://github.com/SpawnID0000/Spawn
- Submit bug reports, feature requests, or code improvements.
- For major changes, please open an issue first to discuss your ideas.
Thanks for using Spawn & Cave! If you have any questions or issues, please contact us at spawn.id.0000@gmail.com.