-aubio Python module
-===================
+.. _python:
+
+Python module
+=============
+
+The aubio extension for Python is available for Python 2.7 and Python 3.
+
+Installing aubio with pip
+-------------------------
+
+aubio can now be installed using ``pip``:
+
+.. code-block:: console
+
+ $ pip install aubio
Building the module
-------------------
From ``aubio`` source directory, run the following:
-.. code-block:: bash
+.. code-block:: console
- $ cd python
+ $ ./setup.py clean
$ ./setup.py build
$ sudo ./setup.py install
-Using the module
-----------------
+Using aubio in python
+---------------------
+
+Once the python module is installed, its version can be checked with:
+
+.. code-block:: console
+
+ $ python -c "import aubio; print(aubio.version, aubio.float_type)"
+
+The command line `aubio` is also installed:
+
+.. code-block:: console
+
+ $ aubio -h
+
+A simple example
+................
+
+Here is a :download:`simple script <../python/demos/demo_source_simple.py>`
+that reads all the samples from a media file:
+
+.. literalinclude:: ../python/demos/demo_source_simple.py
+ :language: python
+
+Filtering an input sound file
+.............................
+
+Here is a more complete example, :download:`demo_filter.py
+<../python/demos/demo_filter.py>`. This files executes the following:
+
+* read an input media file (``aubio.source``)
+
+* filter it using an `A-weighting <https://en.wikipedia.org/wiki/A-weighting>`_
+ filter (``aubio.digital_filter``)
+
+* write result to a new file (``aubio.sink``)
+
+.. literalinclude:: ../python/demos/demo_filter.py
+ :language: python
-To use the python module, simply import aubio:
+More demos
+..........
-.. code-block:: python
+Check out the `python demos folder`_ for more examples.
- #! /usr/bin/env python
- import aubio
+Python tests
+------------
- s = aubio.source(sys.argv[1], 0, 256)
- while True:
- samples, read = s()
- print samples
- if read < 256: break
+A number of `python tests`_ are provided. To run them, use
+``python/tests/run_all_tests``.
-Check out the `python demos for aubio
-<https://github.com/piem/aubio/blob/develop/python/demos/>`_ for more examples.
+.. _python demos folder: https://github.com/aubio/aubio/blob/master/python/demos
+.. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py
+.. _python tests: https://github.com/aubio/aubio/blob/master/python/tests