
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600Ć Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600Ć faster than humans.
High quality, one-dimensional sample-rate conversion library for Python.
Keywords: Resampler, Audio resampling, Samplerate conversion, DSP(Digital Signal Processing)
Python-SoXR is a Python wrapper of libsoxr.
pip install soxr
If installation fails, upgrade pip with python -m pip install --upgrade pip
and try again.
conda install -c conda-forge soxr-python
Note: Conda packge name is soxr-python
, not python-soxr.
import soxr
y = soxr.resample(
x, # input array ā mono(1D) or multi-channel(2D of [frame, channel])
48000, # input samplerate
16000 # target samplerate
)
If input is not numpy.ndarray
, it will be converted to numpy.ndarray(dtype='float32')
.
dtype should be one of float32, float64, int16, int32.
Output is numpy.ndarray
with same dimension and data type of input.
Use ResampleStream
for real-time processing or very long signal.
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
)
Output frame count may not be consistent. This is normal operation.
(ex. [0, 0, 0, 186, 186, 166, 186, 186, 168, ...])
š More code examples
Sweep, impulse, speed compairsion with other resamplers for Python.
https://colab.research.google.com/drive/1_xYUs00VWYOAXShB85W1MFWaUjGHfO4K?usp=sharing
Downsampling 10 sec of 48000 Hz to 44100 Hz.
Ran on Google Colab.
Library | Time on CPU (ms) |
---|---|
soxr (HQ) | 10.8 |
torchaudio | 13.8 |
soxr (VHQ) | 14.5 |
scipy.signal.resample | 21.3 |
lilfilter | 24.7 |
julius | 31 |
resampy (kaiser_fast) | 108 |
samplerate (sinc_medium) | 223 |
resampy (kaiser_best) | 310 |
samplerate (sinc_best) | 794 |
For technical details behind resampler, see libsoxr docs.
Python-SoXR package comes with modified version of libsoxr. See changes here.
These changes do not apply to dynamic-linked builds (e.g. conda-forge build).
To check the version of libsoxr, use soxr.__libsoxr_version__
.
Python-SoXR is LGPL v2.1+ licensed, following libsoxr's license.
The SoX Resampler library
https://sourceforge.net/projects/soxr/
Python-SoXR is a Python wrapper of libsoxr.
PFFFT: a pretty fast FFT.
https://bitbucket.org/jpommier/pffft/
libsoxr dependency.
FAQs
High quality, one-dimensional sample-rate conversion library
We found that soxr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600Ć faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.