vocalpy.Segmenter#

class vocalpy.Segmenter(callback: Callable | None = None, params: Mapping | Params | None = None)[source]#

Bases: object

Class that represents the segmenting step in a pipeline.

Attributes:
callbackcallable, optional

The function or Callable class instance that is used to segment. If not specified, defaults to vocalpy.segment.meansquared().

paramsMapping or Params, optional.

Parameters passed to callback. A Mapping of keyword arguments, or one of the Params classes that represents parameters, e.g., class:vocalpy.segment.MeanSquaredParams. If not specified, defaults to vocalpy.segmenter.DEFAULT_SEGMENT_PARAMS.

Methods

segment(sound[, parallelize])

Segment sound.

__init__(callback: Callable | None = None, params: Mapping | Params | None = None)[source]#

Initialize a new vocalpy.Segmenter instance.

Parameters:
callbackcallable, optional

The function or Callable class instance that is used to segment. If not specified, defaults to vocalpy.segment.meansquared().

paramsMapping or Params, optional.

Parameters passed to callback. A Mapping of keyword arguments, or one of the Params classes that represents parameters, e.g., class:vocalpy.segment.MeanSquaredParams. If not specified, defaults to vocalpy.segmenter.DEFAULT_SEGMENT_PARAMS.

Methods

__init__([callback, params])

Initialize a new vocalpy.Segmenter instance.

segment(sound[, parallelize])

Segment sound.

segment(sound: Sound | AudioFile | list[Sound | AudioFile], parallelize: bool = True) Segments | list[Segments][source]#

Segment sound.

Parameters:
soundvocalpy.Sound or list of Sound

A class:vocalpy.Sound` instance or list of vocalpy.Sound instances to segment.

parallelizebool

If True, parallelize segmentation using dask.

Returns:
segmentsvocalpy.Segments, list

If a Sound is passed in, a single set of Segments will be returned. If a list of Sound is passed in, a list of Segments will be returned.