unhertz 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 (43) hide show
  1. unhertz-0.1.0/.github/workflows/ci.yml +52 -0
  2. unhertz-0.1.0/.github/workflows/release.yml +46 -0
  3. unhertz-0.1.0/CHANGELOG.md +12 -0
  4. unhertz-0.1.0/CONTRIBUTING.md +54 -0
  5. unhertz-0.1.0/LICENSE +21 -0
  6. unhertz-0.1.0/MANIFEST.in +9 -0
  7. unhertz-0.1.0/PKG-INFO +229 -0
  8. unhertz-0.1.0/README.md +193 -0
  9. unhertz-0.1.0/ROADMAP.md +20 -0
  10. unhertz-0.1.0/SECURITY.md +21 -0
  11. unhertz-0.1.0/docs/ARCHITECTURE.md +77 -0
  12. unhertz-0.1.0/docs/DEPENDENCIES.md +106 -0
  13. unhertz-0.1.0/docs/GPU.md +79 -0
  14. unhertz-0.1.0/docs/LICENSING.md +65 -0
  15. unhertz-0.1.0/docs/MODELS.md +112 -0
  16. unhertz-0.1.0/docs/QUALITY.md +179 -0
  17. unhertz-0.1.0/docs/RELEASING.md +75 -0
  18. unhertz-0.1.0/pyproject.toml +52 -0
  19. unhertz-0.1.0/setup.cfg +4 -0
  20. unhertz-0.1.0/src/unhertz/__init__.py +3 -0
  21. unhertz-0.1.0/src/unhertz/__main__.py +3 -0
  22. unhertz-0.1.0/src/unhertz/audio.py +282 -0
  23. unhertz-0.1.0/src/unhertz/backends.py +218 -0
  24. unhertz-0.1.0/src/unhertz/cache.py +242 -0
  25. unhertz-0.1.0/src/unhertz/cli.py +265 -0
  26. unhertz-0.1.0/src/unhertz/exceptions.py +5 -0
  27. unhertz-0.1.0/src/unhertz/models.py +130 -0
  28. unhertz-0.1.0/src/unhertz/remix.py +64 -0
  29. unhertz-0.1.0/src/unhertz/separation.py +174 -0
  30. unhertz-0.1.0/src/unhertz.egg-info/PKG-INFO +229 -0
  31. unhertz-0.1.0/src/unhertz.egg-info/SOURCES.txt +41 -0
  32. unhertz-0.1.0/src/unhertz.egg-info/dependency_links.txt +1 -0
  33. unhertz-0.1.0/src/unhertz.egg-info/entry_points.txt +2 -0
  34. unhertz-0.1.0/src/unhertz.egg-info/requires.txt +15 -0
  35. unhertz-0.1.0/src/unhertz.egg-info/top_level.txt +1 -0
  36. unhertz-0.1.0/tests/test_audio.py +164 -0
  37. unhertz-0.1.0/tests/test_cache.py +189 -0
  38. unhertz-0.1.0/tests/test_cache_contracts.py +132 -0
  39. unhertz-0.1.0/tests/test_cli.py +218 -0
  40. unhertz-0.1.0/tests/test_integration.py +65 -0
  41. unhertz-0.1.0/tests/test_models.py +233 -0
  42. unhertz-0.1.0/tests/test_remix.py +71 -0
  43. unhertz-0.1.0/tests/test_separation.py +95 -0
