paddleaudio.utils.numeric module

paddleaudio.utils.numeric.depth_convert(y: ndarray, dtype: Union[type, str]) ndarray[source]

Convert audio array to target dtype safely. This function convert audio waveform to a target dtype, with addition steps of preventing overflow/underflow and preserving audio range.

Args:

y (np.ndarray): Input waveform array in 1D or 2D. dtype (Union[type, str]): Data type of waveform.

Returns:

np.ndarray: y after safe casting.

paddleaudio.utils.numeric.pcm16to32(audio: ndarray) ndarray[source]

pcm int16 to float32

Args:

audio (np.ndarray): Waveform with dtype of int16.

Returns:

np.ndarray: Waveform with dtype of float32.