### Install Python-SoXR with pip Source: https://python-soxr.readthedocs.io Use this command to install the Python-SoXR library using pip. If installation fails, upgrade pip and try again. ```bash pip install soxr ``` -------------------------------- ### Install Python-SoXR with Conda Source: https://python-soxr.readthedocs.io Install the soxr-python package in a Conda environment. Note that the Conda package name is 'soxr-python', not 'python-soxr'. ```bash conda install -c conda-forge soxr-python ``` -------------------------------- ### Basic Resampling with Python-SoXR Source: https://python-soxr.readthedocs.io Perform basic audio resampling using the `soxr.resample()` function. The input can be a mono (1D) or multi-channel (2D) numpy array. The function handles conversion to numpy.ndarray with dtype 'float32' if the input is not already a numpy array. The output will have the same dimensions and data type as the input. ```python import soxr y = soxr.resample( x, # input array – mono(1D) or multi-channel(2D of [frame, channel]) 48000, # input samplerate 16000 # target samplerate ) ``` -------------------------------- ### Streaming Resampling with ResampleStream Source: https://python-soxr.readthedocs.io Utilize `ResampleStream` for real-time audio processing or handling very long signals. The `resample_chunk` method processes input chunks and returns resampled audio. Set `last=True` when processing the final chunk of input. ```python import soxr rs = soxr.ResampleStream( 44100, # input samplerate 16000, # target samplerate 1, # channel(s) dtype='float32' # data type (default = 'float32') ) eof = False while not eof: # Get chunk ... y_chunk = rs.resample_chunk( x, # input aray – mono(1D) or multi-channel(2D of [frame, channel]) last=eof # Set True at end of input ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.