vocalpy.feature.biosound

Contents

vocalpy.feature.biosound#

vocalpy.feature.biosound(sound: Sound, scale: bool = True, scale_val: int | float = 32768, scale_dtype: npt.DTypeLike = <class 'numpy.int16'>, ftr_groups: SoundsigFeatureGroups | Sequence[SoundsigFeatureGroups] = ('temporal', 'spectral', 'fundamental')) Features[source]#

Compute predefined acoustic features (PAFs) used to analyze the vocal repertoire of the domesticated zebra finch, as described in [1].

Parameters:
soundSound

A sound loaded from a file.

scalebool

If True, scale the sound.data. Default is True. This is needed to replicate the behavior of soundsig, which assumes the audio data is loaded as 16-bit integers. Since the default for vocalpy.Sound is to load sounds with a numpy dtype of float64, this function defaults to multiplying the sound.data by 2**15, and then casting to the int16 dtype. This replicates the behavior of the soundsig function, given data with dtype float64. If you have loaded a sound with a dtype of int16, then set this to False.

scale_val

Value to multiply the sound.data by, to scale the data. Default is 2**15. Only used if scale is True. This is needed to replicate the behavior of soundsig, which assumes the audio data is loaded as 16-bit integers.

scale_dtypenumpy.dtype

Numpy Dtype to cast sound.data to, after scaling. Default is np.int16. Only used if scale is True. This is needed to replicate the behavior of soundsig, which assumes the audio data is loaded as 16-bit integers.

Returns:
featuresvocalpy.Features

A vocalpy.Features instance with data attribute that is an xarray.Dataset, where the data variables are the features, and the coordinate is the channel.

Notes

Code is adapted from the soundsig library [2], under MIT license.

References

[1]

Elie JE and Theunissen FE. “The vocal repertoire of the domesticated zebra finch: a data driven approach to decipher the information-bearing acoustic features of communication signals.” Animal Cognition. 2016. 19(2) 285-315 DOI 10.1007/s10071-015-0933-6