History

doc/python_module.rst: improve

Paul Brossier committed 10 years ago

Commit 5417b3a1 parent f7547e71 file · +43 −10Browse files

Showing the changes to doc/python_module.rst (1 of 1 file). Show all

Unified · Split

doc/python_module.rst+43−10
@@ -1,8 +1,8 @@
1aubio Python module1Python module
2===================2=============
3 3
4Installing with pip4Installing aubio with pip
5-------------------5-------------------------
6 6
7.. code-block:: bash7.. code-block:: bash
8 8
@@ -19,10 +19,17 @@ From ``aubio`` source directory, run the following: · 10 unmodified lines
19 $ ./setup.py build19 $ ./setup.py build
20 $ sudo ./setup.py install20 $ sudo ./setup.py install
21 21
22Using the module22Using aubio in python
23----------------23---------------------
24
25Once you have python-aubio installed, you should be able to run ``python -c
26"import aubio"``.
24 27
25To use the python module, simply import aubio:28A very simple example
29.....................
30
31Here is a very simple script
32to read all the samples from a media file:
26 33
27.. code-block:: python34.. code-block:: python
28 35
@@ -32,9 +39,35 @@ To use the python module, simply import aubio: · 3 unmodified lines
32 s = aubio.source(sys.argv[1], 0, 256)39 s = aubio.source(sys.argv[1], 0, 256)
33 while True:40 while True:
34 samples, read = s()41 samples, read = s()
35 print samples42 #print(samples)
36 if read < 256: break43 if read < 256: break
37 44
38Check out the `python demos for aubio45Filtering an input sound file
39<https://github.com/piem/aubio/blob/develop/python/demos/>`_ for more examples.46.............................
47
48Here 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
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 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
40 73

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t