librosa.frequency_weighting#
- librosa.frequency_weighting(frequencies, *, kind='A', **kwargs)[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’
- **kwargs
Additional keyword arguments to A_weighting, B_weighting, etc.
- 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(n_bins=108, fmin="C1") >>> weights = librosa.frequency_weighting(freqs, kind="A") >>> fig, ax = plt.subplots() >>> ax.plot(freqs, weights) >>> ax.set( ... xlabel="Frequency (Hz)", ... ylabel="Weighting (log10)", ... title="A-Weighting of CQT frequencies", ... )