Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/python_module.rst

    r34abeaf rd8380d2  
    1 aubio Python module
    2 ===================
     1.. _python:
     2
     3Python module
     4=============
     5
     6The aubio extension for Python is available for Python 2.7 and Python 3.
     7
     8Installing aubio with pip
     9-------------------------
     10
     11aubio can now be installed using ``pip``:
     12
     13.. code-block:: bash
     14
     15    $ pip install aubio
    316
    417Building the module
     
    922.. code-block:: bash
    1023
    11     $ cd python
     24    $ ./setup.py clean
    1225    $ ./setup.py build
    1326    $ sudo ./setup.py install
    1427
    15 Using the module
    16 ----------------
     28Using aubio in python
     29---------------------
    1730
    18 To use the python module, simply import aubio:
     31Once you have python-aubio installed, you should be able to run ``python -c
     32"import aubio; print(aubio.version)"``.
    1933
    20 .. code-block:: python
     34A simple example
     35................
    2136
    22         #! /usr/bin/env python
    23         import aubio
     37Here is a :download:`simple script <../python/demos/demo_source_simple.py>`
     38that reads all the samples from a media file:
    2439
    25         s = aubio.source(sys.argv[1], 0, 256)
    26         while True:
    27           samples, read = s()
    28           print samples
    29           if read < 256: break
     40.. literalinclude:: ../python/demos/demo_source_simple.py
     41   :language: python
    3042
    31 Check out the `python demos for aubio
    32 <https://github.com/piem/aubio/blob/develop/python/demos/>`_ for more examples.
     43Filtering an input sound file
     44.............................
    3345
     46Here is a more complete example, :download:`demo_filter.py
     47<../python/demos/demo_filter.py>`. This files executes the following:
     48
     49* read an input media file (``aubio.source``)
     50
     51* filter it using an `A-weighting <https://en.wikipedia.org/wiki/A-weighting>`_
     52  filter (``aubio.digital_filter``)
     53
     54* write result to a new file (``aubio.sink``)
     55
     56.. literalinclude:: ../python/demos/demo_filter.py
     57   :language: python
     58
     59More demos
     60..........
     61
     62Check out the `python demos folder`_ for more examples.
     63
     64Python tests
     65------------
     66
     67A number of `python tests`_ are provided. To run them, use
     68``python/tests/run_all_tests``.
     69
     70.. _python demos folder: https://github.com/aubio/aubio/blob/master/python/demos
     71.. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py
     72.. _python tests: https://github.com/aubio/aubio/blob/master/python/tests
     73
Note: See TracChangeset for help on using the changeset viewer.