Skip to main content

Kudio

Kudio, audio processing

PyPI Python License: MIT Docs DOI

Kudio is a Python library for audio, speech most of all: files, features, effects, rooms and phone lines, noisy-data synthesis, denoising, recording, and the metrics speech papers report. Most of it is functions over a numpy array and a sample rate.

The documentation has a guide to each part, the API reference, and how each metric is checked against its reference implementation.

Install

pip install kudio

Python 3.9 or newer. The core install is numpy, scipy, soundfile, soxr, PyYAML and tqdm, and reads WAV, FLAC, OGG, MP3 and AIFF. The extras:

Extra Adds
audio recording and playback (sounddevice)
pesq PESQ; PyPI has pesq as source only, so it needs a C compiler
dnsmos DNSMOS P.835 and P.808 (onnxruntime; the weights come from Microsoft's DNS-Challenge)
viz plotting helpers (matplotlib)
data dataframes and Excel export (pandas, openpyxl)
compressed m4a, aac and webm (audioread, with ffmpeg on the PATH)
all all of the above except pesq
pip install "kudio[audio,viz]"

Quick start

A clean signal, the same under white noise, then a check, a denoiser and a score:

import numpy as np
import kudio

sr = 16000
t = np.arange(4 * sr) / sr
phase = 2 * np.pi * np.cumsum(120 + 20 * np.sin(np.pi * t)) / sr
voice = sum(np.sin(k * phase) / k for k in range(1, 20))
clean = (0.1 * voice * np.clip(np.sin(3 * np.pi * t), 0, None)).astype(np.float32)
noisy = kudio.add_noise_snr(clean, np.random.default_rng(7).standard_normal(len(t)),
                            snr_db=0, seed=0)
kudio.save_wave("noisy.wav", noisy, sr)

y, sr = kudio.file_load("noisy.wav")            # float32, at the file's own rate
print(kudio.audio_report(y, sr))                # no clean reference needed
denoised = kudio.spectral_enhance(y, sr)        # log-MMSE over an MCRA noise estimate
s = kudio.score(clean, denoised, sr, ["si_sdr", "stoi"])
print(f"SI-SDR {s['si_sdr']:.2f} dB, STOI {s['stoi']:.3f}")
kudio.save_wave("denoised.wav", denoised, sr)
4.00s @ 16000 Hz · peak -10.1 dBFS · -22.8 LUFS · SNR~7 dB · bandwidth 8000 Hz
SI-SDR 8.34 dB, STOI 0.725

What is in it

Part Functions
Files file_load, save_wave, audio_info, resample, convert_folder
Features STFT, waveform_to_spectrogram, mfcc, melspectrogram, stack_context, Standardizer
Inspection audio_report, loudness, normalize_lufs, true_peak, srmr, wada_snr, dnsmos
Speech and pitch vad, vad_split, f0, save_labels
Editing and effects fade, highpass, splice, trim_silence, pitch_shift, add_noise_snr, spec_augment
Rooms and channels rir, apply_rir, rt60, telephone, dropouts, apply_channel
Noisy datasets Synthesizer, save_manifest, load_manifest, split_pairs
Denoising spectral_enhance (seven gain rules, four noise estimators), StreamEnhancer, compare_enhancers, enhance_folder
Quality metrics score, pesq, si_sdr, composite, mcd, ncm, siib, bss_eval, align, score_dataset, bootstrap_ci, cite
Recognizers, verifiers, pitch trackers wer, cer, eer, min_dcf, cllr, der, jer, f0_errors
Recording record, StreamRecorder, SpectrogramStream, play_audio, list_devices

Everything here is importable from the top level, kudio.….

Command line

kudio info clip.wav                            # rate, channels, length, peak
kudio report clip.wav                          # health check; exit 1 if wrong
kudio loudness clip.wav --target -23           # exit 1 if it misses EBU R 128
kudio normalize in.wav out.wav --lufs -23
kudio vad clip.wav --split-to spans/
kudio pitch clip.wav --segments
kudio convert raw/ 16k/ --rate 16000 --recursive
kudio trim in.wav out.wav --top-db 30
kudio room --make room.wav --rt60 0.6
kudio channel in.wav out.wav --telephone
kudio synth --clean C --noise N --out O --snr -5 0 5 --seed 17
kudio enhance noisy/ clean/ --recursive
kudio compare in.wav --reference clean.wav     # rank every method
kudio align clean.wav processed.wav --metrics
kudio score enhanced/ --reference clean/ --baseline noisy/
kudio devices

The commands that check something exit 1 when they find a problem, so kudio report clip.wav || echo "needs another take" works in a shell script.

Errors

kudio's own exceptions derive from kudio.KudioError: AudioIOError, FeatureError (also a ValueError), DeviceError, SynthesisError and DependencyError (also an ImportError, naming the extra to install). Argument checks raise ValueError or TypeError. A metric refuses NaN and int64 samples with a ValueError that starts with its name, and scores nan with one warning where there is nothing to score.

Citing Kudio

Zenodo archives the releases under 10.5281/zenodo.24219274, which resolves to the newest one, and CITATION.cff holds what GitHub shows under "Cite this repository". kudio.cite writes the BibTeX for Kudio and for the works behind the metrics you report, Kudio first:

import kudio

print(kudio.cite(["pesq", "stoi", "si_sdr"]))

kudio.metric_info("pesq").variants lists the settings that change a metric's number, such as PESQ's mode and scale; put them next to the number.

License

MIT — see LICENSE.txt.

Metadata

Release files for Kudio 5.0.0

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

Source distribution (sdist)

Source distribution for Kudio 5.0.0
File Size Uploaded Provenance Actions
kudio-5.0.0.tar.gz 890.3 kB With provenance Details for kudio-5.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Kudio 5.0.0
File Interpreter ABI Platform Actions
kudio-5.0.0-py3-none-any.whl Python 3 none any Details for kudio-5.0.0-py3-none-any.whl

Total release size: 1.4 MB

Release files / kudio-5.0.0.tar.gz

Download URL kudio-5.0.0.tar.gz
Size 890.3 kB
Tags Source
SHA-256 checksum
How to use checksums
974dc4f2199c9be6c0fa8462cd3674f551455031099b7c9ded4884e3bafabe99
BLAKE2b-256 checksum
How to use checksums
62b918ffd28e7416266f73cba52f212fd5e5007eba624446930d2921baef4e44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / kudio-5.0.0-py3-none-any.whl

Download URL kudio-5.0.0-py3-none-any.whl
Size 525.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c096a335df428691f7fba5e7611a17571a0443a0bf107d66057a5081c999444
BLAKE2b-256 checksum
How to use checksums
ad42b6982b898f2b559f30e4dff43fbfd777dd83f207ca1629e630c32c423a18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Security for Kudio 5.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kudio-5.0.0.tar.gz

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 Nov 28, 2026.

Transparency log

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