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.