bandlizer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. bandlizer-0.1.0/.agents/skills/bandlizer-architecture/SKILL.md +57 -0
  2. bandlizer-0.1.0/.agents/skills/bandlizer-release/SKILL.md +40 -0
  3. bandlizer-0.1.0/.github/workflows/publish.yml +32 -0
  4. bandlizer-0.1.0/.gitignore +8 -0
  5. bandlizer-0.1.0/CHANGELOG.md +47 -0
  6. bandlizer-0.1.0/LICENSE +21 -0
  7. bandlizer-0.1.0/PKG-INFO +183 -0
  8. bandlizer-0.1.0/README.md +146 -0
  9. bandlizer-0.1.0/pyproject.toml +58 -0
  10. bandlizer-0.1.0/src/bandlizer/__init__.py +4 -0
  11. bandlizer-0.1.0/src/bandlizer/__main__.py +4 -0
  12. bandlizer-0.1.0/src/bandlizer/app.py +143 -0
  13. bandlizer-0.1.0/src/bandlizer/audio_io.py +84 -0
  14. bandlizer-0.1.0/src/bandlizer/bandle.py +375 -0
  15. bandlizer-0.1.0/src/bandlizer/cache.py +201 -0
  16. bandlizer-0.1.0/src/bandlizer/cli.py +54 -0
  17. bandlizer-0.1.0/src/bandlizer/config.py +35 -0
  18. bandlizer-0.1.0/src/bandlizer/desktop.py +229 -0
  19. bandlizer-0.1.0/src/bandlizer/playback/__init__.py +3 -0
  20. bandlizer-0.1.0/src/bandlizer/playback/mixer.py +127 -0
  21. bandlizer-0.1.0/src/bandlizer/playback/player.py +134 -0
  22. bandlizer-0.1.0/src/bandlizer/playlist.py +478 -0
  23. bandlizer-0.1.0/src/bandlizer/separation/__init__.py +9 -0
  24. bandlizer-0.1.0/src/bandlizer/separation/base.py +53 -0
  25. bandlizer-0.1.0/src/bandlizer/separation/demucs_backend.py +142 -0
  26. bandlizer-0.1.0/src/bandlizer/service.py +168 -0
  27. bandlizer-0.1.0/src/bandlizer/spotify.py +232 -0
  28. bandlizer-0.1.0/src/bandlizer/tagging.py +189 -0
  29. bandlizer-0.1.0/src/bandlizer/ui/__init__.py +1 -0
  30. bandlizer-0.1.0/src/bandlizer/ui/bandle_page.py +458 -0
  31. bandlizer-0.1.0/src/bandlizer/ui/export_dialog.py +84 -0
  32. bandlizer-0.1.0/src/bandlizer/ui/guess_input.py +148 -0
  33. bandlizer-0.1.0/src/bandlizer/ui/icon.py +79 -0
  34. bandlizer-0.1.0/src/bandlizer/ui/landing_page.py +461 -0
  35. bandlizer-0.1.0/src/bandlizer/ui/main_window.py +1182 -0
  36. bandlizer-0.1.0/src/bandlizer/ui/theme.py +581 -0
  37. bandlizer-0.1.0/src/bandlizer/ui/track_strip.py +155 -0
  38. bandlizer-0.1.0/src/bandlizer/ui/waveform.py +140 -0
  39. bandlizer-0.1.0/src/bandlizer/ui/workers.py +298 -0
  40. bandlizer-0.1.0/tests/test_audio_io.py +49 -0
  41. bandlizer-0.1.0/tests/test_bandle.py +143 -0
  42. bandlizer-0.1.0/tests/test_cache.py +67 -0
  43. bandlizer-0.1.0/tests/test_desktop.py +35 -0
  44. bandlizer-0.1.0/tests/test_mixer.py +104 -0
  45. bandlizer-0.1.0/tests/test_playlist.py +84 -0
  46. bandlizer-0.1.0/tests/test_service.py +71 -0
  47. bandlizer-0.1.0/tests/test_spotify.py +49 -0
  48. bandlizer-0.1.0/tests/test_tagging.py +29 -0
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: bandlizer-architecture
3
+ description: >-
4
+ Architectural map, module conventions, threading invariants, UI design tokens,
5
+ and Windows/Qt gotchas for developing Bandlizer. Load this skill whenever
6
+ working on features, bug fixes, or refactors in the Bandlizer codebase.
7
+ ---
8
+
9
+ # Bandlizer — Codebase & Architecture Skill
10
+
11
+ Bandlizer is a pip-installable PySide6 desktop application (`src/` layout, Hatchling build backend, Python >=3.10) for local HTDemucs stem separation, sample-synced multi-track mixing, AST instrument tagging, Spotify track loading, and Bandle playlist guessing.
12
+
13
+ ## Module Map
14
+
15
+ | Path | Responsibility |
16
+ |---|---|
17
+ | `src/bandlizer/app.py` | Main `bandlizer` CLI (`argparse`) & GUI bootstrap; attaches Windows parent console for CLI-only flags (`--help`, `--install-desktop`, etc.). |
18
+ | `src/bandlizer/cli.py` | Headless `bandlizer-split` CLI sharing `SeparationService` and `StemCache`. |
19
+ | `src/bandlizer/config.py` | `SAMPLE_RATE = 44100`, `MODELS` catalog, `cache_dir()` (`BANDLIZER_CACHE_DIR` override), `downloads_dir()`. |
20
+ | `src/bandlizer/desktop.py` | Pure-Python `.ico` packer + Windows Start Menu `.lnk` (with `System.AppUserModel.ID = Bandlizer.Desktop.App`) & Linux `.desktop` installer/uninstaller. |
21
+ | `src/bandlizer/audio_io.py` | `load_audio`, `save_audio`, `resample` (`scipy.signal.resample_poly`), `compute_peaks`. Uses `soundfile` (bundled libsndfile with MP3 support — no ffmpeg needed for local I/O). |
22
+ | `src/bandlizer/cache.py` | Content-addressed `StemCache` (`<sha256[:20]>_<model>/manifest.json` + 24-bit `*.flac`). Supports `stem_tags` and `hidden=True` (Bandle rounds cached privately without appearing in Recent Separations). |
23
+ | `src/bandlizer/service.py` | `SeparationService`: orchestrates hash → cache lookup → decode → separate → AST tag `other` → atomic cache store, plus `load_cached(entry)`. |
24
+ | `src/bandlizer/separation/` | `base.py` (`Separator` protocol, `CancelToken`, `SeparationCancelled`) and `demucs_backend.py` (`DemucsSeparator` via `demucs-infer` with segment progress callbacks and CUDA OOM → CPU fallback). |
25
+ | `src/bandlizer/tagging.py` | Lazy-loaded offline `InstrumentTagger` (`MIT/ast-finetuned-audioset-10-10-0.4593` via `transformers`) with curated AudioSet instrument whitelist and parent-label suppression. Best-effort: failures never break separation. |
26
+ | `src/bandlizer/spotify.py` | Single Spotify track URL parser, `Artist - Track` metadata lookup (`HTMLParser` on `music:musician_description` / `og:title` + oEmbed fallback), and silent Windows `spotdl` subprocess runner. |
27
+ | `src/bandlizer/playlist.py` | Zero-auth playlist/album extractor (Spotify embed `__NEXT_DATA__`, Deezer API, Apple Music, YouTube) and 30-second MP3 preview resolver (Spotify `audioPreview` → Deezer public Search API fallback). |
28
+ | `src/bandlizer/bandle.py` | Pure-Python `BandleRound` & `BandleSession` state machine, autocomplete `rank_suggestions`, and `make_muffled_vocals` (FFT-YIN pitch-tracked pure warm-tone resynthesizer so zero voice/lyrics are heard). |
29
+ | `src/bandlizer/playback/` | `mixer.py` (pure-numpy lock-protected `Mixer` with single shared `position` playhead and click-free gain ramps) and `player.py` (`sounddevice.OutputStream` kept running continuously, fading to silence on pause). |
30
+ | `src/bandlizer/ui/` | PySide6 UI: `theme.py` (Obsidian Studio QSS), `icon.py` (official 4-bar logo & Windows AppUserModelID), `main_window.py`, `landing_page.py`, `bandle_page.py`, `guess_input.py`, `track_strip.py`, `waveform.py`, `workers.py`, `export_dialog.py`. |
31
+
32
+ ## Critical Invariants & Design Rules
33
+
34
+ 1. **Threading:**
35
+ - Never run inference, downloads, playlist HTTP calls, or disk I/O on the Qt UI thread. Use `QThread` workers in `ui/workers.py`.
36
+ - The PortAudio audio callback (`Player._callback`) must ONLY touch lock-protected `Mixer` state — never Qt widgets. UI playhead updates run on a 30 Hz `QTimer` polling `player.position_seconds`.
37
+ - Audio-finished notification crosses from PortAudio thread to Qt UI thread via a `Qt.ConnectionType.QueuedConnection` signal.
38
+ 2. **Bandle Mode Rules:**
39
+ - Never leak the mystery song's filename/title in progress text, window title, or Recent Separations (`hidden=True` in `SeparationService.process`).
40
+ - `Muffled Vocals` is inserted right before `Vocals` (`UNLOCK_PRIORITY`: `muffled vocals = 9`, `vocals = 10`), and `Vocals` is always last. Once `Vocals` unlocks (or round finishes), `Muffled Vocals` automatically mutes in `unlocked_stem_indices` so vocals don't double up.
41
+ - `Open in Studio Mixer` uses the original clean `prepared.loaded` stems (without `muffled vocals`).
42
+ - Do not mention "preview" on the Landing Page.
43
+ 3. **Solo (`S`) Button Behavior:**
44
+ - `S` on `TrackStrip` is an action button (not a latched toggle): clicking `S` on track `i` unmutes track `i` and force-mutes (`M` checked) all other tracks.
45
+ 4. **UI Design Tokens ("Obsidian Studio"):**
46
+ - Surfaces: `#0f1117` (window), `#13161f` (header/transport dock), `#161922` (cards), `#0b0d12` (waveform/recessed well), `#222736` (borders).
47
+ - Accents: `#6366f1` → `#7c3aed` (primary indigo/violet), `#1db954` (Spotify), `#f59e0b` → `#f43f5e` (Bandle).
48
+ - Stem colors (`STEM_COLORS`): drums `#f43f5e`, bass `#a855f7`, vocals `#fbbf24`, muffled vocals `#fb923c`, other `#38bdf8`, guitar `#34d399`, piano `#22d3ee`.
49
+
50
+ ## Solved Windows / Qt Gotchas (Do Not Regress!)
51
+
52
+ - **Silent `spotdl` subprocesses:** `spotdl` internally spawns `ffmpeg` via both `subprocess.Popen` AND `asyncio.create_subprocess_exec`. `_WIN_QUIET_SPOTDL` in `spotify.py` monkey-patches both inside the child process to inject `CREATE_NO_WINDOW`, preventing 1-second console flashes.
53
+ - **Skip button & search dropdown:** Keep `Skip` on the top horizontal row next to `Guess` (above `GuessInput.popup`), never below the popup — otherwise `FocusOut` collapses the popup before `mouseRelease` and swallows the click.
54
+ - **Qt `&` mnemonics:** Escape literal ampersands in `QPushButton` labels as `&&` (e.g. `"Give Up && Reveal"`).
55
+ - **Windows Taskbar icon & pinning:** Always call `set_windows_app_id()` (`Bandlizer.Desktop.App`) BEFORE creating `QApplication`, and stamp the exact same `AppUserModelID` onto `.lnk` shortcuts in `desktop.py`.
56
+ - **`.venv` live imports:** `.venv\Lib\site-packages\_bandlizer.pth` uses `import sys; sys.path.insert(0, r"D:\Projects\Bandlizer\src")` so edits under `src/` take effect immediately even if `bandlizer.exe` is running.
57
+ - **Worker chaining:** When chaining `PlaylistLoadWorker` → `BandleRoundWorker`, set a flag (`_pending_bandle_start`) and start the next worker inside `_on_worker_finished` (not `QTimer.singleShot(0)` from `succeeded`) to avoid a race where `self.worker` is not yet cleared.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: bandlizer-release
3
+ description: >-
4
+ Testing, visual UI verification, version bumping, changelog, and release
5
+ workflow for Bandlizer. Load this skill when verifying changes, updating
6
+ versions/changelogs, or preparing a release.
7
+ ---
8
+
9
+ # Bandlizer — Testing & Release Workflow
10
+
11
+ ## 1. Running Unit Tests
12
+
13
+ Always run pytest via the project virtualenv:
14
+
15
+ ```powershell
16
+ .\.venv\Scripts\python -m pytest -q
17
+ ```
18
+
19
+ - Core tests (`test_audio_io.py`, `test_cache.py`, `test_mixer.py`, `test_service.py`, `test_tagging.py`, `test_spotify.py`, `test_playlist.py`, `test_bandle.py`, `test_desktop.py`) are fast (~1 s) and do not require GPU or network access.
20
+ - `pyproject.toml` sets `pythonpath = ["src"]` under `[tool.pytest.ini_options]`.
21
+
22
+ ## 2. Visual & Interactive UI Verification
23
+
24
+ After any UI layout or stylesheet change, render screenshots offscreen/live with `MainWindow.grab().save(...)` into `<Artifact Directory Path>` and inspect them with `read_file` to catch clipped labels, broken slider handles, or contrast issues.
25
+
26
+ Use a scratch cache directory (`$env:BANDLIZER_CACHE_DIR = "d:\Projects\Bandlizer\out\cache"`) when running automated GUI smoke tests so the user's real cache stays clean.
27
+
28
+ ## 3. Version Bump & Changelog Checklist
29
+
30
+ When cutting a new version (e.g. `0.2.0`):
31
+
32
+ 1. Update `__version__` in `src/bandlizer/__init__.py` and `version` in `pyproject.toml` (keep both in sync).
33
+ 2. Move items from `## [Unreleased]` in `CHANGELOG.md` under a new `## [X.Y.Z] - YYYY-MM-DD` section (Keep a Changelog categories: `Added`, `Changed`, `Fixed`, `Removed`).
34
+ 3. Update `README.md` if CLI flags, shortcuts, models, or architecture changed.
35
+ 4. Update `.agents/skills/bandlizer-architecture/SKILL.md` if new modules, invariants, or gotchas were introduced.
36
+ 5. Verify wheel packaging builds cleanly:
37
+ ```powershell
38
+ .\.venv\Scripts\python -m pip wheel . --no-deps -w out\dist -q
39
+ ```
40
+ 6. Run `.\.venv\Scripts\python -m pytest -q` and confirm all tests pass before committing.
@@ -0,0 +1,32 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build-and-publish:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ id-token: write
14
+ contents: read
15
+
16
+ steps:
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+
25
+ - name: Build sdist and wheel
26
+ run: |
27
+ python -m pip install --upgrade pip build twine
28
+ python -m build
29
+ twine check dist/*
30
+
31
+ - name: Publish distribution to PyPI
32
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,8 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .pytest_cache/
7
+ samples/
8
+ out/
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to **Bandlizer** will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-12-04
11
+
12
+ Initial release of Bandlizer — an offline, pip-installable desktop stem splitter, synchronized multi-track player, and Bandle playlist guessing game.
13
+
14
+ ### Added
15
+
16
+ #### Stem Separation & Instrument Tagging
17
+ - Local offline stem separation via Meta's **HTDemucs** (`demucs-infer`), supporting `htdemucs` (4 stems), `htdemucs_ft` (fine-tuned 4 stems), and `htdemucs_6s` (6 stems: drums, bass, guitar, piano, other, vocals).
18
+ - Automatic hardware acceleration (CUDA GPU / Apple MPS) with automatic CPU fallback on GPU out-of-memory errors.
19
+ - Automatic offline instrument detection on the `other` stem using **MIT Audio Spectrogram Transformer (AST / AudioSet)** (`bandlizer.tagging`), displaying detected instrument tags on the `Other` strip and in Bandle mode.
20
+ - Content-addressed local stem cache (`StemCache`) storing atomic 24-bit FLAC stems and `manifest.json` metadata (including detected instrument tags) keyed by SHA-256 hash and model name.
21
+ - Pure-Python MP3/WAV/FLAC/OGG/AIFF decoding and encoding via `soundfile` (bundled libsndfile — no system `ffmpeg` required for local files).
22
+
23
+ #### Synchronized Multi-Track Studio Mixer
24
+ - Sample-accurate real-time audio mixer (`Mixer` + `sounddevice` `Player`) sharing a single playhead across all stems with click-free linear gain ramps, pause fade-out, and soft clipping.
25
+ - Per-track controls: color-coded left accent bar, `#1–#9` shortcut badges, mute (`M`), mute-others solo (`S`), double-click-to-reset volume slider, and **Reset Mix**.
26
+ - Bar-style mirrored peak waveforms (`WaveformView`) with shared loudness scaling, gradient played fill, hover scrub guide, and click/drag seeking.
27
+ - Background stem and current-mix export dialog supporting WAV, FLAC, and MP3.
28
+
29
+ #### Desktop UI & Landing Page
30
+ - **Obsidian Studio** dark theme with official 4-bar vector **Bandlizer** app icon (`icon.py`) in the window title bar, Alt+Tab switcher, and Windows taskbar (`AppUserModelID`).
31
+ - Always-accessible **Landing Page (`Home`)** with segmented **Home | Mixer | Bandle** navigation, drag-and-drop audio card, **Recent Separations** library, **Recent Playlists** chips, and an active-session **Resume** banner.
32
+ - Non-blocking `QThread` workers for separation, cache loading, Spotify downloads, playlist extraction, Bandle rounds, and export, with progress card and cancellation support.
33
+
34
+ #### Spotify & Bandle Game Mode
35
+ - Load single **Spotify track links** directly from the Home screen or `File → Open Spotify Link...` (`Ctrl+L`) using `spotdl` (optional `[spotify]` extra), with silent Windows subprocess wrapping (no terminal flashes), cached downloads, and `Artist - Track` display while loading.
36
+ - Built-in **Bandle Game Mode** (`Ctrl+B` or Landing Page launcher):
37
+ - Zero-auth playlist/album extraction for public **Spotify**, **Deezer**, **Apple Music**, and **YouTube / YouTube Music** links.
38
+ - Automatic 30-second preview fetching (Spotify embed previews with Deezer public Search API fallback) and album artwork retrieval.
39
+ - Progressive per-instrument unlocking (`Drums → Bass → Piano → Guitar → Other → Muffled Vocals → Vocals`, skipping near-silent stems) with upfront `Other` instrument hints.
40
+ - Pure-tone FFT-YIN pitch-tracked **Muffled Vocals** stage (`make_muffled_vocals`) right before **Vocals**, automatically swapping off when clear vocals unlock.
41
+ - Live composite waveform of unlocked stems, searchable playlist autocomplete with inline **Guess** and **Skip →** buttons, attempt log, session streak & win counter, album art reveal card, and one-click **Open in Studio Mixer** handoff.
42
+ - Bandle preview separations cached privately (`hidden=True`) so they don't clutter **Recent Separations**.
43
+
44
+ #### CLI & Desktop Integration
45
+ - Full `argparse` CLI on `bandlizer` / `python -m bandlizer`: `--help`, `--version`, positional file/track/playlist target, `--bandle`, `-m/--model`, `-d/--device`, `--install-desktop`, `--desktop-shortcut`, and `--uninstall-desktop`.
46
+ - Native desktop registration (`bandlizer.desktop`) generating a multi-resolution `.ico`/`.png` and Start Menu shortcut (with Windows `System.AppUserModel.ID` for Taskbar pinning) or Linux `.desktop` entry.
47
+ - Headless stem-splitting CLI (`bandlizer-split`) sharing the same separation service and cache.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bandlizer contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.5
2
+ Name: bandlizer
3
+ Version: 0.1.0
4
+ Summary: Offline desktop stem splitter, synchronized multi-track studio, and Bandle playlist guessing game.
5
+ Project-URL: Homepage, https://github.com/omernaf/Bandlizer
6
+ Project-URL: Repository, https://github.com/omernaf/Bandlizer
7
+ Project-URL: Issues, https://github.com/omernaf/Bandlizer/issues
8
+ Project-URL: Changelog, https://github.com/omernaf/Bandlizer/blob/main/CHANGELOG.md
9
+ Author: Omer Naftali
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: audio,bandle,demucs,music,qt,source separation,stems
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: X11 Applications :: Qt
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: demucs-infer>=4.4
24
+ Requires-Dist: numpy>=1.24
25
+ Requires-Dist: platformdirs>=3.0
26
+ Requires-Dist: pyside6-essentials>=6.6
27
+ Requires-Dist: scipy>=1.10
28
+ Requires-Dist: sounddevice>=0.4.6
29
+ Requires-Dist: soundfile>=0.12.1
30
+ Requires-Dist: torch>=2.0
31
+ Requires-Dist: transformers>=4.40
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7; extra == 'dev'
34
+ Provides-Extra: spotify
35
+ Requires-Dist: spotdl>=4.4; extra == 'spotify'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # Bandlizer
39
+
40
+ Bandlizer is a local, pip-installable desktop application that splits songs into individual instrument stems (`drums`, `bass`, `vocals`, `other`, and optionally `guitar` and `piano`), plays them back in **sample-accurate sync**, automatically identifies the instruments inside `other`, and includes a built-in **Bandle** playlist guessing game.
41
+
42
+ ## Highlights
43
+
44
+ - **Local AI Stem Separation:** Runs Meta's open-source [HTDemucs](https://github.com/facebookresearch/demucs) (MIT licence) locally via [`demucs-infer`](https://github.com/openmirlab/demucs-infer). Weights download once and run offline afterwards on GPU (CUDA / Apple MPS) with automatic CPU fallback on out-of-memory.
45
+ - **Automatic Instrument Detection on `Other`:** Uses MIT's Audio Spectrogram Transformer ([AST](https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593)) locally to tag the melodic instruments inside the `other` stem (e.g. *Electric Guitar*, *Synthesizer*, *Strings*) and caches the tags alongside the stems.
46
+ - **Sample-Locked Multi-Track Studio Mixer:** All stems mix inside a single real-time `sounddevice` callback sharing one playhead, with ramped gain changes (no clicks), interactive bar waveforms, mute (`M`), mute-others solo (`S`), per-track & master volume, **Reset Mix**, and export to WAV, FLAC, or MP3.
47
+ - **Multiple Ways to Load Music:**
48
+ - Drag-and-drop or open local audio files (MP3, WAV, FLAC, OGG, AIFF — no system ffmpeg required).
49
+ - Paste a **Spotify track link** directly on the Home screen (downloaded locally via `spotdl` with silent background subprocesses).
50
+ - Reopen any previously separated track instantly from **Recent Separations** (content-hashed local FLAC cache).
51
+ - **Bandle Game Mode:** Paste any public **Spotify**, **Deezer**, **Apple Music**, or **YouTube / YouTube Music** playlist or album link (zero API keys required). Bandlizer picks a mystery track, separates it locally, and unlocks instruments one by one — including a pure-tone pitch-tracked **Muffled Vocals** stage right before **Vocals** — with searchable playlist autocomplete, streak tracking, album art reveal, and one-click handoff to the **Studio Mixer**.
52
+ - **Desktop Integration:** Register Bandlizer in your Start Menu (and pin it to your Windows Taskbar with its official icon) with a single CLI command (`bandlizer --install-desktop`).
53
+
54
+ ---
55
+
56
+ ## Install
57
+
58
+ Bandlizer requires Python 3.10 or newer (3.11+ for the optional `spotify` extra).
59
+
60
+ ```bash
61
+ pip install . # core app (local files, Studio Mixer, Bandle mode)
62
+ pip install ".[spotify]" # also enable single Spotify track links via spotdl
63
+ ```
64
+
65
+ > **GPU acceleration (NVIDIA):** on Windows and Linux, the default PyPI `torch` wheel may be CPU-only. Install a CUDA build of PyTorch **first**, then Bandlizer:
66
+ >
67
+ > ```bash
68
+ > pip install torch --index-url https://download.pytorch.org/whl/cu128
69
+ > pip install ".[spotify]"
70
+ > ```
71
+ > The **Device** selector in the header shows available GPUs.
72
+
73
+ ### Register as a Desktop App (Start Menu & Taskbar)
74
+
75
+ ```bash
76
+ bandlizer --install-desktop # Start Menu shortcut + official icon (pinnable to Taskbar)
77
+ bandlizer --install-desktop --desktop-shortcut # also add a Desktop shortcut
78
+ bandlizer --uninstall-desktop # remove shortcuts & icon
79
+ ```
80
+
81
+ *(On Windows you can also run `python -m bandlizer --install-desktop`.)*
82
+
83
+ ---
84
+
85
+ ## Usage
86
+
87
+ ### Desktop App & CLI
88
+
89
+ ```bash
90
+ bandlizer # launch on the Landing Page
91
+ bandlizer --help # show all CLI options
92
+ bandlizer song.mp3 # open & separate a local file
93
+ bandlizer https://open.spotify.com/track/... # load a Spotify track
94
+ bandlizer --bandle <playlist-url> # jump straight into Bandle mode
95
+ bandlizer song.mp3 -m htdemucs_6s -d cuda:0 # override model/device on launch
96
+ ```
97
+
98
+ - **Landing Page (`Home`):** Drop an audio file, paste a Spotify track link, launch **Bandle Game Mode** from a playlist link (or recent playlists), or reopen any cached track from **Recent Separations**. You can return to **Home** anytime (`Ctrl+H` or the **Home | Mixer | Bandle** switcher) without losing your active session.
99
+ - **First-run weights:** Model weights download automatically on first use — HTDemucs (~80 MB for `htdemucs`, ~320 MB for `htdemucs_ft`) to `~/.cache/demucs-infer`, and AST instrument tagging (~340 MB) to `~/.cache/huggingface`.
100
+
101
+ ### Keyboard Shortcuts
102
+
103
+ | Shortcut | Action |
104
+ |---|---|
105
+ | `Space` | Play / pause |
106
+ | `←` / `→` | Seek −5 s / +5 s |
107
+ | `Home` | Return to 0:00 |
108
+ | `1`–`9` | Mute / unmute track N |
109
+ | `Shift` + `1`–`9` | Solo track N (unmutes N, mutes all others) |
110
+ | `Ctrl+H` | Return to Home / Landing Page |
111
+ | `Ctrl+O` | Open local audio file |
112
+ | `Ctrl+L` | Open Spotify track link |
113
+ | `Ctrl+B` | Start Bandle game from a playlist link |
114
+ | `Ctrl+E` | Export stems / current mix |
115
+
116
+ Click or drag on any waveform to seek. Double-click a track's volume slider to reset it to 100%.
117
+
118
+ ### Headless Stem-Splitting CLI
119
+
120
+ ```bash
121
+ bandlizer-split song.mp3 -o stems/ -f flac # shares the same stem cache as the GUI
122
+ bandlizer-split song.mp3 -m htdemucs_6s -d cpu --force
123
+ ```
124
+
125
+ ### Models
126
+
127
+ | Model | Stems | Notes |
128
+ |---|---|---|
129
+ | `htdemucs` (default) | drums, bass, other, vocals | fast, strong quality |
130
+ | `htdemucs_ft` | drums, bass, other, vocals | fine-tuned 4-model bag; best quality, ~4× slower |
131
+ | `htdemucs_6s` | drums, bass, guitar, piano, other, vocals | 6-stem separation (great for Bandle mode) |
132
+
133
+ ### Cache
134
+
135
+ Separated stems are stored as 24-bit FLAC files plus `manifest.json` (including detected instrument tags) under the platform cache folder (e.g. `%LOCALAPPDATA%\Bandlizer\Cache\stems` on Windows), keyed by the input file's SHA-256 hash and model name. Bandle rounds are cached privately so they don't clutter **Recent Separations**. You can open or clear the cache from the **Cache** menu, or override its path with `BANDLIZER_CACHE_DIR`.
136
+
137
+ ---
138
+
139
+ ## Architecture
140
+
141
+ ```
142
+ src/bandlizer/
143
+ app.py / __main__.py argparse CLI & GUI entry point (bandlizer)
144
+ cli.py headless splitter CLI (bandlizer-split)
145
+ config.py paths (platformdirs), sample rate, model catalog
146
+ desktop.py Start Menu / .desktop registration & .ico generator
147
+ service.py hash -> cache -> decode -> separate -> tag -> store
148
+ cache.py content-addressed FLAC stem cache with atomic writes
149
+ audio_io.py soundfile MP3/WAV/FLAC I/O, resampling, waveform peaks
150
+ tagging.py offline MIT AST instrument detector for the 'other' stem
151
+ spotify.py Spotify track URL parser, metadata lookup & silent spotdl wrapper
152
+ playlist.py zero-auth Spotify/Deezer/Apple/YouTube playlist & preview fetcher
153
+ bandle.py Bandle game state machine & FFT-YIN pure-tone Muffled Vocals DSP
154
+ separation/
155
+ base.py Separator protocol, progress callback, CancelToken
156
+ demucs_backend.py HTDemucs via demucs-infer (GPU/CPU select, progress, OOM fallback)
157
+ playback/
158
+ mixer.py pure-numpy sample-synced mixer with click-free gain ramps
159
+ player.py sounddevice OutputStream driving the mixer
160
+ ui/
161
+ theme.py Obsidian Studio dark stylesheet
162
+ icon.py official 4-bar vector app icon & Windows AppUserModelID
163
+ main_window.py header navigation, mixer, Bandle controller, transport dock
164
+ landing_page.py Home screen (drop card, Spotify bar, Bandle launcher, recent library)
165
+ bandle_page.py Bandle game view (stage chips, composite waveform, reveal card)
166
+ guess_input.py searchable playlist autocomplete with inline Guess & Skip
167
+ track_strip.py per-stem row (accent bar, instrument tags, M/S, volume, waveform)
168
+ waveform.py bar-style mirrored peak waveform with hover scrub guide
169
+ workers.py QThread workers (separation, cache load, Spotify, playlist, Bandle, export)
170
+ export_dialog.py stem & mixdown export dialog (WAV / FLAC / MP3)
171
+ ```
172
+
173
+ - **Threading model:** All heavy operations (separation, AST tagging, downloads, playlist extraction, export) run on `QThread` workers reporting via Qt signals. The PortAudio callback thread only calls lock-protected `Mixer.render()`, and the UI polls the playhead at 30 Hz.
174
+ - **Pluggable backends:** Implement `separate(audio, sr, progress, cancel) -> SeparationResult` and pass a factory to `SeparationService`.
175
+
176
+ ---
177
+
178
+ ## Development
179
+
180
+ ```bash
181
+ pip install -e ".[dev,spotify]"
182
+ pytest
183
+ ```
@@ -0,0 +1,146 @@
1
+ # Bandlizer
2
+
3
+ Bandlizer is a local, pip-installable desktop application that splits songs into individual instrument stems (`drums`, `bass`, `vocals`, `other`, and optionally `guitar` and `piano`), plays them back in **sample-accurate sync**, automatically identifies the instruments inside `other`, and includes a built-in **Bandle** playlist guessing game.
4
+
5
+ ## Highlights
6
+
7
+ - **Local AI Stem Separation:** Runs Meta's open-source [HTDemucs](https://github.com/facebookresearch/demucs) (MIT licence) locally via [`demucs-infer`](https://github.com/openmirlab/demucs-infer). Weights download once and run offline afterwards on GPU (CUDA / Apple MPS) with automatic CPU fallback on out-of-memory.
8
+ - **Automatic Instrument Detection on `Other`:** Uses MIT's Audio Spectrogram Transformer ([AST](https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593)) locally to tag the melodic instruments inside the `other` stem (e.g. *Electric Guitar*, *Synthesizer*, *Strings*) and caches the tags alongside the stems.
9
+ - **Sample-Locked Multi-Track Studio Mixer:** All stems mix inside a single real-time `sounddevice` callback sharing one playhead, with ramped gain changes (no clicks), interactive bar waveforms, mute (`M`), mute-others solo (`S`), per-track & master volume, **Reset Mix**, and export to WAV, FLAC, or MP3.
10
+ - **Multiple Ways to Load Music:**
11
+ - Drag-and-drop or open local audio files (MP3, WAV, FLAC, OGG, AIFF — no system ffmpeg required).
12
+ - Paste a **Spotify track link** directly on the Home screen (downloaded locally via `spotdl` with silent background subprocesses).
13
+ - Reopen any previously separated track instantly from **Recent Separations** (content-hashed local FLAC cache).
14
+ - **Bandle Game Mode:** Paste any public **Spotify**, **Deezer**, **Apple Music**, or **YouTube / YouTube Music** playlist or album link (zero API keys required). Bandlizer picks a mystery track, separates it locally, and unlocks instruments one by one — including a pure-tone pitch-tracked **Muffled Vocals** stage right before **Vocals** — with searchable playlist autocomplete, streak tracking, album art reveal, and one-click handoff to the **Studio Mixer**.
15
+ - **Desktop Integration:** Register Bandlizer in your Start Menu (and pin it to your Windows Taskbar with its official icon) with a single CLI command (`bandlizer --install-desktop`).
16
+
17
+ ---
18
+
19
+ ## Install
20
+
21
+ Bandlizer requires Python 3.10 or newer (3.11+ for the optional `spotify` extra).
22
+
23
+ ```bash
24
+ pip install . # core app (local files, Studio Mixer, Bandle mode)
25
+ pip install ".[spotify]" # also enable single Spotify track links via spotdl
26
+ ```
27
+
28
+ > **GPU acceleration (NVIDIA):** on Windows and Linux, the default PyPI `torch` wheel may be CPU-only. Install a CUDA build of PyTorch **first**, then Bandlizer:
29
+ >
30
+ > ```bash
31
+ > pip install torch --index-url https://download.pytorch.org/whl/cu128
32
+ > pip install ".[spotify]"
33
+ > ```
34
+ > The **Device** selector in the header shows available GPUs.
35
+
36
+ ### Register as a Desktop App (Start Menu & Taskbar)
37
+
38
+ ```bash
39
+ bandlizer --install-desktop # Start Menu shortcut + official icon (pinnable to Taskbar)
40
+ bandlizer --install-desktop --desktop-shortcut # also add a Desktop shortcut
41
+ bandlizer --uninstall-desktop # remove shortcuts & icon
42
+ ```
43
+
44
+ *(On Windows you can also run `python -m bandlizer --install-desktop`.)*
45
+
46
+ ---
47
+
48
+ ## Usage
49
+
50
+ ### Desktop App & CLI
51
+
52
+ ```bash
53
+ bandlizer # launch on the Landing Page
54
+ bandlizer --help # show all CLI options
55
+ bandlizer song.mp3 # open & separate a local file
56
+ bandlizer https://open.spotify.com/track/... # load a Spotify track
57
+ bandlizer --bandle <playlist-url> # jump straight into Bandle mode
58
+ bandlizer song.mp3 -m htdemucs_6s -d cuda:0 # override model/device on launch
59
+ ```
60
+
61
+ - **Landing Page (`Home`):** Drop an audio file, paste a Spotify track link, launch **Bandle Game Mode** from a playlist link (or recent playlists), or reopen any cached track from **Recent Separations**. You can return to **Home** anytime (`Ctrl+H` or the **Home | Mixer | Bandle** switcher) without losing your active session.
62
+ - **First-run weights:** Model weights download automatically on first use — HTDemucs (~80 MB for `htdemucs`, ~320 MB for `htdemucs_ft`) to `~/.cache/demucs-infer`, and AST instrument tagging (~340 MB) to `~/.cache/huggingface`.
63
+
64
+ ### Keyboard Shortcuts
65
+
66
+ | Shortcut | Action |
67
+ |---|---|
68
+ | `Space` | Play / pause |
69
+ | `←` / `→` | Seek −5 s / +5 s |
70
+ | `Home` | Return to 0:00 |
71
+ | `1`–`9` | Mute / unmute track N |
72
+ | `Shift` + `1`–`9` | Solo track N (unmutes N, mutes all others) |
73
+ | `Ctrl+H` | Return to Home / Landing Page |
74
+ | `Ctrl+O` | Open local audio file |
75
+ | `Ctrl+L` | Open Spotify track link |
76
+ | `Ctrl+B` | Start Bandle game from a playlist link |
77
+ | `Ctrl+E` | Export stems / current mix |
78
+
79
+ Click or drag on any waveform to seek. Double-click a track's volume slider to reset it to 100%.
80
+
81
+ ### Headless Stem-Splitting CLI
82
+
83
+ ```bash
84
+ bandlizer-split song.mp3 -o stems/ -f flac # shares the same stem cache as the GUI
85
+ bandlizer-split song.mp3 -m htdemucs_6s -d cpu --force
86
+ ```
87
+
88
+ ### Models
89
+
90
+ | Model | Stems | Notes |
91
+ |---|---|---|
92
+ | `htdemucs` (default) | drums, bass, other, vocals | fast, strong quality |
93
+ | `htdemucs_ft` | drums, bass, other, vocals | fine-tuned 4-model bag; best quality, ~4× slower |
94
+ | `htdemucs_6s` | drums, bass, guitar, piano, other, vocals | 6-stem separation (great for Bandle mode) |
95
+
96
+ ### Cache
97
+
98
+ Separated stems are stored as 24-bit FLAC files plus `manifest.json` (including detected instrument tags) under the platform cache folder (e.g. `%LOCALAPPDATA%\Bandlizer\Cache\stems` on Windows), keyed by the input file's SHA-256 hash and model name. Bandle rounds are cached privately so they don't clutter **Recent Separations**. You can open or clear the cache from the **Cache** menu, or override its path with `BANDLIZER_CACHE_DIR`.
99
+
100
+ ---
101
+
102
+ ## Architecture
103
+
104
+ ```
105
+ src/bandlizer/
106
+ app.py / __main__.py argparse CLI & GUI entry point (bandlizer)
107
+ cli.py headless splitter CLI (bandlizer-split)
108
+ config.py paths (platformdirs), sample rate, model catalog
109
+ desktop.py Start Menu / .desktop registration & .ico generator
110
+ service.py hash -> cache -> decode -> separate -> tag -> store
111
+ cache.py content-addressed FLAC stem cache with atomic writes
112
+ audio_io.py soundfile MP3/WAV/FLAC I/O, resampling, waveform peaks
113
+ tagging.py offline MIT AST instrument detector for the 'other' stem
114
+ spotify.py Spotify track URL parser, metadata lookup & silent spotdl wrapper
115
+ playlist.py zero-auth Spotify/Deezer/Apple/YouTube playlist & preview fetcher
116
+ bandle.py Bandle game state machine & FFT-YIN pure-tone Muffled Vocals DSP
117
+ separation/
118
+ base.py Separator protocol, progress callback, CancelToken
119
+ demucs_backend.py HTDemucs via demucs-infer (GPU/CPU select, progress, OOM fallback)
120
+ playback/
121
+ mixer.py pure-numpy sample-synced mixer with click-free gain ramps
122
+ player.py sounddevice OutputStream driving the mixer
123
+ ui/
124
+ theme.py Obsidian Studio dark stylesheet
125
+ icon.py official 4-bar vector app icon & Windows AppUserModelID
126
+ main_window.py header navigation, mixer, Bandle controller, transport dock
127
+ landing_page.py Home screen (drop card, Spotify bar, Bandle launcher, recent library)
128
+ bandle_page.py Bandle game view (stage chips, composite waveform, reveal card)
129
+ guess_input.py searchable playlist autocomplete with inline Guess & Skip
130
+ track_strip.py per-stem row (accent bar, instrument tags, M/S, volume, waveform)
131
+ waveform.py bar-style mirrored peak waveform with hover scrub guide
132
+ workers.py QThread workers (separation, cache load, Spotify, playlist, Bandle, export)
133
+ export_dialog.py stem & mixdown export dialog (WAV / FLAC / MP3)
134
+ ```
135
+
136
+ - **Threading model:** All heavy operations (separation, AST tagging, downloads, playlist extraction, export) run on `QThread` workers reporting via Qt signals. The PortAudio callback thread only calls lock-protected `Mixer.render()`, and the UI polls the playhead at 30 Hz.
137
+ - **Pluggable backends:** Implement `separate(audio, sr, progress, cancel) -> SeparationResult` and pass a factory to `SeparationService`.
138
+
139
+ ---
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ pip install -e ".[dev,spotify]"
145
+ pytest
146
+ ```
@@ -0,0 +1,58 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.24"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "bandlizer"
7
+ version = "0.1.0"
8
+ description = "Offline desktop stem splitter, synchronized multi-track studio, and Bandle playlist guessing game."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "Omer Naftali" }]
13
+ keywords = ["audio", "stems", "source separation", "demucs", "music", "bandle", "qt"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Environment :: X11 Applications :: Qt",
22
+ "Topic :: Multimedia :: Sound/Audio :: Analysis",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+ dependencies = [
26
+ "PySide6-Essentials>=6.6", # QtCore/QtGui/QtWidgets only (no WebEngine bloat)
27
+ "numpy>=1.24",
28
+ "scipy>=1.10",
29
+ "soundfile>=0.12.1",
30
+ "sounddevice>=0.4.6",
31
+ "platformdirs>=3.0",
32
+ "torch>=2.0",
33
+ "demucs-infer>=4.4",
34
+ "transformers>=4.40",
35
+ ]
36
+
37
+ [project.optional-dependencies]
38
+ spotify = ["spotdl>=4.4"]
39
+ dev = ["pytest>=7"]
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/omernaf/Bandlizer"
43
+ Repository = "https://github.com/omernaf/Bandlizer"
44
+ Issues = "https://github.com/omernaf/Bandlizer/issues"
45
+ Changelog = "https://github.com/omernaf/Bandlizer/blob/main/CHANGELOG.md"
46
+
47
+ [project.scripts]
48
+ bandlizer-split = "bandlizer.cli:main"
49
+
50
+ [project.gui-scripts]
51
+ bandlizer = "bandlizer.app:main"
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["src/bandlizer"]
55
+
56
+ [tool.pytest.ini_options]
57
+ testpaths = ["tests"]
58
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ """Bandlizer - offline stem separation and synchronized multi-track playback."""
2
+
3
+ __version__ = "0.1.0"
4
+ APP_NAME = "Bandlizer"
@@ -0,0 +1,4 @@
1
+ from bandlizer.app import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())