Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.1.

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 of frequencies[i]

Examples

Get the A-weighting for CQT frequencies

>>> import matplotlib.pyplot as plt
>>> freqs = librosa.cqt_frequencies(n_bins=108, fmin=librosa.note_to_hz('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')
../_images/librosa-frequency_weighting-1.png