medkit.audio.preprocessing.resampler#
Classes#
Resampling operation relying on the resampy package. |
Module Contents#
- class medkit.audio.preprocessing.resampler.Resampler(output_label: str, sample_rate: int, fast: bool = False, uid: str | None = None)#
Bases:
medkit.core.audio.PreprocessingOperation
Resampling operation relying on the resampy package.
- Parameters:
- output_labelstr
Label of output resampled segments.
- sample_rateint
Target sample rate to resample to, in samples per second.
- fastbool, default=False
If True, prefer speed to quality and use resampy’s “kaiser_fast” filter instead of “kaiser_best”.
- uidstr, optional
Identifier of the resampler.
- init_args#
- output_label#
- sample_rate#
- fast#
- run(segments: list[medkit.core.audio.Segment]) list[medkit.core.audio.Segment] #
Return a resampled segment for each segment in segments.
- Parameters:
- segmentslist of Segment
Audio segments to resample.
- Returns:
- list of Segment
Resampled segments, one per segment in segments.
- _resample_segment(segment: medkit.core.audio.Segment) medkit.core.audio.Segment #