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 offrequencies[i]
See also
Examples
Get the D-weighting for CQT frequencies
>>> import matplotlib.pyplot as plt >>> freqs = librosa.cqt_frequencies(n_bins=108, fmin="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", ... )