torchlibrosa
PyTorch implemention of part of librosa functions.
What it is and what it does
TorchLibrosa wraps common librosa audio feature extraction operations—spectrogram, log-mel spectrogram, STFT, and ISTFT—as modules that run on GPU. It is designed for workflows where features were previously extracted on CPU with librosa but now need GPU acceleration during training or inference. The package aims for numerical compatibility within 1e-5 of standard librosa output, so switching from librosa to TorchLibrosa should not significantly alter downstream model behavior.
The package exposes module subclasses for each operation, allowing them to be composed into feature extraction pipelines. It depends only on numpy and librosa, making installation straightforward. However, maintenance has been dormant since 2023-02-21, so bug fixes and updates to support newer versions of dependencies may not be forthcoming.
Use it for:
- Accelerate mel-spectrogram extraction during model training by moving feature computation to GPU.
- Build end-to-end differentiable audio processing pipelines where spectral features are computed on GPU.
- Replace CPU-based librosa feature extraction in existing codebases with minimal code changes while gaining GPU speedup.
- Implement STFT/ISTFT operations on GPU for real-time audio processing or batch inference.
- Validate audio model robustness by ensuring feature extraction runs identically on CPU and GPU within numerical tolerance.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides PyTorch implementations of librosa audio feature extraction functions, enabling GPU-accelerated computation of spectrograms, mel-spectrograms, and STFT/ISTFT transforms with numerical compatibility to the original librosa.
Yes, if you need GPU-accelerated librosa-compatible audio features and can tolerate dormant maintenance. The low install friction and permissive license make it practical for GPU-accelerated audio feature extraction. However, verify that PyTorch is available in your environment, and be aware that no updates have shipped since 2023-02-21—if you encounter bugs or incompatibilities with newer dependency versions, you may need to fork or patch locally.
Install
torchlibrosa on PyPI
pip
pip install torchlibrosauv
uv add torchlibrosapoetry
poetry add torchlibrosaInstalling torchlibrosa
Before you install
Low friction: pure Python wheel with only numpy and librosa as runtime dependencies. Maintenance is dormant—last release was 2023-02-21, over 1270 days ago—but the repository remains unarchived with 512 stars.
License in practice
MIT license (permissive) poses no restrictions on use, modification, or redistribution in proprietary or open-source projects.
Quickstart
pip install torchlibrosa
import torchlibrosa as tl
spectrogram_extractor = tl.Spectrogram(n_fft=2048, hop_length=512)
logmel_extractor = tl.LogmelFilterBank(sr=22050, n_mels=128)
features = logmel_extractor(spectrogram_extractor(batch_audio))
Requires PyTorch (not listed as explicit dependency but core to all usage); librosa and numpy must be installed.
Verify before relying
- Whether PyTorch is declared as a runtime dependency or only as an implicit peer dependency.
- Current numerical compatibility claim (1e-5 difference) still holds given dormant maintenance status since 2023-02-21.
- Whether GPU acceleration is automatic or requires explicit device placement.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — numpy, librosa |
| Maintenance | dormant — 1,270 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 250,807/month — #8,617 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: torchlibrosa-0.1.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
torchaudioProvides PyTorch-based audio processing,…
permissive · top 5,000 on PyPI
librosalibrosa provides audio and music signal…
permissive · top 5,000 on PyPI
torchcrepePyTorch implementation of the CREPE pitch…
permissive · top 15,000 on PyPI
asteroid-filterbanksProvides PyTorch-based filterbank…
permissive · top 5,000 on PyPI
torchfcpeTorchFCPE estimates fundamental frequency…
permissive · top 15,000 on PyPI
torch-stoiComputes Short Term Objective Intelligibility…
permissive · top 15,000 on PyPI
torch-audiomentationsProvides PyTorch-native audio data augmentation…
permissive · top 5,000 on PyPI
openunmixSeparates music into individual stems (vocals,…
permissive · top 15,000 on PyPI
torchcodecTorchCodec decodes and encodes videos, audio,…
unclear · top 5,000 on PyPI
nvidia-cublasProvides NVIDIA CUBLAS native runtime libraries…
unclear · top 1,000 on PyPI