source: doc/python_module.rst @ 5417b3a

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchpitchshiftsamplertimestretchyinfft+
Last change on this file since 5417b3a was 5417b3a, checked in by Paul Brossier <piem@piem.org>, 3 years ago

doc/python_module.rst: improve

  • Property mode set to 100644
File size: 1.6 KB

Python module

Installing aubio with 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 you have python-aubio installed, you should be able to run python -c "import aubio".

A very simple example

Here is a very simple script to read all the samples from a media file:

#! /usr/bin/env python
import aubio
s = aubio.source(sys.argv[1], 0, 256)
while True:
  samples, read = s()
  #print(samples)
  if read < 256: break

Filtering an input sound file

Here is a more complete example, 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.