@@ -0,0 +1,52 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ python: ["3.11", "3.12"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: ${{ matrix.python }}
22
+ - run: sudo apt-get update && sudo apt-get install -y ffmpeg
23
+ - run: python -m pip install -e '.[dev]'
24
+ - run: python -m ruff check src tests
25
+ - run: python -m ruff format --check src tests
26
+ - run: python -m pytest
27
+ - run: python -m build
28
+ - run: python -m twine check dist/*
29
+ - name: Install and exercise the built wheel outside the checkout
30
+ shell: bash
31
+ run: |
32
+ python -m venv "$RUNNER_TEMP/unhertz-wheel"
33
+ "$RUNNER_TEMP/unhertz-wheel/bin/python" -m pip install dist/*.whl
34
+ cd "$RUNNER_TEMP"
35
+ "$RUNNER_TEMP/unhertz-wheel/bin/unhertz" --help
36
+ "$RUNNER_TEMP/unhertz-wheel/bin/unhertz" models
37
+ - uses: actions/upload-artifact@v4
38
+ if: matrix.python == '3.11'
39
+ with:
40
+ name: distributions
41
+ path: dist/*
42
+
43
+ macos-smoke:
44
+ runs-on: macos-latest
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - uses: actions/setup-python@v5
48
+ with:
49
+ python-version: "3.12"
50
+ - run: brew install ffmpeg
51
+ - run: python -m pip install -e '.[dev]'
52
+ - run: python -m pytest
@@ -0,0 +1,46 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ build:
11
+ if: startsWith(github.ref, 'refs/tags/v')
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.11"
18
+ - run: sudo apt-get update && sudo apt-get install -y ffmpeg
19
+ - run: python -m pip install -e '.[dev]'
20
+ - name: Require the tag to match the package version
21
+ run: |
22
+ python -c 'import os, tomllib; v = tomllib.load(open("pyproject.toml", "rb"))["project"]["version"]; assert os.environ["GITHUB_REF_NAME"] == f"v{v}", "Tag and package version differ"'
23
+ - run: python -m ruff check src tests
24
+ - run: python -m ruff format --check src tests
25
+ - run: python -m pytest
26
+ - run: python -m build
27
+ - run: python -m twine check dist/*
28
+ - uses: actions/upload-artifact@v4
29
+ with:
30
+ name: release-distributions
31
+ path: dist/*
32
+
33
+ publish:
34
+ needs: build
35
+ runs-on: ubuntu-latest
36
+ environment:
37
+ name: pypi
38
+ url: https://pypi.org/p/unhertz
39
+ permissions:
40
+ id-token: write
41
+ steps:
42
+ - uses: actions/download-artifact@v4
43
+ with:
44
+ name: release-distributions
45
+ path: dist/
46
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-11-27
4
+
5
+ - Initial Python CLI for removing, isolating, and reducing supported instrument estimates.
6
+ - Capability-driven full-song and optional drum sub-stem inference adapters.
7
+ - FFmpeg input/output, floating-point processing, original-mixture subtraction, and cache support.
8
+ - Explicit model provenance, checkpoint licensing restrictions, and download acknowledgement.
9
+ - Offline tests, optional real-model checks, packaging, and GitHub CI/Trusted Publishing workflow.
10
+
11
+ Initial alpha release. Actual validation and remaining limitations are recorded in
12
+ [docs/QUALITY.md](docs/QUALITY.md); no separation-quality benchmark is implied.
@@ -0,0 +1,54 @@
1
+ # Contributing
2
+
3
+ Small, explicit changes are welcome. The instruments already provide enough complexity.
4
+
5
+ ## Local setup
6
+
7
+ Use Python 3.11 or 3.12 and install FFmpeg with `ffprobe` on `PATH`:
8
+
9
+ ```bash
10
+ python -m venv .venv
11
+ source .venv/bin/activate
12
+ python -m pip install -e '.[dev]'
13
+ python -m pytest
14
+ python -m ruff check src tests
15
+ python -m ruff format --check src tests
16
+ python -m build
17
+ python -m twine check dist/*
18
+ ```
19
+
20
+ Standard tests use deterministic synthetic audio and mocked inference. They must not download
21
+ checkpoints, access streaming services, or require a GPU. Mark real-model tests `integration`;
22
+ run them explicitly with `python -m pytest -m integration` after configuring the local fixtures
23
+ described in [QUALITY.md](docs/QUALITY.md).
24
+
25
+ ## Engineering rules
26
+
27
+ - Keep inference imports lazy: `unhertz --help` must work without PyTorch.
28
+ - Preserve the original signal's timing and gain before subtracting an estimated stem.
29
+ - Never invent stem capabilities or substitute frequency filtering for source separation.
30
+ - Do not silently overwrite source files or outputs, or accept non-finite PCM values.
31
+ - Treat cache entries as untrusted input and writes as interruptible.
32
+ - Add focused tests for behavior and failure recovery, including affected neighboring operations.
33
+ - Document checkpoint provenance independently of an inference library's source licence.
34
+ - Never commit copyrighted audio, model weights, credentials, or generated distributions.
35
+
36
+ Use the Ruff settings in `pyproject.toml`, conventional readable Python, and small functions. A new
37
+ framework should first explain why a function was insufficient.
38
+
39
+ ## Releases
40
+
41
+ Before release, complete the checklist in [QUALITY.md](docs/QUALITY.md), update the version and
42
+ changelog, and verify a clean wheel installation outside the checkout. Inspect both wheel and
43
+ source archive for weights, audio, and accidental local files.
44
+
45
+ Publishing requires explicit maintainer authorization. The release workflow runs manually against
46
+ an existing `vVERSION` tag, verifies that its version matches `pyproject.toml`, and publishes with
47
+ GitHub Trusted Publishing. Configure a protected `pypi` GitHub environment with required reviewers,
48
+ then register the PyPI trusted publisher for owner `camilla007`, repository `unhertz`, workflow
49
+ `release.yml`, environment `pypi`. Do not create a long-lived PyPI token. No GitHub release is
50
+ created automatically. Repository/PyPI configuration is an external setup step, not accomplished
51
+ by adding this workflow file.
52
+
53
+ Follow [the release walkthrough](docs/RELEASING.md) for the exact publisher fields and first-release
54
+ steps. A normal push runs CI; it does not publish to PyPI.
unhertz-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Camilla Buys
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,9 @@
1
+ include LICENSE README.md CONTRIBUTING.md SECURITY.md CHANGELOG.md ROADMAP.md
2
+ recursive-include docs *.md
3
+ recursive-include tests *.py
4
+ recursive-include .github/workflows *.yml
5
+ global-exclude *.mp3 *.wav *.flac *.ogg *.th *.ckpt *.pth *.onnx *.safetensors
6
+ global-exclude *.py[cod]
7
+ prune .venv
8
+ prune .pytest_cache
9
+ prune .ruff_cache
unhertz-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,229 @@
1
+ Metadata-Version: 2.4
2
+ Name: unhertz
3
+ Version: 0.1.0
4
+ Summary: A CLI for politely informing unwanted instruments that their services are no longer required.
5
+ Author-email: Camilla Buys <camilla.buys@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/camilla007/unhertz
8
+ Project-URL: Source, https://github.com/camilla007/unhertz
9
+ Project-URL: Issues, https://github.com/camilla007/unhertz/issues
10
+ Keywords: audio,music,source-separation,demucs,cli
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy>=1.26
23
+ Requires-Dist: platformdirs>=4
24
+ Requires-Dist: filelock>=3.16
25
+ Provides-Extra: inference
26
+ Requires-Dist: demucs==4.1.0; extra == "inference"
27
+ Requires-Dist: torch>=2.6; extra == "inference"
28
+ Requires-Dist: safetensors>=0.6; extra == "inference"
29
+ Provides-Extra: dev
30
+ Requires-Dist: build>=1.2; extra == "dev"
31
+ Requires-Dist: pytest>=8; extra == "dev"
32
+ Requires-Dist: PyYAML>=6; extra == "dev"
33
+ Requires-Dist: ruff>=0.9; extra == "dev"
34
+ Requires-Dist: twine>=6; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # Unhertz
38
+
39
+ > **Music has layers. Some of them are mistakes.**
40
+
41
+ A Python CLI for politely informing unwanted instruments that their services are no longer
42
+ required. Unhertz estimates instrument stems with pretrained models, then removes, reduces, or
43
+ isolates the parts you select. Your guitarist remains blissfully unaware.
44
+
45
+ The main ambition is cymbal removal from fully mixed rock and metal. That needs a drum sub-stem
46
+ model; an ordinary four-stem separator cannot tell a ride from a snare merely because we ask nicely.
47
+
48
+ **Release status:** initial implementation with real CPU and CUDA inference verified for vocals, guitar,
49
+ and the six-stem cymbal pipeline. See [quality and validation](docs/QUALITY.md) for the
50
+ tested boundary. Model code and checkpoint permissions are separate: the six-stem DrumSep weights
51
+ have unclear licensing. Demucs's author also explicitly says its weights' licensing is unclear.
52
+ Read [model licensing](docs/LICENSING.md) before downloading or
53
+ supplying a checkpoint; no commercially unrestricted installed model experience is claimed.
54
+
55
+ ## Install the eviction notice
56
+
57
+ Use Python 3.11 or 3.12 for inference. Install [FFmpeg](https://ffmpeg.org/download.html), including
58
+ `ffprobe`, and make both executables available on `PATH`. Ubuntu/Debian: `sudo apt install ffmpeg`;
59
+ macOS with Homebrew: `brew install ffmpeg`.
60
+
61
+ To install version 0.1.0 from PyPI into its own virtual environment:
62
+
63
+ ```bash
64
+ python3.11 -m venv .venv
65
+ source .venv/bin/activate
66
+ python -m pip install -U pip
67
+ python -m pip install 'unhertz[inference]==0.1.0'
68
+ unhertz --help
69
+ unhertz models
70
+ ```
71
+
72
+ For a source checkout instead:
73
+
74
+ ```bash
75
+ git clone https://github.com/camilla007/unhertz.git
76
+ cd unhertz
77
+ python3.11 -m venv .venv
78
+ source .venv/bin/activate
79
+ python -m pip install -U pip
80
+ python -m pip install '.[inference]'
81
+ unhertz --help
82
+ unhertz models
83
+ ```
84
+
85
+ In a new terminal, run `source .venv/bin/activate` from the checkout before using `unhertz`.
86
+ If another environment is active, you can use `./.venv/bin/unhertz` directly. A
87
+ `command not found` error usually means the environment containing Unhertz is not active.
88
+
89
+ The basic installation, `python -m pip install unhertz` (or `python -m pip install .` from source), includes audio processing and the CLI without
90
+ PyTorch or model inference dependencies. Help and model listings do not load neural networks.
91
+ No checkpoint ships in the wheel.
92
+
93
+ Model acquisition is explicit. Review the provenance and permissions in `unhertz models` and
94
+ [MODELS.md](docs/MODELS.md), then download the model you need:
95
+
96
+ ```bash
97
+ unhertz models download htdemucs --acknowledge-unclear-license
98
+ ```
99
+
100
+ You can instead supply a trusted compatible local HTDemucs safetensors checkpoint with
101
+ `--checkpoint`. All registry downloads require an acknowledgement of the unresolved checkpoint
102
+ permissions; the flag does not grant a licence.
103
+
104
+ ## Ask an instrument to leave
105
+
106
+ With the full-song model installed:
107
+
108
+ ```bash
109
+ unhertz song.mp3 --remove vocals
110
+ unhertz song.flac --remove bass
111
+ unhertz song.wav --remove drums --output without-drums.flac
112
+ unhertz song.mp3 --isolate vocals
113
+ unhertz song.mp3 --reduce vocals:75
114
+ ```
115
+
116
+ `--reduce vocals:75` subtracts 75% of the estimated vocal contribution, leaving approximately 25%.
117
+ These are percentages, not decibels. Percentages must be between 0 and 100.
118
+
119
+ For guitar separation, obtain and select the six-stem full-song model:
120
+
121
+ ```bash
122
+ unhertz models download htdemucs_6s --acknowledge-unclear-license
123
+ unhertz song.mp3 --model htdemucs_6s --remove guitar,bass
124
+ ```
125
+
126
+ Pick one operation: `--remove`, `--isolate`, or `--reduce`. Comma-separated instruments select
127
+ multiple stems. Unsupported instruments fail explicitly. There is no secret EQ fallback.
128
+
129
+ ## The cymbals have been asked to leave
130
+
131
+ Cymbal operations need the optional MDX23C DrumSep adapter in addition to the full-song separator.
132
+ Its checkpoint licensing remains unresolved. Real CPU and CUDA removal, reduction, and isolation checks
133
+ are recorded in [QUALITY.md](docs/QUALITY.md); listening quality on dense metal remains unverified.
134
+
135
+ ```bash
136
+ python -m pip install 'git+https://github.com/openmirlab/mdxnet-infer.git@cb4779eedeca4f55ba498df8e234e2b5f4b90aaf'
137
+ unhertz models download drumsep-6stem --acknowledge-unclear-license
138
+ unhertz song.mp3 --remove cymbals
139
+ unhertz song.mp3 --remove hihat,ride,crash
140
+ unhertz song.mp3 --reduce cymbals:75
141
+ unhertz song.mp3 --isolate kick
142
+ unhertz song.mp3 --isolate crash
143
+ ```
144
+
145
+ For your own trusted compatible weights, use `--drum-checkpoint /path/model.ckpt` and
146
+ `--drum-config /path/model.yaml`. Only use trusted checkpoints and configurations. Unhertz uses restricted loading rather than
147
+ the upstream unrestricted pickle path; see [SECURITY.md](SECURITY.md).
148
+
149
+ The download acknowledgement records your choice to obtain weights whose permissions have not
150
+ been established here. It does not grant a licence or establish permission for non-commercial use.
151
+
152
+ | Alias | Meaning |
153
+ | --- | --- |
154
+ | `cymbals` | `hihat`, `ride`, and `crash` together |
155
+ | `hh` | `hihat` |
156
+ | `vox` | `vocals` |
157
+ | `guitars` | `guitar`, when the selected model supports it |
158
+
159
+ Inspect capabilities with `unhertz models` or `unhertz song.mp3 --list-instruments`.
160
+
161
+ ## Your track is safe. Your mixing decisions remain under review.
162
+
163
+ MP3, WAV, and FLAC inputs are decoded to floating-point PCM; processing does not create lossy
164
+ intermediate MP3s. Export WAV or FLAC for lossless delivery, or MP3 for convenience:
165
+
166
+ ```bash
167
+ unhertz song.mp3 --remove vocals --format wav
168
+ unhertz song.mp3 --reduce cymbals:75 --format flac
169
+ unhertz song.flac --reduce cymbals:75 --format mp3
170
+ unhertz song.flac --isolate vocals --output vocals.mp3
171
+ unhertz song.mp3 --remove vocals --output revised.mp3 --force
172
+ ```
173
+
174
+ MP3 export uses up to 320 kbps and preserves standard MP3 sample rates from 8 through 48 kHz.
175
+ Rates such as 96 kHz require WAV/FLAC output or an explicit source resample. Before saving, the
176
+ complete encoded output is decoded and checked in bounded chunks. Allow temporary disk space for
177
+ float32 PCM as well as the output file; this check catches damaged or truncated encodes.
178
+
179
+ By default the input extension is preserved: removal/reduction creates `song_unhertz.mp3`, and
180
+ vocal isolation creates `song_vocals.mp3`. Existing outputs are refused unless you pass `--force`.
181
+ Keep your source recording; separation is an estimate, not time travel.
182
+
183
+ Removal subtracts estimated unwanted audio from the original mixture. It does not blindly add
184
+ all other stems and assume they reconstruct the original. Cymbal processing first estimates drums,
185
+ then estimates drum sub-stems. Leakage and artifacts can occur at both stages, especially with
186
+ distorted guitars, dense masters, and cymbal wash. Reduction often sounds more natural than total
187
+ removal. MP3 output requires another lossy encode; choose WAV or FLAC when evaluating quality.
188
+
189
+ ## CPU, GPU, and the passage of time
190
+
191
+ `--device auto` prefers available CUDA and reports a CPU fallback. Use `--device cpu` explicitly
192
+ for CPU inference or `--device cuda` to require CUDA. PyTorch must match your driver and hardware;
193
+ follow the [official installer](https://pytorch.org/get-started/locally/). Unhertz does not install
194
+ drivers or promise every PyTorch/CUDA combination works. On an out-of-memory error, retry on CPU.
195
+ See [CUDA setup and troubleshooting](docs/GPU.md) for environment installation, GPU access checks,
196
+ and a real CUDA kernel check before model inference.
197
+
198
+ Progress, selected models/devices, and elapsed time go to stderr; the saved path goes to stdout.
199
+ `--quiet` suppresses ordinary status, and `--verbose` enables diagnostic detail. No terminal
200
+ animation will audition for a role in your CI logs.
201
+
202
+ ## Cache, without the archaeology
203
+
204
+ Checkpoints and reusable separation results live in the platform's user cache directory, outside
205
+ the repository. `--cache-dir` selects another root. Changing reduction percentages reuses the same
206
+ separation; changing input content, checkpoint identity, or inference settings does not.
207
+
208
+ ```bash
209
+ unhertz cache info
210
+ unhertz cache clear --stems
211
+ unhertz cache clear --models
212
+ unhertz song.mp3 --remove vocals --no-cache
213
+ ```
214
+
215
+ `--no-cache` disables separation reuse; it does not make model weights disposable. Cache content
216
+ may contain your decoded music and extracted stems: protect it as you would the original files.
217
+
218
+ ## Contribute, preferably in tune
219
+
220
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [architecture](docs/ARCHITECTURE.md), and
221
+ [ROADMAP.md](ROADMAP.md). Local files are the supported input path. Streaming-service URLs do not
222
+ magically contain downloadable audio, and URL ingestion is deferred.
223
+
224
+ Maintainers: follow the [PyPI release setup](docs/RELEASING.md) to configure Trusted Publishing.
225
+
226
+ Original Unhertz code is [MIT licensed](LICENSE). Dependencies, FFmpeg builds, model checkpoints,
227
+ and recordings retain their own terms; see [LICENSING.md](docs/LICENSING.md).
228
+
229
+ Created by Camilla Buys. The audio survived. The cymbals are appealing the decision.
@@ -0,0 +1,193 @@
1
+ # Unhertz
2
+
3
+ > **Music has layers. Some of them are mistakes.**
4
+
5
+ A Python CLI for politely informing unwanted instruments that their services are no longer
6
+ required. Unhertz estimates instrument stems with pretrained models, then removes, reduces, or
7
+ isolates the parts you select. Your guitarist remains blissfully unaware.
8
+
9
+ The main ambition is cymbal removal from fully mixed rock and metal. That needs a drum sub-stem
10
+ model; an ordinary four-stem separator cannot tell a ride from a snare merely because we ask nicely.
11
+
12
+ **Release status:** initial implementation with real CPU and CUDA inference verified for vocals, guitar,
13
+ and the six-stem cymbal pipeline. See [quality and validation](docs/QUALITY.md) for the
14
+ tested boundary. Model code and checkpoint permissions are separate: the six-stem DrumSep weights
15
+ have unclear licensing. Demucs's author also explicitly says its weights' licensing is unclear.
16
+ Read [model licensing](docs/LICENSING.md) before downloading or
17
+ supplying a checkpoint; no commercially unrestricted installed model experience is claimed.
18
+
19
+ ## Install the eviction notice
20
+
21
+ Use Python 3.11 or 3.12 for inference. Install [FFmpeg](https://ffmpeg.org/download.html), including
22
+ `ffprobe`, and make both executables available on `PATH`. Ubuntu/Debian: `sudo apt install ffmpeg`;
23
+ macOS with Homebrew: `brew install ffmpeg`.
24
+
25
+ To install version 0.1.0 from PyPI into its own virtual environment:
26
+
27
+ ```bash
28
+ python3.11 -m venv .venv
29
+ source .venv/bin/activate
30
+ python -m pip install -U pip
31
+ python -m pip install 'unhertz[inference]==0.1.0'
32
+ unhertz --help
33
+ unhertz models
34
+ ```
35
+
36
+ For a source checkout instead:
37
+
38
+ ```bash
39
+ git clone https://github.com/camilla007/unhertz.git
40
+ cd unhertz
41
+ python3.11 -m venv .venv
42
+ source .venv/bin/activate
43
+ python -m pip install -U pip
44
+ python -m pip install '.[inference]'
45
+ unhertz --help
46
+ unhertz models
47
+ ```
48
+
49
+ In a new terminal, run `source .venv/bin/activate` from the checkout before using `unhertz`.
50
+ If another environment is active, you can use `./.venv/bin/unhertz` directly. A
51
+ `command not found` error usually means the environment containing Unhertz is not active.
52
+
53
+ The basic installation, `python -m pip install unhertz` (or `python -m pip install .` from source), includes audio processing and the CLI without
54
+ PyTorch or model inference dependencies. Help and model listings do not load neural networks.
55
+ No checkpoint ships in the wheel.
56
+
57
+ Model acquisition is explicit. Review the provenance and permissions in `unhertz models` and
58
+ [MODELS.md](docs/MODELS.md), then download the model you need:
59
+
60
+ ```bash
61
+ unhertz models download htdemucs --acknowledge-unclear-license
62
+ ```
63
+
64
+ You can instead supply a trusted compatible local HTDemucs safetensors checkpoint with
65
+ `--checkpoint`. All registry downloads require an acknowledgement of the unresolved checkpoint
66
+ permissions; the flag does not grant a licence.
67
+
68
+ ## Ask an instrument to leave
69
+
70
+ With the full-song model installed:
71
+
72
+ ```bash
73
+ unhertz song.mp3 --remove vocals
74
+ unhertz song.flac --remove bass
75
+ unhertz song.wav --remove drums --output without-drums.flac
76
+ unhertz song.mp3 --isolate vocals
77
+ unhertz song.mp3 --reduce vocals:75
78
+ ```
79
+
80
+ `--reduce vocals:75` subtracts 75% of the estimated vocal contribution, leaving approximately 25%.
81
+ These are percentages, not decibels. Percentages must be between 0 and 100.
82
+
83
+ For guitar separation, obtain and select the six-stem full-song model:
84
+
85
+ ```bash
86
+ unhertz models download htdemucs_6s --acknowledge-unclear-license
87
+ unhertz song.mp3 --model htdemucs_6s --remove guitar,bass
88
+ ```
89
+
90
+ Pick one operation: `--remove`, `--isolate`, or `--reduce`. Comma-separated instruments select
91
+ multiple stems. Unsupported instruments fail explicitly. There is no secret EQ fallback.
92
+
93
+ ## The cymbals have been asked to leave
94
+
95
+ Cymbal operations need the optional MDX23C DrumSep adapter in addition to the full-song separator.
96
+ Its checkpoint licensing remains unresolved. Real CPU and CUDA removal, reduction, and isolation checks
97
+ are recorded in [QUALITY.md](docs/QUALITY.md); listening quality on dense metal remains unverified.
98
+
99
+ ```bash
100
+ python -m pip install 'git+https://github.com/openmirlab/mdxnet-infer.git@cb4779eedeca4f55ba498df8e234e2b5f4b90aaf'
101
+ unhertz models download drumsep-6stem --acknowledge-unclear-license
102
+ unhertz song.mp3 --remove cymbals
103
+ unhertz song.mp3 --remove hihat,ride,crash
104
+ unhertz song.mp3 --reduce cymbals:75
105
+ unhertz song.mp3 --isolate kick
106
+ unhertz song.mp3 --isolate crash
107
+ ```
108
+
109
+ For your own trusted compatible weights, use `--drum-checkpoint /path/model.ckpt` and
110
+ `--drum-config /path/model.yaml`. Only use trusted checkpoints and configurations. Unhertz uses restricted loading rather than
111
+ the upstream unrestricted pickle path; see [SECURITY.md](SECURITY.md).
112
+
113
+ The download acknowledgement records your choice to obtain weights whose permissions have not
114
+ been established here. It does not grant a licence or establish permission for non-commercial use.
115
+
116
+ | Alias | Meaning |
117
+ | --- | --- |
118
+ | `cymbals` | `hihat`, `ride`, and `crash` together |
119
+ | `hh` | `hihat` |
120
+ | `vox` | `vocals` |
121
+ | `guitars` | `guitar`, when the selected model supports it |
122
+
123
+ Inspect capabilities with `unhertz models` or `unhertz song.mp3 --list-instruments`.
124
+
125
+ ## Your track is safe. Your mixing decisions remain under review.
126
+
127
+ MP3, WAV, and FLAC inputs are decoded to floating-point PCM; processing does not create lossy
128
+ intermediate MP3s. Export WAV or FLAC for lossless delivery, or MP3 for convenience:
129
+
130
+ ```bash
131
+ unhertz song.mp3 --remove vocals --format wav
132
+ unhertz song.mp3 --reduce cymbals:75 --format flac
133
+ unhertz song.flac --reduce cymbals:75 --format mp3
134
+ unhertz song.flac --isolate vocals --output vocals.mp3
135
+ unhertz song.mp3 --remove vocals --output revised.mp3 --force
136
+ ```
137
+
138
+ MP3 export uses up to 320 kbps and preserves standard MP3 sample rates from 8 through 48 kHz.
139
+ Rates such as 96 kHz require WAV/FLAC output or an explicit source resample. Before saving, the
140
+ complete encoded output is decoded and checked in bounded chunks. Allow temporary disk space for
141
+ float32 PCM as well as the output file; this check catches damaged or truncated encodes.
142
+
143
+ By default the input extension is preserved: removal/reduction creates `song_unhertz.mp3`, and
144
+ vocal isolation creates `song_vocals.mp3`. Existing outputs are refused unless you pass `--force`.
145
+ Keep your source recording; separation is an estimate, not time travel.
146
+
147
+ Removal subtracts estimated unwanted audio from the original mixture. It does not blindly add
148
+ all other stems and assume they reconstruct the original. Cymbal processing first estimates drums,
149
+ then estimates drum sub-stems. Leakage and artifacts can occur at both stages, especially with
150
+ distorted guitars, dense masters, and cymbal wash. Reduction often sounds more natural than total
151
+ removal. MP3 output requires another lossy encode; choose WAV or FLAC when evaluating quality.
152
+
153
+ ## CPU, GPU, and the passage of time
154
+
155
+ `--device auto` prefers available CUDA and reports a CPU fallback. Use `--device cpu` explicitly
156
+ for CPU inference or `--device cuda` to require CUDA. PyTorch must match your driver and hardware;
157
+ follow the [official installer](https://pytorch.org/get-started/locally/). Unhertz does not install
158
+ drivers or promise every PyTorch/CUDA combination works. On an out-of-memory error, retry on CPU.
159
+ See [CUDA setup and troubleshooting](docs/GPU.md) for environment installation, GPU access checks,
160
+ and a real CUDA kernel check before model inference.
161
+
162
+ Progress, selected models/devices, and elapsed time go to stderr; the saved path goes to stdout.
163
+ `--quiet` suppresses ordinary status, and `--verbose` enables diagnostic detail. No terminal
164
+ animation will audition for a role in your CI logs.
165
+
166
+ ## Cache, without the archaeology
167
+
168
+ Checkpoints and reusable separation results live in the platform's user cache directory, outside
169
+ the repository. `--cache-dir` selects another root. Changing reduction percentages reuses the same
170
+ separation; changing input content, checkpoint identity, or inference settings does not.
171
+
172
+ ```bash
173
+ unhertz cache info
174
+ unhertz cache clear --stems
175
+ unhertz cache clear --models
176
+ unhertz song.mp3 --remove vocals --no-cache
177
+ ```
178
+
179
+ `--no-cache` disables separation reuse; it does not make model weights disposable. Cache content
180
+ may contain your decoded music and extracted stems: protect it as you would the original files.
181
+
182
+ ## Contribute, preferably in tune
183
+
184
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [architecture](docs/ARCHITECTURE.md), and
185
+ [ROADMAP.md](ROADMAP.md). Local files are the supported input path. Streaming-service URLs do not
186
+ magically contain downloadable audio, and URL ingestion is deferred.
187
+
188
+ Maintainers: follow the [PyPI release setup](docs/RELEASING.md) to configure Trusted Publishing.
189
+
190
+ Original Unhertz code is [MIT licensed](LICENSE). Dependencies, FFmpeg builds, model checkpoints,
191
+ and recordings retain their own terms; see [LICENSING.md](docs/LICENSING.md).
192
+
193
+ Created by Camilla Buys. The audio survived. The cymbals are appealing the decision.
@@ -0,0 +1,20 @@
1
+ # Roadmap
2
+
3
+ ## Before a public stable release
4
+
5
+ - Establish explicit checkpoint licensing, particularly for the six-stem DrumSep model.
6
+ - Expand the recorded full-song and cymbal checks to more recordings and hardware combinations.
7
+ - Evaluate cymbal leakage, transients, and distorted-guitar damage on recordings we may redistribute.
8
+ - Expand supported inference combinations only after testing their dependencies and hardware.
9
+ - Configure the protected PyPI environment and Trusted Publisher, then obtain release authorization.
10
+
11
+ ## After the first usable release
12
+
13
+ - A licensed, redistributable audio regression corpus and listening protocol.
14
+ - Measured CPU/GPU memory and processing-time guidance with hardware and model settings disclosed.
15
+ - Better long-recording memory bounds and restartable work where measurements justify the complexity.
16
+ - Additional models only when they add verified capabilities with clear provenance.
17
+ - Optional, isolated URL ingestion for sources that permit downloads; no DRM circumvention.
18
+
19
+ There is no promise of perfect cymbal removal. If that becomes possible, several mastering
20
+ engineers would like a word.
@@ -0,0 +1,21 @@
1
+ # Security policy
2
+
3
+ Report suspected vulnerabilities privately to camilla.buys@gmail.com. Include the affected version,
4
+ reproduction steps, impact, and a suggested mitigation where available. Do not include credentials,
5
+ private recordings, or model weights. The current `main` branch and latest published release are
6
+ the supported targets; there may not yet be a published release.
7
+
8
+ ## Trust boundaries
9
+
10
+ Unhertz processes local files with FFmpeg and optional machine-learning libraries. Keep those
11
+ dependencies patched. Files, paths, and subprocess arguments must never be interpolated into shell
12
+ commands. The application does not bypass DRM or streaming-platform access controls.
13
+
14
+ Legacy PyTorch checkpoints may contain Python pickle data capable of executing code during loading.
15
+ Only use trusted checkpoints and configuration. A checksum proves identity relative to a digest;
16
+ it does not establish authorship, safety, or permission. The model registry distinguishes published
17
+ digests from locally computed integrity hashes. Review any upstream configuration before use.
18
+
19
+ Caches contain audio derivatives and model files. Store them on a private filesystem, avoid shared
20
+ writable cache roots, and clear stem caches when retention is inappropriate. Logs should never
21
+ include audio payloads, credentials, or full environment dumps.