Add blog post: Librosa vs audio processing alternatives - #32
Conversation
Compare Librosa, torchaudio, scipy.signal, and Parselmouth with feature tables, performance benchmarks, code snippets, and usage recommendations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codex Infinity Start a task on this PR's branch by commenting:
Tasks and logs: https://codex-infinity.com |
❌ Deploy Preview for hownz failed.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:d60e8892e9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ### torchaudio: PyTorch training pipelines | ||
| If your audio features feed into a PyTorch model, torchaudio eliminates the CPU-GPU data transfer bottleneck. Compute spectrograms on GPU, in batch, as part of your `Dataset`/`DataLoader` pipeline. It also supports on-the-fly augmentation (time stretch, frequency masking) that integrates with SpecAugment-style training. |
There was a problem hiding this comment.
Mention torchaudio's maintenance status before recommending it
This section advises readers to choose torchaudio for new PyTorch pipelines, but torchaudio's own stable docs say the project entered a maintenance phase starting in 2.8 and is steering new I/O work toward TorchCodec. Without that caveat, the post can push people starting a fresh stack onto a library whose upstream is actively winding down, which is exactly the kind of context readers need in a comparison article.
Useful? React with 👍 / 👎.
| | Librosa | 1.0x (baseline) | Sequential, CPU | | ||
| | torchaudio (CPU) | ~0.8x | MKL FFT, batched | | ||
| | torchaudio (GPU) | ~0.05x | Batched on A100 | | ||
| | scipy.signal (manual) | ~0.9x | Raw STFT only, no mel | |
There was a problem hiding this comment.
Benchmark SciPy on the same mel-spectrogram workload
The section is introduced as a mel-spectrogram benchmark, but this row explicitly reports only Raw STFT timing for SciPy. Because the manual mel-filterbank application is omitted only for SciPy, the ~0.9x number is not comparable to the Librosa and torchaudio rows and overstates SciPy's performance for the workload the table claims to measure.
Useful? React with 👍 / 👎.
| import torchaudio.transforms as T | ||
| waveform, sr = torchaudio.load("audio.wav") | ||
| mel_transform = T.MelSpectrogram(sample_rate=sr, n_mels=128, n_fft=2048, hop_length=512) |
There was a problem hiding this comment.
Set matching mel-scale parameters in the comparison code
These snippets are presented as equivalent mel-spectrogram implementations, but the defaults are not aligned: librosa.feature.melspectrogram uses Slaney-style filters by default, while torchaudio.transforms.MelSpectrogram defaults to HTK/no normalization and the manual SciPy example follows the same HTK formula. As written, readers who run the examples on the same file will get systematically different outputs because of parameter mismatches rather than library behavior.
Useful? React with 👍 / 👎.
Summary
Test plan
npx hexo generatesucceeds with no errors (151 files generated)/2026/03/23/librosa-vs-audio-processing-alternatives/Generated with Claude Code