asrfront
Super-fast frontend (feature extraction) for ASR models such as Whisper and SenseVoiceSmall.
- native C core with no dependencies (own FFT, SIMD kernels with runtime CPU dispatch)
- Python binding based on nanobind, zero-copy NumPy output
- numerically matches the reference implementations (see Accuracy)
import asrfront
mel = asrfront.whisper.log_mel(audio) # (80, 3000)
feat = asrfront.sensevoice.fbank(audio, cmvn="am.mvn") # (T', 560)
Install
pip install asrfront
Wheels: Linux (x86_64, aarch64), Windows (x86_64); CPython 3.9+
(one abi3 wheel covers 3.12 and later). Building from source needs a C11/C++17 compiler.
Usage
audio is a 16 kHz mono waveform: a float array in [-1, 1], int16 PCM, a list, or a CPU
torch tensor. Resampling and decoding are out of scope.
Whisper
from asrfront import whisper
mel = whisper.log_mel(audio) # (80, 3000): pad/trim to 30 s like whisper
mel = whisper.log_mel(audio, n_mels=128) # large-v3
mel = whisper.log_mel(audio, pad_or_trim=False) # (80, len(audio) // 160)
batch = whisper.log_mel_batch([a1, a2, a3]) # (3, 80, 3000), multi-threaded
Equivalent to whisper.log_mel_spectrogram(whisper.pad_or_trim(audio), n_mels).
SenseVoice
from asrfront import sensevoice
feat = sensevoice.fbank(audio, cmvn="path/to/am.mvn") # (ceil(T / 6), 560)
feats, lengths = sensevoice.fbank_batch([a1, a2], cmvn="path/to/am.mvn") # zero-padded
raw = sensevoice.fbank_raw(audio) # (T, 80) kaldi fbank only
shift, scale = sensevoice.load_cmvn("path/to/am.mvn")
Equivalent to FunASR's WavFrontend (torchaudio.compliance.kaldi.fbank on the int16-scaled
waveform with a Hamming window, dither=0, then LFR m=7, n=6 and CMVN from am.mvn).
dither= and seed= are available; the RNG is reseeded on every call so identical inputs
give identical outputs.
Threads
All native calls release the GIL. The *_batch functions spread items over a thread pool
(n_threads=None uses every available core); each Python thread uses its own native handle.
Performance
30 s of audio, single thread, Intel i5-14400F (AVX2), best of N runs
(uv run --group ref --group bench python bench/compare.py):
| asrfront | reference | speed-up | |
|---|---|---|---|
| Whisper log-mel (80 × 3000) | 0.85–0.95 ms | openai-whisper log_mel_spectrogram (torch) 8.6–9.6 ms |
~10x |
| librosa STFT + mel (numpy) 6.6–7.0 ms | ~7.7x | ||
| SenseVoice fbank + LFR + CMVN | 1.3–1.4 ms | FunASR WavFrontend (torchaudio) 12–14 ms |
~9–10x |
| kaldi fbank only | 1.3 ms | torchaudio.compliance.kaldi.fbank 11–12 ms |
~9x |
Full results (thread scaling, input lengths, kernel variants, methodology):
docs/benchmark.md.
Kernels process 8 frames at a time in SIMD lanes. On x86-64 an AVX2 build is selected at
runtime when available (asrfront._ext.kernel_isa()); ASRFRONT_KERNELS=generic forces the
baseline build. All variants give bit-identical results. Batch of 32 × 30 s: ~7.5 ms with
16 threads.
Accuracy
Maximum absolute error against float64 reference implementations
(tests/python/reference.py) over 16 test signals (silence,
tones, chirp, noise, clipping, DC offset, real speech, short and > 30 s inputs):
| worst case | speech | target | |
|---|---|---|---|
| Whisper log-mel (80 and 128 mels) | 4.0e-5 | 1.3e-5 | 1e-4 |
| kaldi fbank (log domain) | 7.7e-4 | 2.0e-4 | 1e-3 |
SenseVoice features with SenseVoiceSmall's am.mvn |
1.1e-4 |
The whisper mel filters are bit-identical to whisper's mel_filters.npz. Against the
original float32 libraries: ≤ 1e-4 vs. whisper (torch) and ≤ 2e-3 vs. torchaudio's kaldi
fbank (torchaudio builds its mel banks in float32).
Development
uv sync # create .venv and build the extension (needs a C compiler)
uv run pytest # tests; add --group ref for torch/torchaudio comparisons
uv run --group ref pytest
uv run cmake -S . -B build/ctest -G Ninja -DASRFRONT_BUILD_TESTS=ON -DASRFRONT_BUILD_BENCH=ON
uv run cmake --build build/ctest && uv run ctest --test-dir build/ctest
The C API is in csrc/include/asrfront.h. The preprocessing of each
model is documented step by step in docs/whisper.md and
docs/sensevoice.md; see plan.md for design and
implementation notes.
License
MIT. Test data in tests/data comes from openai/whisper
(MIT); see tests/data/README.md.
Metadata
Release files for asrfront 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asrfront-0.1.0.tar.gz | 590.1 kB | Details |
Built distributions (wheels)
Total release size: 1.9 MB
Release files / asrfront-0.1.0.tar.gz
| Download URL | asrfront-0.1.0.tar.gz |
|---|---|
| Size | 590.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d31883cbc2ea6903c42deabdb1d0116b5ee99ec6639e6fec7cd94a81898f937b
|
|
BLAKE2b-256 checksum How to use checksums |
e26fceaafea026b348abb5ea0445d9dd12c53a15323e1d010934455e444ce00b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp312-abi3-win_amd64.whl
| Download URL | asrfront-0.1.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 116.0 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e9d0ee7d091e457700265895b562a41dcfb6f9bd80f467c2a08e4338f5956c31
|
|
BLAKE2b-256 checksum How to use checksums |
2c8ae62a0a639ea0c2743927b6b77079866846bab271dd966d01edf303346be2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | asrfront-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 117.2 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2ddf00f917cc6d1ecc265474d46a0a5221c2242e9e13ba54b1b964c3517b8ee8
|
|
BLAKE2b-256 checksum How to use checksums |
923e60b59867e8b9306b6d3034b9920a72d90fc9204f75991750258ce3e4e491
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | asrfront-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 104.0 kB |
| Tags | CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
50a9f9939e06ce30252c00d6a9e40c0be314ff84363528980da92f9f3ad0f207
|
|
BLAKE2b-256 checksum How to use checksums |
ac8753a3115af23a948e9dcefc3dfda36d9035390d560ad4d9002dc259899d75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp311-cp311-win_amd64.whl
| Download URL | asrfront-0.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 116.7 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f40c362a10fd40b3cb823b1e815f66d521e431661b3854a65f0f21157ebba2a8
|
|
BLAKE2b-256 checksum How to use checksums |
ab402206a005db1ca90cacaf5e45f0a51f219a4ab7cd4993261d2edbf3c671aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | asrfront-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 121.7 kB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
50c93fe3856d9d869c0a6792ffd1050601c2c012b4fe5dbbbf43f25aa3f096cd
|
|
BLAKE2b-256 checksum How to use checksums |
cdd15312c521d5efdf95e9e618e184806b34989b0f2beac9bf8a5fcc8c2d9861
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | asrfront-0.1.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 108.7 kB |
| Tags | CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
2e9be69ad085d1d4e230dce2fadda8bb30ca390b1abb6f74522f14235192e380
|
|
BLAKE2b-256 checksum How to use checksums |
30d07e0b909f150bc474d4c8880537eda1b19556f7e9aacc0fb84cfb1f33c99d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp310-cp310-win_amd64.whl
| Download URL | asrfront-0.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 116.3 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5744b34fb020ee8710286ce61a20806f6fc5e73a7b9101f0f65fe88a3b2540f3
|
|
BLAKE2b-256 checksum How to use checksums |
fd26d517d2ef9fe1bb59a247f4d891a18ab6ea87aaf6ff61eb329509792950a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | asrfront-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 122.2 kB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e0a11a24c09b05d4b71d51f600eec391e5d0e62b18fe8702c448b3fa99611e33
|
|
BLAKE2b-256 checksum How to use checksums |
f482d5735f0bb574d1fb24ec841ec460402ac15306478bad8fe4ddfae2bbba01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | asrfront-0.1.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 109.0 kB |
| Tags | CPython 3.10 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
4c2bde5b6c4de5975cfd174f35e2e2e5ddcc8d63565864b1b88ab060fb2e1d6b
|
|
BLAKE2b-256 checksum How to use checksums |
f5203390d346b829f4a04fcd91218fb5dce5865b91ab5dc6e56981e3c0332800
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp39-cp39-win_amd64.whl
| Download URL | asrfront-0.1.0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 96.6 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
97f0e5b28532f85f5e42fe53ee204a2a3b26ffe83d20a44d60f5c65dfe5f93f0
|
|
BLAKE2b-256 checksum How to use checksums |
f10e11a807702f25e4a87b9a30d0ff39c53bbefdabb59948f652a1bbb1b9bfe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | asrfront-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 116.2 kB |
| Tags | CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
48386981898895d93394afaeb90ea343dc4f14eb99c050457a0b8930480d19ec
|
|
BLAKE2b-256 checksum How to use checksums |
6287bcd51964d04cfa60df62b1e887757edc2488da193d19cce01f8604d4b883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / asrfront-0.1.0-cp39-cp39-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | asrfront-0.1.0-cp39-cp39-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 103.2 kB |
| Tags | CPython 3.9 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
43de4b40e25727162e45932ac2e51bd533770977dc0ed59994bc0c3c7ab04853
|
|
BLAKE2b-256 checksum How to use checksums |
e1da2d7ac7d6da37e40caa01e57a26e53552a6bf5cafa213971ee9e62a2755a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency log