First of all, you’ll need Python. Any version where CFFI is supported should work. If you don’t have Python installed yet, you should get one of the distributions which already include CFFI and NumPy (and many other useful things), e.g. Anaconda or WinPython.
If you are using the
conda package manager (e.g. with Anaconda or Miniconda for
Linux/macOS/Windows), you can install the
sounddevice module from the
conda install -c conda-forge python-sounddevice
The PortAudio package on
conda-forge doesn’t have ASIO support,
There are also packages for several other package managers:
If you are using Windows, you can alternatively install one of the packages provided at https://www.lfd.uci.edu/~gohlke/pythonlibs/#sounddevice. The PortAudio library (with ASIO support) is included in the package and you can get the rest of the dependencies on the same page.
Note that some of the aforementioned packages may be out-of-date.
You can always get the newest
sounddevice release from PyPI
If you want to try the latest development version, have a look at the section
To install the latest release from PyPI, use:
python3 -m pip install sounddevice
Depending on your Python installation,
you may have to use
python instead of
If you have installed the module already, you can use the
--upgrade flag to
get the newest release.
To un-install, use:
python3 -m pip uninstall sounddevice
If you install the
sounddevice module with
pip on macOS or Windows,
the PortAudio library (with ASIO support on Windows) will be installed
On other platforms, you might have to install PortAudio with your package
manager (the package might be called
libportaudio2 or similar).
You might also have to install CFFI (from a package called
NumPy is only needed if you want to play back and record NumPy arrays.
sounddevice.RawOutputStream use plain Python buffer objects and don’t need
NumPy at all.
If you need NumPy, you should install it with your package manager (from a
python3-numpy or similar) or use a Python distribution that
already includes NumPy (see above).
You can also install NumPy with
pip, but depending on your platform, this
might require a compiler and several additional libraries.