medkit.audio.preprocessing.resampler

medkit.audio.preprocessing.resampler#

This module needs extra-dependencies not installed as core dependencies of medkit. To install them, use pip install medkit-lib[resampler].

Classes:

Resampler(output_label, sample_rate[, fast, uid])

Resampling operation relying on the resampy package.

class Resampler(output_label, sample_rate, fast=False, uid=None)[source]#

Resampling operation relying on the resampy package.

Parameters:
  • output_label (str) – Label of output resampled segments.

  • sample_rate (int) – Target sample rate to resample to, in samples per second.

  • fast (bool, default=False) – If True, prefer speed over quality and use resampy’s “kaiser_fast” filter instead of “kaiser_best”.

  • uid (str, optional) – Identifier of the resampler.

Methods:

run(segments)

Return a resampled segment for each segment in segments.

set_prov_tracer(prov_tracer)

Enable provenance tracing.

Attributes:

description

Contains all the operation init parameters.

run(segments)[source]#

Return a resampled segment for each segment in segments.

Parameters:

segments (list of Segment) – Audio segments to resample.

Return type:

list[Segment]

Returns:

list of Segment – Resampled segments, one per segment in segments.

property description: OperationDescription#

Contains all the operation init parameters.

Return type:

OperationDescription

set_prov_tracer(prov_tracer)#

Enable provenance tracing.

Parameters:

prov_tracer (ProvTracer) – The provenance tracer used to trace the provenance.