soxr is a high-quality, one-dimensional sample-rate conversion library for Python, leveraging libsoxr. It is currently at version 1.0.0, which signifies API stability and is actively maintained with regular updates and performance improvements, including significant speed optimizations.
pip install soxrVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `soxr.resample` to convert the sample rate of a NumPy array containing audio data. It generates a dummy stereo signal and resamples it from 48kHz to 44.1kHz.
Review any direct usage of `soxr.ResampleStream` and ensure all input data is explicitly converted to the expected format and type before being passed to the stream for processing.
Upgrade your Python environment to 3.9 or newer and ensure NumPy is version 2.x or later. If upgrading is not feasible, pin `soxr<0.4.0` in your project dependencies.
Exercise caution and thorough testing when using `soxr` in free-threaded Python environments with version 1.0.0. Monitor future releases for improved stability and explicit assurances regarding free-threading.
pip install soxr
Ensure your Python environment is correct and try reinstalling `soxr` with `pip install --no-cache-dir soxr`. For some complex environments, you might need to ensure system-wide `libsoxr` dependencies are met, but generally, the `soxr` wheels bundle necessary components.
Ensure the input audio data is a 1D numpy array. If you have stereo data, process each channel separately or convert to mono first.
Provide positive integer values for both `srate_in` and `srate_out` arguments.
Verify that the variable intended for the `input` argument to `soxr.resample` holds a valid numpy array, not `None`.