skillfed

torchlibrosa

PyTorch implemention of part of librosa functions.

torchlibrosa v0.1.0 250.8K downloads/30d#8,617 on PyPI512
Permissive license DORMANT released

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 torchlibrosa

uv

uv add torchlibrosa

poetry

poetry add torchlibrosa

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

gpu audio feature extractionpytorch librosa implementationspectrogram mel-spectrogram gpustft istft pytorchaudio processing accelerationlibrosa gpu alternative
audio-processinggpu-accelerationfeature-extraction

More Artificial Intelligence packages