resample()

audresample.resample(signal, original_rate, target_rate, *, quality='h', always_copy=False)[source]

Resample signal to a new sampling rate.

Supports only signals in single precision floating point format. The returned signal is always of shape (channels, samples).

Parameters
  • signal (ndarray) – array with signal values

  • original_rate (int) – original sample rate of the input signal in Hz

  • target_rate (int) – target sampling rate in Hz

  • quality (ResampleQuality) – quality of the conversion algorithm

  • always_copy (bool) – if True always returns a new object

Return type

ndarray

Returns

resampled signal with shape (number of channels, number of samples)

Raises