Skip to content

m13253/pysoundio

 
 

Repository files navigation

PySoundIo

https://travis-ci.org/joextodd/pysoundio.svg?branch=master https://readthedocs.org/projects/pysoundio/badge/?version=latest

A simple Pythonic interface for libsoundio.

libsoundio is a robust, cross-platform solution for real-time audio. It performs no buffering or processing on your behalf, instead exposing the raw power of the underlying backend.

Dependencies

  • macOS

    brew install libsoundio
    
  • Ubuntu / Debian

    apt-get install libsoundio-dev
    
  • Windows

    • Download binaries from libsound.io
    • Copy the contents of the download into a folder at C:\\ProgramData\libsoundio

Some Ubuntu distributions link to an older version of libsoundio, so to use the latest version you will need to install from source.

Installation

Once you have installed the dependencies, you can use pip to download and install the latest release with a single command.

pip install pysoundio

or from source

python setup.py install

Examples

See examples directory.

Some of the examples require pysoundfile

pip install pysoundfile

On Windows and OS X, this will also install the library libsndfile. On Linux you will need to install the library as well.

  • Ubuntu / Debian

    apt-get install libsndfile1
    

:download:`devices.py <../examples/devices.py>`

List the available input and output devices on the system and their properties.

python devices.py

:download:`record.py <../examples/record.py>`

Records data from microphone and saves to a wav file. Supports specifying backend, device, sample rate, block size.

python record.py out.wav --device 0 --rate 44100

:download:`play.py <../examples/play.py>`

Plays a wav file through the speakers. Supports specifying backend, device, block size.

python play.py in.wav --device 0

:download:`sine.py <../examples/sine.py>`

Plays a sine wave through the speakers. Supports specifying backend, device, sample rate, block size.

python sine.py --freq 442

Testing

To run the test suite.

python setup.py test

About

Python bindings for libsoundio

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 54.9%
  • C 39.8%
  • C++ 5.3%