Caution

You're reading the documentation for a development version. For the latest released version, please have a look at 0.9.1.

librosa.D_weighting

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

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

D_weighting[i] is the D-weighting of frequencies[i]

Examples

Get the D-weighting for CQT frequencies

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