source: doc/python_module.rst @ 9511547

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since 9511547 was 3d8a6c0, checked in by Paul Brossier <piem@piem.org>, 6 years ago

doc/*.rst: use console highlighting

  • Property mode set to 100644
File size: 1.9 KB

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:

$ pip install aubio

Building the module

From aubio source directory, run the following:

$ ./setup.py clean
$ ./setup.py build
$ sudo ./setup.py install

Using aubio in python

Once the python module is installed, its version can be checked with:

$ python -c "import aubio; print(aubio.version, aubio.float_type)"

The command line aubio is also installed:

$ 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 filter (aubio.digital_filter)
  • write result to a new file (aubio.sink)
?
.. literalinclude:: ../python/demos/demo_filter.py
   :language: python

More demos

Check out the python demos folder for more examples.

Python tests

A number of python tests are provided. To run them, use python/tests/run_all_tests.

Note: See TracBrowser for help on using the repository browser.