All Projects → dofuuz → python-soxr

dofuuz / python-soxr

Licence: Unknown, LGPL-2.1 licenses found Licenses found Unknown LICENSE.txt LGPL-2.1 COPYING.LGPL
Fast and high quality sample-rate conversion library for Python

Programming Languages

python
139335 projects - #7 most used programming language
cython
566 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to python-soxr

RTspice
A real-time netlist based audio circuit plugin
Stars: ✭ 51 (+104%)
Mutual labels:  signal-processing, dsp, audio-processing
SpleeterRT
Real time monaural source separation base on fully convolutional neural network operates on Time-frequency domain.
Stars: ✭ 111 (+344%)
Mutual labels:  signal-processing, dsp, audio-processing
Edsp
A cross-platform DSP library written in C++ 11/14. This library harnesses the power of C++ templates to implement a complete set of DSP algorithms.
Stars: ✭ 116 (+364%)
Mutual labels:  signal-processing, dsp, audio-processing
DTMF-Decoder
A Java program to implement a DMTF Decoder.
Stars: ✭ 28 (+12%)
Mutual labels:  signal-processing, dsp, audio-processing
Python Pesq
PESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users (narrow band and wide band)
Stars: ✭ 144 (+476%)
Mutual labels:  signal-processing, audio-processing
Aca Code
Matlab scripts accompanying the book "An Introduction to Audio Content Analysis" (www.AudioContentAnalysis.org)
Stars: ✭ 67 (+168%)
Mutual labels:  signal-processing, audio-processing
TD-Faust
FAUST (Functional Audio Stream) for TouchDesigner
Stars: ✭ 38 (+52%)
Mutual labels:  dsp, audio-processing
gensound
Pythonic audio processing and generation framework
Stars: ✭ 69 (+176%)
Mutual labels:  dsp, audio-processing
Sincnet
SincNet is a neural architecture for efficiently processing raw audio samples.
Stars: ✭ 764 (+2956%)
Mutual labels:  signal-processing, audio-processing
Moogladders
🔉 Collected C++ implementations of the classic 4-pole moog ladder filter
Stars: ✭ 211 (+744%)
Mutual labels:  signal-processing, dsp
Apollo
Apollo is a Open-Source music player for playback and organization of audio files on Microsoft Windows, built using Python.
Stars: ✭ 13 (-48%)
Mutual labels:  signal-processing, dsp
8d Audio
Some dsp to make songs "8D"
Stars: ✭ 43 (+72%)
Mutual labels:  signal-processing, dsp
DDCToolbox
Create and edit DDC headset correction files
Stars: ✭ 70 (+180%)
Mutual labels:  signal-processing, audio-processing
spafe
🔉 spafe: Simplified Python Audio Features Extraction
Stars: ✭ 310 (+1140%)
Mutual labels:  signal-processing, dsp
Audio Reactive Led Strip
🎵 🌈 Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
Stars: ✭ 2,217 (+8768%)
Mutual labels:  signal-processing, audio-processing
Pyo
Python DSP module
Stars: ✭ 904 (+3516%)
Mutual labels:  signal-processing, dsp
ooura
Javascript port of Ooura FFT implementation
Stars: ✭ 23 (-8%)
Mutual labels:  signal-processing, dsp
audio noise clustering
https://dodiku.github.io/audio_noise_clustering/results/ ==> An experiment with a variety of clustering (and clustering-like) techniques to reduce noise on an audio speech recording.
Stars: ✭ 24 (-4%)
Mutual labels:  dsp, audio-processing
Surfboard
Novoic's audio feature extraction library
Stars: ✭ 318 (+1172%)
Mutual labels:  signal-processing, audio-processing
Klio
Smarter data pipelines for audio.
Stars: ✭ 560 (+2140%)
Mutual labels:  signal-processing, audio-processing

Python-SoXR

GitHub PyPI Read the Docs

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.

Installation

pip install soxr

If installation fails, upgrade pip with python -m pip install --upgrade pip and try again.

in Conda environment

conda install -c conda-forge soxr-python

Note: Conda packge name is soxr-python, not python-soxr.

Basic usage

import soxr

y = soxr.resample(
    x,          # 1D(mono) or 2D(frames, channels) array input
    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.

Streaming usage

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,              # 1D(mono) or 2D(frames, channels) array input
        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, ...])

Requirement

x86 and ARM processors are supported.

Neon extension is required for ARM CPUs. Without Neon, it may crash or return inaccurate result.

Benchmark

Sweep, impulse, speed compairsion with other Python resamplers.

https://colab.research.google.com/drive/1XgSOvWlRIau1FYwQG_yRSAhDK3KB8bEL?usp=sharing

Speed comparison summary

Downsampling 10 sec of 48000 Hz to 44100 Hz.
Ran on Google Colab.

Library Time on CPU (ms)
soxr (HQ) 7.2
scipy.signal.resample 13.4
soxr (VHQ) 15.8
torchaudio 19.2
lilfilter 21.4
julius 23.1
resampy (kaiser_fast) 62.6
samplerate (sinc_medium) 92.5
resampy (kaiser_best) 256
samplerate (sinc_best) 397

Technical detail

For technical details behind resampler, see libsoxr docs.

Credit and License

Python-SoXR is LGPL v2.1+ licensed, following libsoxr's license.

OSS libraries used

libsoxr (LGPLv2.1+)

The SoX Resampler library
https://sourceforge.net/projects/soxr/

Python-SoXR is a Python wrapper of libsoxr.

PFFFT (BSD-like)

PFFFT: a pretty fast FFT.
https://bitbucket.org/jpommier/pffft/

libsoxr dependency.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].