librosax.feature.tempo

tempo(*, y: ndarray | None = None, sr: float = 22050, onset_envelope: ndarray | None = None, hop_length: int = 512, start_bpm: float = 120.0, std_bpm: float = 1.0, ac_size: float = 8.0, max_tempo: float = 320.0, aggregate: Callable | None = None, prior: Callable | None = None) float | ndarray[source]

Estimate the tempo (beats per minute) from an audio signal.

This is a wrapper around librosa.feature.tempo.

Parameters

ynp.ndarray [shape=(…, n)] or None

Audio time series

srfloat > 0

Sampling rate of the audio time series

onset_envelopenp.ndarray [shape=(n,)] or None

Optional pre-computed onset strength envelope

hop_lengthint > 0

Number of audio samples between successive onset measurements

start_bpmfloat > 0

Initial guess of the BPM

std_bpmfloat > 0

Standard deviation of tempo distribution

ac_sizefloat > 0

Length (in seconds) of the onset autocorrelation window

max_tempofloat > 0

Maximum tempo to consider (in BPM)

aggregatecallable or None

Aggregation function. If provided, used to combine tempo estimates.

priorcallable or None

Prior distribution over tempo

Returns

tempofloat or np.ndarray

Estimated tempo (in beats per minute)

See Also

tempogram librosa.feature.tempo