Skip to main content

Reliable low-latency audio playback and recording

Project description

Goal: Reliable low-latency audio playback and recording with Python, using PortAudio via the sounddevice module.

The audio callback is implemented in C (and compiled with the help of CFFI) and doesn’t invoke the Python interpreter, therefore avoiding waiting for things like garbage collection and the GIL.

All PortAudio platforms and host APIs are supported. Runs on any Python version where CFFI is available.

Features:

  • playback of multiple signals at the same time (that’s why it’s called “mixer”)

  • play from buffer, play from ringbuffer

  • record into buffer, record into ringbuffer

  • multichannel support

  • NumPy arrays with data type 'float32' can be easily used (via the buffer protocol) as long as they are C-contiguous

  • fixed latency playback, (close to) no jitter (optional)

    • to be verified …

  • sample-accurate playback/recording (with known offset)

    • to be verified …

  • non-blocking callback function, using PortAudio ringbuffers

  • all memory allocations/deallocations happen outside the audio callback

Planned features:

  • meticulous reporting of overruns/underruns

  • loopback tests to verify correct operation and accurate latency values

  • fade in/out?

  • loop?

  • playlist/queue?

Out of scope:

  • reading from/writing to files (use e.g. the soundfile module)

  • realtime signal processing (inside the audio callback)

  • signal generators

  • multiple mixer instances (some PortAudio host APIs only support one stream at a time)

  • resampling (apart from what PortAudio does)

  • fast forward/rewind

  • panning/balance

  • audio/video synchronization

Somewhat similar projects:

Installation

On Windows, macOS, and Linux you can install a precompiled wheel with:

python3 -m pip install rtmixer

This will install rtmixer and its dependencies, including sounddevice.

Developers can install in editable mode with some variant of:

git clone https://github.com/spatialaudio/python-rtmixer
cd python-rtmixer
git submodule update --init
python3 -m pip install -e .

Usage

See the list of examples on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rtmixer-0.1.1.tar.gz (38.4 kB view hashes)

Uploaded Source

Built Distributions

rtmixer-0.1.1-pp36-pypy36_pp73-win32.whl (13.1 kB view hashes)

Uploaded PyPy Windows x86

rtmixer-0.1.1-pp36-pypy36_pp73-manylinux2010_x86_64.whl (13.4 kB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

rtmixer-0.1.1-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (11.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

rtmixer-0.1.1-cp38-cp38-win_amd64.whl (18.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

rtmixer-0.1.1-cp38-cp38-win32.whl (16.1 kB view hashes)

Uploaded CPython 3.8 Windows x86

rtmixer-0.1.1-cp38-cp38-manylinux2010_x86_64.whl (43.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

rtmixer-0.1.1-cp38-cp38-manylinux2010_i686.whl (40.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

rtmixer-0.1.1-cp38-cp38-manylinux1_x86_64.whl (43.9 kB view hashes)

Uploaded CPython 3.8

rtmixer-0.1.1-cp38-cp38-manylinux1_i686.whl (40.7 kB view hashes)

Uploaded CPython 3.8

rtmixer-0.1.1-cp38-cp38-macosx_10_9_x86_64.whl (16.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

rtmixer-0.1.1-cp37-cp37m-win_amd64.whl (18.3 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

rtmixer-0.1.1-cp37-cp37m-win32.whl (16.1 kB view hashes)

Uploaded CPython 3.7m Windows x86

rtmixer-0.1.1-cp37-cp37m-manylinux2010_x86_64.whl (43.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

rtmixer-0.1.1-cp37-cp37m-manylinux2010_i686.whl (40.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

rtmixer-0.1.1-cp37-cp37m-manylinux1_x86_64.whl (43.4 kB view hashes)

Uploaded CPython 3.7m

rtmixer-0.1.1-cp37-cp37m-manylinux1_i686.whl (40.2 kB view hashes)

Uploaded CPython 3.7m

rtmixer-0.1.1-cp37-cp37m-macosx_10_9_x86_64.whl (16.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

rtmixer-0.1.1-cp36-cp36m-win_amd64.whl (18.3 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

rtmixer-0.1.1-cp36-cp36m-win32.whl (16.1 kB view hashes)

Uploaded CPython 3.6m Windows x86

rtmixer-0.1.1-cp36-cp36m-manylinux2010_x86_64.whl (43.4 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

rtmixer-0.1.1-cp36-cp36m-manylinux2010_i686.whl (40.2 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

rtmixer-0.1.1-cp36-cp36m-manylinux1_x86_64.whl (43.4 kB view hashes)

Uploaded CPython 3.6m

rtmixer-0.1.1-cp36-cp36m-manylinux1_i686.whl (40.2 kB view hashes)

Uploaded CPython 3.6m

rtmixer-0.1.1-cp36-cp36m-macosx_10_9_x86_64.whl (16.0 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

rtmixer-0.1.1-cp35-cp35m-win_amd64.whl (18.3 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

rtmixer-0.1.1-cp35-cp35m-win32.whl (16.1 kB view hashes)

Uploaded CPython 3.5m Windows x86

rtmixer-0.1.1-cp35-cp35m-manylinux2010_x86_64.whl (43.8 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

rtmixer-0.1.1-cp35-cp35m-manylinux2010_i686.whl (40.7 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ i686

rtmixer-0.1.1-cp35-cp35m-manylinux1_x86_64.whl (43.8 kB view hashes)

Uploaded CPython 3.5m

rtmixer-0.1.1-cp35-cp35m-manylinux1_i686.whl (40.6 kB view hashes)

Uploaded CPython 3.5m

rtmixer-0.1.1-cp35-cp35m-macosx_10_9_x86_64.whl (15.6 kB view hashes)

Uploaded CPython 3.5m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page