feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 5417b3a was
5417b3a,
checked in by Paul Brossier <piem@piem.org>, 8 years ago
|
doc/python_module.rst: improve
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[5417b3a] | 1 | Python module |
---|
| 2 | ============= |
---|
[34abeaf] | 3 | |
---|
[5417b3a] | 4 | Installing aubio with pip |
---|
| 5 | ------------------------- |
---|
[241e2fb] | 6 | |
---|
| 7 | .. code-block:: bash |
---|
| 8 | |
---|
| 9 | $ pip install aubio |
---|
| 10 | |
---|
[34abeaf] | 11 | Building the module |
---|
| 12 | ------------------- |
---|
| 13 | |
---|
| 14 | From ``aubio`` source directory, run the following: |
---|
| 15 | |
---|
| 16 | .. code-block:: bash |
---|
| 17 | |
---|
[241e2fb] | 18 | $ ./setup.py clean |
---|
[34abeaf] | 19 | $ ./setup.py build |
---|
| 20 | $ sudo ./setup.py install |
---|
| 21 | |
---|
[5417b3a] | 22 | Using aubio in python |
---|
| 23 | --------------------- |
---|
| 24 | |
---|
| 25 | Once you have python-aubio installed, you should be able to run ``python -c |
---|
| 26 | "import aubio"``. |
---|
[34abeaf] | 27 | |
---|
[5417b3a] | 28 | A very simple example |
---|
| 29 | ..................... |
---|
| 30 | |
---|
| 31 | Here is a very simple script |
---|
| 32 | to read all the samples from a media file: |
---|
[34abeaf] | 33 | |
---|
| 34 | .. code-block:: python |
---|
| 35 | |
---|
| 36 | #! /usr/bin/env python |
---|
| 37 | import aubio |
---|
| 38 | |
---|
| 39 | s = aubio.source(sys.argv[1], 0, 256) |
---|
| 40 | while True: |
---|
| 41 | samples, read = s() |
---|
[5417b3a] | 42 | #print(samples) |
---|
[34abeaf] | 43 | if read < 256: break |
---|
| 44 | |
---|
[5417b3a] | 45 | Filtering an input sound file |
---|
| 46 | ............................. |
---|
| 47 | |
---|
| 48 | Here is a more complete example, `demo_filter.py`_. This files executes the following: |
---|
| 49 | |
---|
| 50 | * read an input media file (``aubio.source``) |
---|
| 51 | |
---|
| 52 | * filter it using an A-weighting 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 | |
---|
| 59 | More demos |
---|
| 60 | .......... |
---|
| 61 | |
---|
| 62 | Check out the `python demos folder`_ for more examples. |
---|
| 63 | |
---|
| 64 | Python tests |
---|
| 65 | ------------ |
---|
| 66 | |
---|
| 67 | A number of `python tests`_ are provided. To run them, use |
---|
| 68 | ``python/tests/run_all_tests``. |
---|
| 69 | |
---|
| 70 | .. _python tests folder: https://github.com/aubio/aubio/blob/master/python/tests |
---|
| 71 | .. _python demos folder: https://github.com/aubio/aubio/blob/master/python/demos |
---|
| 72 | .. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py |
---|
[34abeaf] | 73 | |
---|
Note: See
TracBrowser
for help on using the repository browser.