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 ofsoundsig, which assumes the audio data is loaded as 16-bit integers. Since the default forvocalpy.Soundis to load sounds with a numpy dtype of float64, this function defaults to multiplying thesound.databy 2**15, and then casting to the int16 dtype. This replicates the behavior of thesoundsigfunction, 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.databy, to scale the data. Default is 2**15. Only used ifscaleisTrue. This is needed to replicate the behavior ofsoundsig, which assumes the audio data is loaded as 16-bit integers.- scale_dtypenumpy.dtype
Numpy Dtype to cast
sound.datato, after scaling. Default isnp.int16. Only used ifscaleisTrue. This is needed to replicate the behavior ofsoundsig, which assumes the audio data is loaded as 16-bit integers.
- Returns:
- featuresvocalpy.Features
A
vocalpy.Featuresinstance withdataattribute that is anxarray.Dataset, where the data variables are the features, and the coordinate is the channel.
Notes
Code is adapted from the
soundsiglibrary [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