medkit.audio.preprocessing#

Submodules#

Classes#

Downmixer

Downmixing operation converting multichannel audio signals to mono.

PowerNormalizer

Normalization operation setting the RMS power of each audio signal to a target value.

Package Contents#

class medkit.audio.preprocessing.Downmixer(output_label: str, prevent_clipping: bool = True, uid: str | None = None)#

Bases: medkit.core.audio.PreprocessingOperation

Downmixing operation converting multichannel audio signals to mono.

Parameters:
output_labelstr

Label of output downmixed segments.

prevent_clippingbool, default=True

If True, normalize downmixed signals by number of channels to prevent clipping.

uidstr, optional

Identifier of the downmixer.

init_args#
output_label#
prevent_clipping#
run(segments: list[medkit.core.audio.Segment]) list[medkit.core.audio.Segment]#

Return a downmixed segment for each segment in segments.

Parameters:
segmentslist of Segment

Audio segments to downmix.

Returns:
list of Segment

Downmixed segments, one per segment in segments.

_downmix_segment(segment: medkit.core.audio.Segment) medkit.core.audio.Segment#
class medkit.audio.preprocessing.PowerNormalizer(output_label: str, target_value: float = 1.0, channel_wise: bool = False, uid: str | None = None)#

Bases: medkit.core.audio.PreprocessingOperation

Normalization operation setting the RMS power of each audio signal to a target value.

Parameters:
output_labelstr

Label of output normalized segments.

target_valuefloat, default=1.0

Value to set the RMS power of each segment to.

channel_wisebool, default=False

If True, the normalization is performed per-channel, thus modifying the balance of multichannel signals.

uidstr, optional

Identifier of the normalizer.

init_args#
output_label#
channel_wise#
target_value#
run(segments: list[medkit.core.audio.Segment]) list[medkit.core.audio.Segment]#

Return a normalized segment for each segment in segments.

Parameters:
segmentslist of Segment

Audio segments to normalize.

Returns:
list of Segment

Power-normalized segments, one per segment in segments.

_normalize_segment(segment: medkit.core.audio.Segment) medkit.core.audio.Segment#