Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

speakeronnx

speakeronnx is a speaker embedding library built on onnxruntime. It does not need torch at runtime.

The library extracts speaker embeddings from audio, computes cosine similarity between them, and verifies speaker identity. It downloads ONNX models from HuggingFace automatically.

Model collection: OpenVoiceOS/speaker-embeddings-onnx

Install

pip install speakeronnx

Optional high-quality resampling:

pip install speakeronnx soxr

Quick start

from speakeronnx import SpeakerEmbedder, cosine, verify

embedder = SpeakerEmbedder(model="wespeaker-resnet34")

alice1 = embedder.embed("alice_clip1.wav")
alice2 = embedder.embed("alice_clip2.wav")
bob    = embedder.embed("bob_clip1.wav")

print(cosine(alice1, alice2))   # e.g. 0.82  - same speaker
print(cosine(alice1, bob))      # e.g. 0.21  - different speaker

ok, score = verify(alice1, alice2, threshold=0.45)
print(ok, score)  # True 0.82

More examples in examples/.

CLI

speakeronnx list                              # list available models
speakeronnx embed clip.wav                    # extract embedding
speakeronnx verify a.wav b.wav               # same-speaker check (exit 0/1)
speakeronnx verify a.wav b.wav --threshold 0.5
speakeronnx embed clip.wav --model wespeaker-ecapa512

Full CLI reference in docs/cli.md.

Models

The library registers 9 models in MODEL_REGISTRY. Each one downloads on first use:

Alias Embed dim Frontend License
wespeaker-resnet34 256 fbank80 cc-by-4.0
wespeaker-ecapa512 192 fbank80 cc-by-4.0
wespeaker-resnet293 256 fbank80 cc-by-4.0
campplus 512 fbank80 cc-by-4.0
campplus-zh-en 192 fbank80 apache-2.0
eres2net 192 fbank80 apache-2.0
titanet-small 192 fbank80 cc-by-4.0
titanet-large 192 fbank80 cc-by-4.0
redimnet-b2 192 raw apache-2.0

Full model comparison and selection guide in docs/models.md.

Documentation

Document Description
docs/index.md Full getting-started guide
docs/models.md Model comparison, selection, frontend/layout details
docs/api.md Complete API reference
docs/cli.md CLI usage reference
docs/frontend.md Feature frontend (fbank80 vs raw) technical details
docs/advanced.md Custom models, GPU, threshold tuning

Examples

Script Description
examples/basic_embedding.py Extract embedding from a single WAV
examples/verify_speakers.py Verify two clips, try multiple thresholds
examples/compare_models.py Compare all models on same utterances
examples/batch_enrollment.py Enroll speakers from directories, match unknown
examples/custom_model.py Load a custom ONNX model from disk
examples/gpu_inference.py CUDA / CoreML inference

Tests

# Unit tests (mocked, no downloads, no network)
pytest tests/test_unit.py tests/test_audio.py tests/test_frontend.py \
      tests/test_embedder.py tests/test_cli.py tests/test_model_registry.py -v

# End-to-end tests (downloads models + generates TTS audio)
pytest tests/test_e2e.py -v -s

Each registered model has an HF source, license, and embedding dimension:

Alias HF repo License Embed dim Description
wespeaker-resnet34 Wespeaker/wespeaker-voxceleb-resnet34-LM cc-by-4.0 256 ResNet34 r-vector, VoxCeleb2 Dev - recommended default
wespeaker-ecapa512 Wespeaker/wespeaker-ecapa-tdnn512-LM cc-by-4.0 192 ECAPA-TDNN-512 x-vector, VoxCeleb2 Dev
wespeaker-resnet293 Wespeaker/wespeaker-voxceleb-resnet293-LM cc-by-4.0 256 ResNet293 r-vector - highest accuracy, 28M params
campplus csukuangfj/speaker-embedding-models cc-by-4.0 512 CAM++ (D-TDNN backbone), VoxCeleb2 Dev
campplus-zh-en csukuangfj/speaker-embedding-models apache-2.0 192 3D-Speaker CAM++ multilingual (zh+en)
eres2net csukuangfj/speaker-embedding-models apache-2.0 192 ERes2Net, VoxCeleb
titanet-small csukuangfj/speaker-embedding-models cc-by-4.0 192 NVIDIA NeMo TitaNet-small (~40 MB)
titanet-large csukuangfj/speaker-embedding-models cc-by-4.0 192 NVIDIA NeMo TitaNet-large (~101 MB)
redimnet-b2 OpenVoiceOS/redimnet-b2-vox2-onnx apache-2.0 192 ReDimNet b2 (1.8M params), raw audio input

Run speakeronnx list to print descriptions and metadata for all registered models.

Feature frontend

  • fbank80 models use an 80-dim log-Mel filterbank with per-utterance CMN, implemented in pure numpy. See docs/frontend.md.
  • raw models (redimnet-b2) pass the raw 16 kHz waveform directly to ONNX. The model has an internal MelSpectrogram.

Audio requirements

  • Mono PCM WAV, any bit depth (8/16/24/32-bit int, 32-bit float)
  • Any sample rate (the library resamples internally to 16 kHz)
  • The library downmixes stereo files to mono
  • Minimum length ~1 second
  • Recommended enrollment length 5-30 seconds per speaker

Dependencies

  • onnxruntime
  • numpy
  • huggingface_hub
  • soxr (optional, for high-quality resampling)

Metadata

Release files for speakeronnx 0.0.3a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speakeronnx 0.0.3a1
File Size Uploaded Provenance Actions
speakeronnx-0.0.3a1.tar.gz 30.2 kB Without provenance Details for speakeronnx-0.0.3a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for speakeronnx 0.0.3a1
File Interpreter ABI Platform Actions
speakeronnx-0.0.3a1-py3-none-any.whl Python 3 none any Details for speakeronnx-0.0.3a1-py3-none-any.whl

Total release size: 65.4 kB

Release files / speakeronnx-0.0.3a1.tar.gz

Download URL speakeronnx-0.0.3a1.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a0618dafa172b9f7d53157c17875e259dfeae5b50761fd942ad998d795ed4f8d
BLAKE2b-256 checksum
How to use checksums
0623aa0b7d0a3b925db5e4c473e1c0e761527572e8445e5a8e426992fcb8f31d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / speakeronnx-0.0.3a1-py3-none-any.whl

Download URL speakeronnx-0.0.3a1-py3-none-any.whl
Size 35.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0605dc888e5a7525350c03e1db90130618418e5c4f66b402fa6ef13b93dff033
BLAKE2b-256 checksum
How to use checksums
70052b3849b59a64d0f012d65e0dccfc1e3a794738acd75ebbd28ebaa7d10168
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for speakeronnx 0.0.3a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page