File size: 2,310 Bytes
cd6970c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | ---
license: apache-2.0
tags:
- voice-conversion
- onnx
- vconnx
- focalcodec
- speech
library_name: vconnx
---
# vconnx-focalcodec
ONNX artifacts for the **FocalCodec** voice-conversion engine in
[vconnx](https://github.com/TigreGotico/vconnx) β a pure-ONNX multi-engine
voice-cloning library (no torch at runtime).
## VC Mechanism
FocalCodec (Della Libera et al., NeurIPS 2025) exposes continuous pre-VQ
features from its WavLM encoder. Voice conversion is a kNN feature-space
swap (cosine distance, k=4) β the same approach as kNN-VC:
1. **WavLM encoder** (`focalcodec_encoder.onnx`) β 16 kHz audio β
(T, 1024) feature frames at 50 Hz.
2. **kNN matching** β pure numpy, cosine distance; no ONNX needed.
3. **Vocos backbone + proj** (`focalcodec_vocoder.onnx`) β matched
(T, 1024) features β (T, n_fft+2) STFT coefficients.
4. **numpy ISTFT** β pure numpy overlap-add; implemented in the adapter
(parity vs torch β€ 1.3e-5 max abs).
## Files
| File | Size | Description |
|---|---|---|
| `focalcodec_encoder.onnx` | 594.6 MB | WavLM encoder, fp32, opset 14 |
| `focalcodec_encoder_q8.onnx` | 341.2 MB | WavLM encoder, INT8 quantized |
| `focalcodec_vocoder.onnx` | 64.3 MB | Vocos backbone + proj, fp32, opset 14 |
| `focalcodec_vocoder_q8.onnx` | 16.3 MB | Vocos backbone + proj, INT8 quantized |
| `config.json` | β | Engine manifest |
| `PROVENANCE.md` | β | Export lineage |
## Parity
| Component | max abs error | mean abs error |
|---|---|---|
| encoder (fp32) | 4.2e-4 | 1.8e-5 |
| vocoder backbone (fp32) | 2.7e-5 | 2.1e-6 |
| numpy ISTFT vs torch | 1.3e-5 | 3.3e-7 |
## Usage
```bash
pip install vconnx[focalcodec]
```
```python
from vconnx import VoiceCloner
cloner = VoiceCloner(engine="focalcodec")
out = cloner.clone_voice("source.wav", "reference.wav", "output.wav")
```
## License
Apache-2.0 β upstream weights and code are Apache-2.0
([lucadellalib/focalcodec](https://github.com/lucadellalib/focalcodec)).
These ONNX artifacts are derived from `lucadellalib/focalcodec_50hz`
checkpoint at v0.0.2.
## References
- Paper: https://arxiv.org/abs/2502.04465
- Upstream: https://github.com/lucadellalib/focalcodec
- Upstream checkpoint: https://huggingface.co/lucadellalib/focalcodec_50hz
- vconnx: https://github.com/TigreGotico/vconnx
|