dlpy.speech_utils.convert_sampwidth

dlpy.speech_utils.convert_sampwidth(fragment, sampwidth_in, sampwidth_out)

Convert the sampwidth (byte width) of the input fragment between 1-, 2-, 3-, 4-byte formats.

Parameters:
fragment : bytes object

Specifies the original fragment.

sampwidth_in : int

Specifies the fragment’s original sampwidth.

sampwidth_out : int

Specifies the fragment’s desired sampwidth.

Returns:
bytes

Converted audio with the desired sampwidth ‘sampwidth_out’.