soxr package#
- class soxr.ResampleStream(in_rate: float, out_rate: float, num_channels: int, dtype='float32', quality='HQ')#
Streaming resampler
Use ResampleStream for real-time processing or very long signal.
- Parameters:
in_rate (float) – Input sample-rate.
out_rate (float) – Output sample-rate.
num_channels (int) – Number of channels.
dtype (type or str, optional) – Internal data type processed with. Should be one of float32, float64, int16, int32.
quality (int or str, optional) – Quality setting. One of QQ, LQ, MQ, HQ, VHQ.
- resample_chunk(x, last=False)#
Resample chunk with streaming resampler
- Parameters:
x (array_like) – Input array. Input can be 1D(mono) or 2D(frames, channels). If input is not np.ndarray or not dtype in constructor, it will be converted to np.ndarray with dtype setting.
last (bool, optional) – Set True at end of input sequence.
- Returns:
Resampled data. Output is np.ndarray with same ndim with input.
- Return type:
np.ndarray
- soxr.resample(x, in_rate: float, out_rate: float, quality='HQ')#
Resample signal
- Parameters:
x (array_like) – Input array. Input can be 1D(mono) or 2D(frames, channels). If input is not np.ndarray, it will be converted to np.ndarray(dtype=’float32’). Its dtype should be one of float32, float64, int16, int32.
in_rate (float) – Input sample-rate.
out_rate (float) – Output sample-rate.
quality (int or str, optional) – Quality setting. One of QQ, LQ, MQ, HQ, VHQ.
- Returns:
Resampled data. Output is np.ndarray with same ndim and dtype with input.
- Return type:
np.ndarray