librosa.core.A_weighting

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

Compute the A-weighting of a set of frequencies.

Parameters:

frequencies : scalar or np.ndarray [shape=(n,)]

One or more frequencies (in Hz)

min_db : float [scalar] or None

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

Returns:

A_weighting : scalar 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(108, librosa.note_to_hz('C1'))
>>> aw = librosa.A_weighting(freqs)
>>> plt.plot(freqs, aw)
>>> plt.xlabel('Frequency (Hz)')
>>> plt.ylabel('Weighting (log10)')
>>> plt.title('A-Weighting of CQT frequencies')

(Source code)

../_images/librosa-core-A_weighting-1.png