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
fragmentbytes object

Specifies the original fragment.

sampwidth_inint

Specifies the fragment’s original sampwidth.

sampwidth_outint

Specifies the fragment’s desired sampwidth.

Returns
bytes

Converted audio with the desired sampwidth ‘sampwidth_out’.