Changes in doc/python_module.rst [d8380d2:007c0a1]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/python_module.rst
rd8380d2 r007c0a1 1 .. _python :1 .. _python-install: 2 2 3 Python module 4 ============= 3 Installing aubio for Python 4 =========================== 5 5 6 The aubio extension for Python is available for Python 2.7 and Python 3. 6 aubio is available as a package for Python 2.7 and Python 3. The aubio 7 extension is written C using the `Python/C`_ and the `Numpy/C`_ APIs. 8 9 .. _Python/C: https://docs.python.org/c-api/index.html 10 .. _Numpy/C: https://docs.scipy.org/doc/numpy/reference/c-api.html 11 12 For general documentation on how to install Python packages, see `Installing 13 Packages`_. 7 14 8 15 Installing aubio with pip 9 16 ------------------------- 10 17 11 aubio can now be installedusing ``pip``:18 aubio can be installed from `PyPI`_ using ``pip``: 12 19 13 .. code-block:: bash20 .. code-block:: console 14 21 15 22 $ pip install aubio 16 23 17 Building the module 18 ------------------- 24 See also `Installing from PyPI`_ for general documentation. 19 25 20 From ``aubio`` source directory, run the following:26 .. note:: 21 27 22 .. code-block:: bash 28 aubio is currently a `source only`_ package, so you will need a compiler to 29 install it from `PyPI`_. See also `Installing aubio with conda`_ for 30 pre-compiled binaries. 31 32 .. _PyPI: https://pypi.python.org/pypi/aubio 33 .. _Installing Packages: https://packaging.python.org/tutorials/installing-packages/ 34 .. _Installing from PyPI: https://packaging.python.org/tutorials/installing-packages/#installing-from-pypi 35 .. _source only: https://packaging.python.org/tutorials/installing-packages/#source-distributions-vs-wheels 36 37 Installing aubio with conda 38 --------------------------- 39 40 `Conda packages`_ are available through the `conda-forge`_ channel for Linux, 41 macOS, and Windows: 42 43 .. code-block:: console 44 45 $ conda config --add channels conda-forge 46 $ conda install -c conda-forge aubio 47 48 .. _Conda packages: https://anaconda.org/conda-forge/aubio 49 .. _conda-forge: https://conda-forge.org/ 50 51 .. _py-doubleprecision: 52 53 Double precision 54 ---------------- 55 56 This module can be compiled in double-precision mode, in which case the 57 default type for floating-point samples will be 64-bit. The default is 58 single precision mode (32-bit, recommended). 59 60 To build the aubio module with double precision, use the option 61 `--enable-double` of the `build_ext` subcommand: 62 63 .. code:: bash 23 64 24 65 $ ./setup.py clean 25 $ ./setup.py build 26 $ sudo ./setup.py install66 $ ./setup.py build_ext --enable-double 67 $ pip install -v . 27 68 28 Using aubio in python 29 --------------------- 69 **Note**: If linking against `libaubio`, make sure the library was also 70 compiled in :ref:`doubleprecision` mode. 30 71 31 Once you have python-aubio installed, you should be able to run ``python -c32 "import aubio; print(aubio.version)"``.33 72 34 A simple example 35 ................ 73 Checking your installation 74 -------------------------- 36 75 37 Here is a :download:`simple script <../python/demos/demo_source_simple.py>` 38 that reads all the samples from a media file: 76 Once the python module is installed, its version can be checked with: 39 77 40 .. literalinclude:: ../python/demos/demo_source_simple.py 41 :language: python 78 .. code-block:: console 42 79 43 Filtering an input sound file 44 ............................. 80 $ python -c "import aubio; print(aubio.version, aubio.float_type)" 45 81 46 Here is a more complete example, :download:`demo_filter.py 47 <../python/demos/demo_filter.py>`. This files executes the following: 82 The command line `aubio` is also installed: 48 83 49 * read an input media file (``aubio.source``) 84 .. code-block:: console 50 85 51 * filter it using an `A-weighting <https://en.wikipedia.org/wiki/A-weighting>`_ 52 filter (``aubio.digital_filter``) 86 $ aubio -h 53 87 54 * write result to a new file (``aubio.sink``)55 56 .. literalinclude:: ../python/demos/demo_filter.py57 :language: python58 59 More demos60 ..........61 62 Check out the `python demos folder`_ for more examples.63 88 64 89 Python tests 65 90 ------------ 66 91 67 A number of `python tests`_ are provided. To run them, use68 ``python/tests/run_all_tests``. 92 A number of Python tests are provided in the `python tests`_. To run them, 93 install `nose2`_ and run the script ``python/tests/run_all_tests``: 69 94 70 .. _python demos folder: https://github.com/aubio/aubio/blob/master/python/demos 95 .. code-block:: console 96 97 $ pip install nose2 98 $ ./python/tests/run_all_tests 99 71 100 .. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py 72 101 .. _python tests: https://github.com/aubio/aubio/blob/master/python/tests 73 102 .. _nose2: https://github.com/nose-devs/nose2
Note: See TracChangeset
for help on using the changeset viewer.