116 lines
7.3 KiB
Markdown
116 lines
7.3 KiB
Markdown
# Humaneness Voice Converter runtime
|
||
|
||
Upstream model: `laion/Humaneness-Voice-Converter`, revision
|
||
`952ef56c945763be50432738e31a32c30b359619`. This is actual audio-to-audio
|
||
conversion, not STT/TTS. Upstream inference code and weights are unmodified.
|
||
The fixed CLI accepts 1–30 second mono source and target WAV; a clean5–10s
|
||
reference is recommended. Input timing/content and style are used directly.
|
||
Exact pitch, every pause, word, identity and emotion are not guaranteed.
|
||
No independent Qwen/ElevenLabs quality equivalence is claimed.
|
||
|
||
## Provisioning (native or Deck container)
|
||
|
||
Requires Python3.12, venv/pip, FFmpeg, CUDA-compatible NVIDIA driver and a CUDA
|
||
PyTorch2.9.1 runtime for inference. The tested preparation uses Deck's
|
||
Python3.12.3; native Debian must explicitly provide compatible Python3.12 and
|
||
`python3.12-venv`, FFmpeg and the NVIDIA driver. These must not be assumed to
|
||
come from another model/service. No new system service is required: Deck owns
|
||
the short-lived per-job model process.
|
||
|
||
1. Set `STATE` to the native Deck state root, or the configured container's
|
||
persistent state root **inside** that container. Set `DECK_USER` to its real
|
||
service user. Create `$STATE/humaneness-runtime` owned by that user, mode0700.
|
||
2. Copy `bootstrap.py`, `assets.json`, `upstream-requirements.txt` and
|
||
`requirements.lock` there from this exact Git revision. As that user run:
|
||
`CUDA_VISIBLE_DEVICES='' python3.12 "$STATE/humaneness-runtime/bootstrap.py"`.
|
||
3. This creates an isolated venv, downloads only the pinned public assets,
|
||
checks their SHA256/Git blob hashes and runs a complete CPU import. GPU is
|
||
hidden throughout preparation. Check `prepare-status.json` for `complete`;
|
||
`ready` is written only after success. Keep `verified-assets.json` and lock
|
||
with deployment evidence. The first resolved dependency set is recorded in
|
||
the committed lock; Chatterbox is installed with `--no-deps` as upstream
|
||
requires because its old dependency metadata conflicts with the tested stack.
|
||
4. Deck startup registers a model-library link and creates the initial profile
|
||
`Humaneness Voice Conversion` (`humaneness-vc`) once. Publication remains a
|
||
normal GUI action under the API endpoint; there is no implicit token or
|
||
access grant. Start Stimmatelier and choose that profile.
|
||
|
||
Current preparation used a disposable CPU-only container based on the existing
|
||
Deck image, with only this runtime directory mounted, no GPU,2CPU/6GiB RAM.
|
||
Remove that preparation container after acceptance. It is not an operational
|
||
service or a runtime dependency. Native provisioning follows the same script.
|
||
Venv interpreter paths must match the executing Python installation; rebuild
|
||
the venv from the recipe when OS/Python changes. Do not copy it between hosts.
|
||
|
||
## Execution and API
|
||
|
||
The existing Deck FIFO scheduler waits for or rejects busy GPU work; it never
|
||
kills an active LLM request. Conversion then evicts idle models, uses RTX3060
|
||
with at least8.5GiB free VRAM and6GiB Deck RAM, and releases its process/GPU at
|
||
completion. CPU Qwen's warm worker is separate. Settings: one candidate, BF16,
|
||
10 upstream flow steps, upstream seed. These controls are fixed in this initial
|
||
integration; the generic voice-profile TTS parameters do not control conversion.
|
||
There is no hidden live mode, automatic model download, external speech API,
|
||
Docker socket or new credential. Inference is offline after preparation.
|
||
|
||
GUI: `/api/v1/conversion/start`, status `/api/v1/conversion`, audio
|
||
`/api/v1/conversion/audio?id=<id>`, cancellation `/api/v1/conversion/cancel`.
|
||
Normal Deck session/CSRF rules apply. Multipart fields: `profile_id`, `source`,
|
||
`reference`. Both files: PCM16 mono WAV16/24/48kHz,1–30s, ≤16MiB each.
|
||
|
||
Published service API (existing Bearer token):
|
||
`GET /v1/audio/voice-conversions/models` and
|
||
`POST /v1/audio/voice-conversions`, fields `model=humaneness-vc`, `source`,
|
||
`reference`. Returns `audio/wav`. These are **Deck extensions**, not standard
|
||
OpenAI TTS routes. The model is intentionally absent from text-to-speech model
|
||
lists; a client must explicitly support audio-to-audio conversion.
|
||
|
||
Original source/reference files are deleted after success, failure or cancel.
|
||
The output WAV, technical stderr and non-text job metadata remain in
|
||
`$STATE/humaneness-jobs`. This folder is included in the encrypted userdata
|
||
backup. Model/runtime files are reconstructible from Git and the fixed public
|
||
manifest and excluded from pre-update private-state snapshots. Preserve profiles,
|
||
API configuration and private output jobs using Deck's normal backups. This
|
||
recipe has not been accepted as a full fresh-Debian-host restore.
|
||
|
||
CC BY4.0 applies to LAION additions/weights; upstream Chatterbox MIT notices are
|
||
retained in the downloaded model's NOTICE. Dependencies keep their own licences.
|
||
|
||
## Optional reference pitch matching (Deck extension)
|
||
|
||
Stimmatelier defaults to **Tonhöhe automatisch an Referenz anpassen** and an
|
||
additional -12..+12 semitone slider (0.5 steps). The service API is backwards
|
||
compatible: omitted options disable correction. Optional multipart fields are
|
||
`pitch_auto=true|false` and `pitch_semitones=-12..12` (finite decimal).
|
||
Automatic correction compares the voiced median F0 of the reference and the
|
||
**converted output**, not gender labels or a fixed female pitch. A constant
|
||
semitone shift then changes the output's pitch, preserving its relative contour.
|
||
Manual shift is added to the automatic value; the total is clamped to ±12.
|
||
|
||
Own helper `humaneness_pitch.py` runs CPU-only in the already pinned Humaneness
|
||
venv. pYIN (librosa1.0.0,16kHz,60–650Hz,1024/256 samples) uses the RMS-filtered voiced HMM track for the median, with at least12
|
||
frames of posterior≥0.1 as a separate confidence gate (to avoid vowel-selection
|
||
bias from retaining only high-posterior frames). Unreliable
|
||
or silent clips produce a visible warning and skip only the automatic part.
|
||
FFmpeg `rubberband=tempo=1:formant=preserved:pitchq=quality` applies the change;
|
||
`apad,atrim` and an exact frame-count check preserve the converted WAV length.
|
||
No extra GPU, models, container or network service. An isolated Numba cache in
|
||
`humaneness-runtime/numba-cache` is reconstructible. The first run can take longer.
|
||
Correction is separately cancellable as part of the same job (180s CPU deadline).
|
||
|
||
Native Debian: install the distribution's `ffmpeg` package with librubberband
|
||
support (`ffmpeg -hide_banner -filters | grep rubberband`); the pinned Python
|
||
runtime already includes librosa, numba, numpy and soundfile. Missing filter or
|
||
worker errors fail the requested corrected job explicitly rather than returning
|
||
an uncorrected file as success. No in-place modification of upstream inference
|
||
code or weights. Job metadata includes measured F0, requested/applied shift and
|
||
warnings; `pitch.json` is included with the existing encrypted job backup.
|
||
Update/recovery: rebuild Deck and Stimmatelier from the saved revisions, rebuild
|
||
the venv from the lock if needed; old calls without options retain old behavior.
|
||
No new private configuration or credentials; raw reference/source cleanup remains.
|
||
|
||
Pitch matching is DSP, not a guarantee of perceived identity or perfect prosody.
|
||
RMS envelopes and word boundaries may change slightly; large shifts can sound
|
||
artificial. It preserves duration exactly, not every individual waveform sample
|
||
or silence edge. Only recorded acceptance below supports deployed measurements.
|