diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2018-08-22 11:26:35 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2018-08-22 11:26:35 +0200 |
| commit | 6bc399853f1c43ad65c7126516eee005264dfb01 (patch) | |
| tree | beea777b604037e2fb529aa261c295850ed99b4b | |
| parent | f41bbf2fbf0fdd0bc3ad1ee90204c690b32e22e9 (diff) | |
DOC: Re-structure "installation" section
| -rw-r--r-- | README.rst | 128 |
1 files changed, 57 insertions, 71 deletions
@@ -13,79 +13,44 @@ Source code repository and issue tracker: License: MIT -- see the file ``LICENSE`` for details. -.. image:: https://badge.fury.io/py/sounddevice.svg - :target: https://pypi.python.org/pypi/sounddevice/ +Installation +------------ + +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_. + +.. image:: https://anaconda.org/conda-forge/python-sounddevice/badges/version.svg + :target: https://anaconda.org/conda-forge/python-sounddevice + +If you are using the ``conda`` package manager (e.g. with Anaconda_ for +Linux/macOS/Windows), you can install the ``sounddevice`` module from the +``conda-forge`` channel:: + + conda install -c conda-forge python-sounddevice + +There are also packages for several other package managers: .. image:: https://repology.org/badge/vertical-allrepos/python:sounddevice.svg :target: https://repology.org/metapackage/python:sounddevice -Requirements ------------- - -Python: - Of course, you'll need Python_. - Any version where CFFI (see below) 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_. - -pip/setuptools: - Those are needed for the installation of the Python module and its - dependencies. Most systems will have these installed already, but if not, - you should install it with your package manager or you can download and - install ``pip`` and ``setuptools`` as described on the `pip installation`_ - page. - If you happen to have ``pip`` but not ``setuptools``, use this command:: - - python3 -m pip install setuptools --user - - To upgrade to a newer version of an already installed package (including - ``pip`` itself), use the ``--upgrade`` flag. - -CFFI: - The `C Foreign Function Interface for Python`_ is used to access the C-API - of the PortAudio library from within Python. It supports CPython 2.6, 2.7, - 3.x; and is distributed with PyPy_. - If it's not installed already, you should install it with your package - manager (the package might be called ``python3-cffi`` or similar), or you can - get it with:: - - python3 -m pip install cffi --user - -PortAudio library: - The PortAudio_ library must be installed on your system (and CFFI must be - able to find it). Again, you should use your package manager to install it - (the package might be called ``libportaudio2`` or similar). - If you prefer, you can of course also download the sources and compile the - library yourself. If you are using Mac OS X or Windows, the library will be - installed automagically with *pip* (see "Installation" below). - -NumPy (optional): - NumPy_ is only needed if you want to play back and record NumPy arrays. - The classes `sounddevice.RawStream`, `sounddevice.RawInputStream` and - `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 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:: - - python3 -m pip install NumPy --user +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 is included in the package and you can get the rest +of the dependencies on the same page. -.. _PortAudio: http://www.portaudio.com/ -.. _NumPy: http://www.numpy.org/ -.. _Python: https://www.python.org/ -.. _Anaconda: https://www.anaconda.com/download/ -.. _WinPython: http://winpython.github.io/ -.. _C Foreign Function Interface for Python: http://cffi.readthedocs.io/ -.. _PyPy: http://pypy.org/ -.. _pip installation: https://pip.pypa.io/en/latest/installing/ +Note that some of the aforementioned packages may be out-of-date. +You can always get the newest ``sounddevice`` release from PyPI_ +(using ``pip``). +If you want to try the latest development version, have a look at the section +about `Contributing`_. -Installation ------------- +.. image:: https://badge.fury.io/py/sounddevice.svg + :target: https://pypi.org/project/sounddevice/ -Once you have installed the above-mentioned dependencies, you can use pip -to download and install the latest release with a single command:: +To install the latest release from PyPI, use:: python3 -m pip install sounddevice --user @@ -98,10 +63,31 @@ To un-install, use:: python3 -m pip uninstall sounddevice -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 is also included in the package and you can get the rest -of the dependencies on the same page. +If you install the ``sounddevice`` module with ``pip`` on macOS or Windows, the +PortAudio_ library will be installed automagically. +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 ``python3-cffi`` or +similar). + +NumPy_ is only needed if you want to play back and record NumPy arrays. +The classes `sounddevice.RawStream`, `sounddevice.RawInputStream` and +`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 +package named ``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. + +.. _PortAudio: http://www.portaudio.com/ +.. _NumPy: http://www.numpy.org/ +.. _Python: https://www.python.org/ +.. _Anaconda: https://www.anaconda.com/download/ +.. _WinPython: http://winpython.github.io/ +.. _CFFI: http://cffi.readthedocs.io/ +.. _PyPI: https://pypi.org/project/sounddevice/ Usage ----- @@ -165,7 +151,7 @@ After that, you can drop the additional arguments: .. code:: python - myrecording = sd.rec(duration * fs) + myrecording = sd.rec(int(duration * fs)) This function also returns immediately but continues recording in the background. In the meantime, you can run other commands. If you want to check |
