librosa.B_weighting

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

Compute the B-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:
B_weightingscalar or np.ndarray [shape=(n,)]

B_weighting[i] is the B-weighting of frequencies[i]

Examples

Get the B-weighting for CQT frequencies

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