vocalpy.signal.audio.meansquared

Contents

vocalpy.signal.audio.meansquared#

vocalpy.signal.audio.meansquared(sound: Sound, freq_cutoffs=(500, 10000), smooth_win: int = 2) ndarray[Any, dtype[_ScalarType_co]][source]#

Convert audio to a Root-Mean-Square-like trace.

This function first applies a band-pass filter, and then rectifies the audio signal by squaring. Finally, it smooths by taking the average within a window of size smooth_win.

Parameters:
sound: vocalpy.Sound

An audio signal. Multi-channel is supported.

freq_cutoffsIterable

Cutoff frequencies for bandpass filter. List or tuple with two elements, default is (500, 10000).

smooth_wininteger

Size of smoothing window, in milliseconds. Default is 2.

Returns:
meansquarednumpy.ndarray

The vocalpy.Sound.data after squaring and smoothing.