Caution
You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.9.1.
librosa.frequency_weighting¶
- librosa.frequency_weighting(frequencies, kind='A', **kw)[source]¶
Compute the weighting of a set of frequencies.
- Parameters
- frequenciesscalar or np.ndarray [shape=(n,)]
One or more frequencies (in Hz)
- kindstr in
The weighting kind. e.g. ‘A’, ‘B’, ‘C’, ‘D’, ‘Z’
- min_dbfloat [scalar] or None
Clip weights below this threshold. If None, no clipping is performed.
- Returns
- weightingscalar or np.ndarray [shape=(n,)]
weighting[i]
is the weighting offrequencies[i]
See also
Examples
Get the A-weighting for CQT frequencies
>>> import matplotlib.pyplot as plt >>> freqs = librosa.cqt_frequencies(108, librosa.note_to_hz('C1')) >>> weights = librosa.frequency_weighting(freqs, 'A') >>> fig, ax = plt.subplots() >>> ax.plot(freqs, weights) >>> ax.set(xlabel='Frequency (Hz)', ylabel='Weighting (log10)', ... title='A-Weighting of CQT frequencies')