librosa.A_weighting

librosa.A_weighting(frequencies, *, min_db=-80.0)[source]

Compute the A-weighting of a set of frequencies.

Parameters:
frequenciesscalar or np.ndarray [shape=(n,)]

One or more frequencies (in Hz)

min_dbfloat [scalar] or None

Clip weights below this threshold. If None, no clipping is performed.

Returns:
A_weightingscalar or np.ndarray [shape=(n,)]

A_weighting[i] is the A-weighting of frequencies[i]

Examples

Get the A-weighting for CQT frequencies

>>> import matplotlib.pyplot as plt
>>> freqs = librosa.cqt_frequencies(n_bins=108, fmin=librosa.note_to_hz('C1'))
>>> weights = librosa.A_weighting(freqs)
>>> fig, ax = plt.subplots()
>>> ax.plot(freqs, weights)
>>> ax.set(xlabel='Frequency (Hz)',
...        ylabel='Weighting (log10)',
...        title='A-Weighting of CQT frequencies')
../_images/librosa-A_weighting-1.png