Open Family Office Datasets Tickers Strategies Portfolios Research Posts About Changelog

librosa: Audio and Music Signal Analysis in Python

Source

Citation. Brian McFee, Colin Raffel, Dawen Liang, Daniel P. W. Ellis, Matt McVicar, Eric Battenberg and Oriol Nieto. "librosa: Audio and Music Signal Analysis in Python". Proceedings of the 14th Python in Science Conference (SciPy 2015), 18–25. PDF. The paper describes version 0.4.0. The software is librosa/librosa, version 1.0.1 of 12 November 2026, under the ISC licence. Its concept DOI is 10.5281/zenodo.591533.

Status. Not applicable. librosa is built for audio, and its defaults assume audio. Its STFT centres each frame on its time, so it looks ahead. Its onset detection sets its windows in seconds of audio, which round to nothing on daily prices. Nothing in it is needed that a trailing window or SciPy can't do. Skip it.

Read. Read on 2026-11-28. I read the paper's abstract, design principles and conventions, from the PDF with pdftotext. Through the GitHub API at tag 1.0.1, I read stft in librosa/core/spectrum.py, onset_detect in librosa/onset.py, peak_pick in librosa/util/utils.py and spectral_flatness in librosa/feature/spectral.py. I didn't run it, and I didn't survey finance papers that use spectrograms.

Summary

Claim. The paper says librosa makes "core MIR techniques readily available to the broader community of scientists and Python programmers". MIR is music information retrieval.

What the code does.

Findings. It is a library, with no study.

Where the claims go beyond the evidence

The defaults look ahead. With center=True, the frame at time t holds samples from both sides of t. So the spectrum, and every feature built on it, uses the future. center=False gives frames that begin at t. A trading feature needs frames that end at t, so the frame must be indexed by its last sample.

Onset detection reaches past its frame. post_avg adds frames after n to the test for a peak at n, about 100 milliseconds of audio. If a user sets sr so that the windows have some width on prices, they reach that many days into the future.

The defaults are set in seconds of audio. For a daily series with sr=1 and hop_length=1, 0.03 × 1 rounded down is 0. So pre_max, pre_avg and wait all become 0, and post_max and post_avg become 1. A slice from n to n + 1 holds only frame n, so the peak picking compares each frame only with itself. The tool doesn't fail. It runs, and gives answers that mean nothing.

Audio features assume hearing. Mel and constant-Q scales, chroma and pitch encode how people hear sound. Returns have none of that structure, as fourier-stock-volatility.md notes.

Credit. The paper sets out clear conventions, and the code documents its centring and its defaults plainly. center=False is available for any user who reads the docstring.

Use in this repo

Skip librosa. The STFT, if it is ever needed, is a few lines on a trailing window, or SciPy's signal.stft with its padding turned off. Either way, each frame must end at t, not be centred on it (#10).

Change detection belongs elsewhere. Regime and change detection has its own reviews: Markov switching (hmmlearn.md) and matrix profiles (stumpy.md). Both state their delays, which audio onset detection doesn't do for prices.

Spectral flatness doesn't test for an edge. It measures how close a spectrum is to white noise. A strategy's returns can be flat in spectrum and still have an edge in their mean. A test of a strategy's edge is a test of its mean and its risk, with their errors (#8). A test of a series' structure is a test of its autocorrelation, with Newey–West errors (metrics.long_run_variance).

Every frame length and hop is a trial. Any time–frequency feature has a frame length, a hop and a window. Each set tried enters the trial ledger (#7).