Match voice conversion pitch to reference with optional CPU correction

This commit is contained in:
Mikei386 committed 2026-10-19 14:45:44 +02:00
1 parent 04cd46e3e6
commit 369cb2ffe5
16 files changed
+408 -19

No files matched your search

+38
View File
@@ -75,3 +75,41 @@ 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.