Unified · Split
| @@ -62,15 +62,17 @@ addons: · 61 unmodified lines | |||
| 62 | - libfftw3-dev | 62 | - libfftw3-dev |
| 63 | - sox | 63 | - sox |
| 64 | - lcov | 64 | - lcov |
| 65 | homebrew: | ||
| 66 | packages: | ||
| 67 | - sox | ||
| 68 | - ffmpeg | ||
| 69 | - libsndfile | ||
| 70 | - lcov | ||
| 71 | #update: true | ||
| 65 | 72 | ||
| 66 | before_install: | 73 | before_install: |
| 67 | - | | 74 | - | |
| 68 | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | 75 | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then |
| 69 | brew update | ||
| 70 | brew install sox | ||
| 71 | brew install ffmpeg | ||
| 72 | brew install libsndfile | ||
| 73 | brew install lcov | ||
| 74 | export PATH="$HOME/Library/Python/2.7/bin/:$PATH" | 76 | export PATH="$HOME/Library/Python/2.7/bin/:$PATH" |
| 75 | fi; | 77 | fi; |
| 76 | 78 | ||
| @@ -83,8 +85,6 @@ install: · 6 unmodified lines | |||
| 83 | - travis_retry make getwaf expandwaf deps_python | 85 | - travis_retry make getwaf expandwaf deps_python |
| 84 | - which pip | 86 | - which pip |
| 85 | - pip --version | 87 | - pip --version |
| 86 | - pip install python-coveralls | ||
| 87 | - gem install coveralls-lcov | ||
| 88 | 88 | ||
| 89 | script: | 89 | script: |
| 90 | - make create_test_sounds | 90 | - make create_test_sounds |
| @@ -99,10 +99,6 @@ script: · 8 unmodified lines | |||
| 99 | after_success: | 99 | after_success: |
| 100 | - | | 100 | - | |
| 101 | if [[ -z "$AUBIO_NOTESTS" ]]; then | 101 | if [[ -z "$AUBIO_NOTESTS" ]]; then |
| 102 | # upload lcov coverage to coveralls.io | ||
| 103 | coveralls-lcov build/coverage.info | ||
| 104 | # upload python coverage | ||
| 105 | #coveralls | ||
| 106 | # upload to codecov | 102 | # upload to codecov |
| 107 | bash <(curl -s https://codecov.io/bash) | 103 | bash <(curl -s https://codecov.io/bash) |
| 108 | fi | 104 | fi |
| @@ -1,3 +1,79 @@ | |||
| 1 | 2018-11-21 Paul Brossier <piem@aubio.org> | ||
| 2 | |||
| 3 | [ Overview ] | ||
| 4 | |||
| 5 | * VERSION: bump to 0.4.8 | ||
| 6 | * notes: new option release_drop (gh-203) | ||
| 7 | * spectral: new parameters added to filterbank and mfcc (gh-206) | ||
| 8 | * python: start documenting module (gh-73, debian #480018), improve build for | ||
| 9 | win-amd64 (gh-154, gh-199, gh-208) | ||
| 10 | * fixes: prevent crash when using fft sizes unsupported by vDSP (gh-207), | ||
| 11 | prevent saturation when down-mixing a multi-channel source (avcodec/ffmpeg) | ||
| 12 | |||
| 13 | [ Fixes ] | ||
| 14 | |||
| 15 | * avcodec: prevent saturation when down-mixing a multi-channel source, emit | ||
| 16 | a warning if compiling against avutil < 53 (gh-137), wrap long lines | ||
| 17 | * examples/: avoid hiding global and unreachable code | ||
| 18 | * fft: limit to r*2*n sizes, with r in [1, 3, 5, 15] (vDSP only) (gh-207) | ||
| 19 | * fft: fix reconstruction for odd sizes (fftw only) | ||
| 20 | * pvoc: add missing implementations for aubio_pvoc_get_hop/win | ||
| 21 | * mathutils: increase ln(2) precision of in freqtomidi/miditofreq | ||
| 22 | * wavetable: stop sets playing to 0, add dummy implementation for _load | ||
| 23 | |||
| 24 | [ New features ] | ||
| 25 | |||
| 26 | * src/musicutils.h: new aubio_meltohz, aubio_hztomel, with _htk versions | ||
| 27 | * src/spectral/filterbank.h: new set_mel_coeffs, set_mel_coeffs_htk, | ||
| 28 | set_power, and set_norm methods, improved set_triangle_bands | ||
| 29 | * src/spectral/mfcc.h: new set_scale, set_power, set_norm, set_mel_coeffs, | ||
| 30 | set_mel_coeffs_htk, set_mel_coeffs_slaney | ||
| 31 | * src/mathutils.h: new fvec_mul | ||
| 32 | * src/notes: new option release_drop to prevent missing note-offs (gh-203) | ||
| 33 | |||
| 34 | [ Python module ] | ||
| 35 | |||
| 36 | * fix: rounding to nearest integer in midi2note and freq2note | ||
| 37 | * general: supports code generation of setters with none or multiple | ||
| 38 | parameters | ||
| 39 | * documentation: add docstrings do fvec, cvec, source, sink, pvoc, frequency | ||
| 40 | conversion and level detection routines (gh-73, debian #480018) | ||
| 41 | * slicing: improve and document slice_source_at_stamps | ||
| 42 | * module: new note2freq function, recover error log when raising exceptions | ||
| 43 | on failed set_ methods, prevent cyclic import, coding style improvements | ||
| 44 | * demos: improve coding style, fix bpm_extract arguments | ||
| 45 | * MANIFEST.in: exclude *.pyc, improve patterns | ||
| 46 | |||
| 47 | [ Documentation ] | ||
| 48 | |||
| 49 | * doc/: use sphinx autodoc to load docstrings from aubio module, reorganize | ||
| 50 | python module documentation, add a note about double precision, use https | ||
| 51 | when possible | ||
| 52 | * src/spectral/: update Auditory Toolbox url, update copyright year | ||
| 53 | |||
| 54 | [ Tools ] | ||
| 55 | |||
| 56 | * aubionotes: add --release-drop option | ||
| 57 | * aubio: add --release-drop and --silence options to `aubio notes`, | ||
| 58 | workaround for -V to really show version (py2) | ||
| 59 | * aubiocut: add option --create-first to always create first slice | ||
| 60 | |||
| 61 | [ Tests ] | ||
| 62 | |||
| 63 | * tests/, python/tests: add tests for new methods, check source channel | ||
| 64 | down-mix, improve coverage | ||
| 65 | |||
| 66 | [ Build system ] | ||
| 67 | |||
| 68 | * Makefile: disable docs when measuring coverage, add branch coverage | ||
| 69 | option, add coverage_zero_counters target, improve html report | ||
| 70 | * waf: update to 2.0.12, improve wscript style, prevent shipping some | ||
| 71 | generated files | ||
| 72 | * python: always show compiler warnings when pre-processing headers, | ||
| 73 | workaround to fix code generation for win-amd64 (gh-154, gh-199, gh-208). | ||
| 74 | * continuous integration: add azure pipelines, update and improve | ||
| 75 | configurations for appveyor, circleci, and travis. | ||
| 76 | |||
| 1 | 2018-09-22 Paul Brossier <piem@aubio.org> | 77 | 2018-09-22 Paul Brossier <piem@aubio.org> |
| 2 | 78 | ||
| 3 | [ Overview ] | 79 | [ Overview ] |
| @@ -1,6 +1,7 @@ | |||
| 1 | include AUTHORS COPYING README.md VERSION ChangeLog | 1 | include AUTHORS COPYING README.md VERSION ChangeLog |
| 2 | include python/README.md | 2 | include python/README.md |
| 3 | include this_version.py | 3 | include this_version.py |
| 4 | include waf_gensyms.py | ||
| 4 | include waf | 5 | include waf |
| 5 | recursive-include waflib *.py | 6 | recursive-include waflib *.py |
| 6 | include Makefile wscript */wscript_build | 7 | include Makefile wscript */wscript_build |
| @@ -42,6 +42,8 @@ SOX=sox · 41 unmodified lines | |||
| 42 | 42 | ||
| 43 | TESTSOUNDS := python/tests/sounds | 43 | TESTSOUNDS := python/tests/sounds |
| 44 | 44 | ||
| 45 | LCOVOPTS += --rc lcov_branch_coverage=1 | ||
| 46 | |||
| 45 | all: build | 47 | all: build |
| 46 | 48 | ||
| 47 | checkwaf: | 49 | checkwaf: |
| @@ -243,22 +245,36 @@ coverage: export PYTHONPATH=$(PWD)/python/lib · 195 unmodified lines | |||
| 243 | coverage: export LD_LIBRARY_PATH=$(PWD)/build/src | 245 | coverage: export LD_LIBRARY_PATH=$(PWD)/build/src |
| 244 | coverage: force_uninstall_python deps_python \ | 246 | coverage: force_uninstall_python deps_python \ |
| 245 | clean_python clean distclean build local_dylib | 247 | clean_python clean distclean build local_dylib |
| 246 | lcov --capture --no-external --directory . --output-file build/coverage_lib.info | 248 | # capture coverage after running c tests |
| 249 | lcov $(LCOVOPTS) --capture --no-external --directory . \ | ||
| 250 | --output-file build/coverage_lib.info | ||
| 251 | # build and test python | ||
| 247 | pip install -v -e . | 252 | pip install -v -e . |
| 253 | # run tests, with python coverage | ||
| 248 | coverage run `which pytest` | 254 | coverage run `which pytest` |
| 249 | lcov --capture --no-external --directory . --output-file build/coverage_python.info | 255 | # capture coverage again |
| 250 | lcov -a build/coverage_python.info -a build/coverage_lib.info -o build/coverage.info | 256 | lcov $(LCOVOPTS) --capture --no-external --directory . \ |
| 257 | --output-file build/coverage_python.info | ||
| 258 | # merge both coverage info files | ||
| 259 | lcov $(LCOVOPTS) -a build/coverage_python.info -a build/coverage_lib.info \ | ||
| 260 | --output-file build/coverage.info | ||
| 261 | # remove tests | ||
| 262 | lcov $(LCOVOPTS) --remove build/coverage.info '*/tests/*' '*/ooura_fft8g*' \ | ||
| 263 | --output-file build/coverage_lib.info | ||
| 251 | 264 | ||
| 252 | # make sure we don't build the doc, which builds a temporary python module | 265 | # make sure we don't build the doc, which builds a temporary python module |
| 253 | coverage_report: export WAFOPTS += --disable-docs | 266 | coverage_report: export WAFOPTS += --disable-docs |
| 254 | coverage_report: coverage | 267 | coverage_report: coverage |
| 255 | genhtml build/coverage.info --output-directory lcov_html | 268 | # create coverage report dir |
| 256 | mkdir -p gcovr_html/ | 269 | mkdir -p build/coverage/ |
| 257 | gcovr -r . --html --html-details \ | 270 | # generate report with lcov's genhtml |
| 258 | --output gcovr_html/index.html \ | 271 | genhtml build/coverage_lib.info --output-directory build/coverage/lcov \ |
| 259 | --exclude ".*tests/.*" --exclude ".*examples/.*" | 272 | --branch-coverage --highlight --legend |
| 273 | # generate python report with coverage python package | ||
| 260 | coverage report | 274 | coverage report |
| 261 | coverage html | 275 | coverage html -d build/coverage/coverage |
| 276 | # show links to generated reports | ||
| 277 | for i in $$(ls build/coverage/*/index.html); do echo file://$(PWD)/$$i; done | ||
| 262 | 278 | ||
| 263 | sphinx: configure | 279 | sphinx: configure |
| 264 | $(WAFCMD) sphinx $(WAFOPTS) | 280 | $(WAFCMD) sphinx $(WAFOPTS) |
| @@ -1,7 +1,7 @@ | |||
| 1 | AUBIO_MAJOR_VERSION=0 | 1 | AUBIO_MAJOR_VERSION=0 |
| 2 | AUBIO_MINOR_VERSION=4 | 2 | AUBIO_MINOR_VERSION=4 |
| 3 | AUBIO_PATCH_VERSION=8 | 3 | AUBIO_PATCH_VERSION=8 |
| 4 | AUBIO_VERSION_STATUS='~alpha' | 4 | AUBIO_VERSION_STATUS='' |
| 5 | LIBAUBIO_LT_CUR=5 | 5 | LIBAUBIO_LT_CUR=5 |
| 6 | LIBAUBIO_LT_REV=3 | 6 | LIBAUBIO_LT_REV=4 |
| 7 | LIBAUBIO_LT_AGE=7 | 7 | LIBAUBIO_LT_AGE=8 |
| @@ -50,6 +50,8 @@ OPTIONS · 49 unmodified lines | |||
| 50 | --cut-until-nslices n How many extra slices should be added at the end of | 50 | --cut-until-nslices n How many extra slices should be added at the end of |
| 51 | each slice (default 0). | 51 | each slice (default 0). |
| 52 | 52 | ||
| 53 | --create-first Alway create first slice. | ||
| 54 | |||
| 53 | -h, --help Print a short help message and exit. | 55 | -h, --help Print a short help message and exit. |
| 54 | 56 | ||
| 55 | -v, --verbose Be verbose. | 57 | -v, --verbose Be verbose. |
| @@ -3,28 +3,50 @@ · 2 unmodified lines | |||
| 3 | Installing aubio for Python | 3 | Installing aubio for Python |
| 4 | =========================== | 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 | Installing aubio with pip | 15 | Installing aubio with pip |
| 9 | ------------------------- | 16 | ------------------------- |
| 10 | 17 | ||
| 11 | aubio can now be installed using ``pip``: | 18 | aubio can be installed from `PyPI`_ using ``pip``: |
| 12 | 19 | ||
| 13 | .. code-block:: console | 20 | .. code-block:: console |
| 14 | 21 | ||
| 15 | $ pip install aubio | 22 | $ pip install aubio |
| 16 | 23 | ||
| 17 | Building the module | 24 | See also `Installing from PyPI`_ for general documentation. |
| 18 | ------------------- | 25 | |
| 26 | .. note:: | ||
| 27 | |||
| 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 | --------------------------- | ||
| 19 | 39 | ||
| 20 | From ``aubio`` source directory, run the following: | 40 | `Conda packages`_ are available through the `conda-forge`_ channel for Linux, |
| 41 | macOS, and Windows: | ||
| 21 | 42 | ||
| 22 | .. code-block:: console | 43 | .. code-block:: console |
| 23 | 44 | ||
| 24 | $ ./setup.py clean | 45 | $ conda config --add channels conda-forge |
| 25 | $ ./setup.py build | 46 | $ conda install -c conda-forge aubio |
| 26 | $ sudo ./setup.py install | ||
| 27 | 47 | ||
| 48 | .. _Conda packages: https://anaconda.org/conda-forge/aubio | ||
| 49 | .. _conda-forge: https://conda-forge.org/ | ||
| 28 | 50 | ||
| 29 | .. _py-doubleprecision: | 51 | .. _py-doubleprecision: |
| 30 | 52 | ||
| @@ -67,14 +89,15 @@ The command line `aubio` is also installed: · 36 unmodified lines | |||
| 67 | Python tests | 89 | Python tests |
| 68 | ------------ | 90 | ------------ |
| 69 | 91 | ||
| 70 | A number of python tests are provided. To run them, use [pytest] from the | 92 | A number of Python tests are provided in the `python/tests`_ folder. To run |
| 71 | aubio source tree: | 93 | them, install `pytest`_ and run it from the aubio source directory: |
| 94 | |||
| 95 | .. code-block:: console | ||
| 72 | 96 | ||
| 97 | $ pip install pytest | ||
| 98 | $ git clone https://git.aubio.org/aubio/aubio | ||
| 73 | $ cd aubio | 99 | $ cd aubio |
| 74 | $ pytest | 100 | $ pytest |
| 75 | 101 | ||
| 76 | Each test script can also be called individually. For instance: | 102 | .. _python/tests: https://github.com/aubio/aubio/blob/master/python/tests |
| 77 | 103 | .. _pytest: https://pytest.org | |
| 78 | $ ./python/tests/test_note2midi.py -v | ||
| 79 | |||
| 80 | [pytest]: https://pytest.org | ||
| @@ -302,10 +302,38 @@ Here is an example of a custom command: · 301 unmodified lines | |||
| 302 | Double precision | 302 | Double precision |
| 303 | ................ | 303 | ................ |
| 304 | 304 | ||
| 305 | The datatype used to store real numbers in aubio is named `smpl_t`. By default, | ||
| 306 | `smpl_t` is defined as `float`, a `single-precision format | ||
| 307 | <https://en.wikipedia.org/wiki/Single-precision_floating-point_format>`_ | ||
| 308 | (32-bit). Some algorithms require a floating point representation with a | ||
| 309 | higher precision, for instance to prevent arithmetic underflow in recursive | ||
| 310 | filters. In aubio, these special samples are named `lsmp_t` and defined as | ||
| 311 | `double` by default (64-bit). | ||
| 312 | |||
| 313 | Sometimes it may be useful to compile aubio in `double-precision`, for instance | ||
| 314 | to reproduce numerical results obtained with 64-bit routines. In this case, | ||
| 315 | `smpl_t` will be defined as `double`. | ||
| 316 | |||
| 317 | The following table shows how `smpl_t` and `lsmp_t` are defined in single- and | ||
| 318 | double-precision modes: | ||
| 319 | |||
| 320 | .. list-table:: Single and double-precision modes | ||
| 321 | :align: center | ||
| 322 | |||
| 323 | * - | ||
| 324 | - single | ||
| 325 | - double | ||
| 326 | * - `smpl_t` | ||
| 327 | - ``float`` | ||
| 328 | - ``double`` | ||
| 329 | * - `lsmp_t` | ||
| 330 | - ``double`` | ||
| 331 | - ``long double`` | ||
| 332 | |||
| 305 | To compile aubio in double precision mode, configure with ``--enable-double``. | 333 | To compile aubio in double precision mode, configure with ``--enable-double``. |
| 306 | 334 | ||
| 307 | To compile aubio in single precision mode, use ``--disable-double`` (default, | 335 | To compile in single-precision mode (default), use ``--disable-double`` (or |
| 308 | recommended). | 336 | simply none of these two options). |
| 309 | 337 | ||
| 310 | Disabling the tests | 338 | Disabling the tests |
| 311 | ................... | 339 | ................... |
| @@ -1,105 +1,109 @@ | |||
| 1 | Python aubio module | 1 | aubio |
| 2 | =================== | 2 | ===== |
| 3 | 3 | ||
| 4 | This module wraps the aubio library for Python using the numpy module. | 4 | aubio is a collection of tools for music and audio analysis. |
| 5 | 5 | ||
| 6 | Using the Python aubio module | 6 | This package integrates the aubio library with [NumPy] to provide a set of |
| 7 | ----------------------------- | 7 | efficient tools to process and analyse audio signals, including: |
| 8 | 8 | ||
| 9 | After installing python-aubio, you will be able to import the aubio module: | 9 | - read audio from any media file, including videos and remote streams |
| 10 | - high quality phase vocoder, spectral filterbanks, and linear filters | ||
| 11 | - Mel-Frequency Cepstrum Coefficients and standard spectral descriptors | ||
| 12 | - detection of note attacks (onset) | ||
| 13 | - pitch tracking (fundamental frequency estimation) | ||
| 14 | - beat detection and tempo tracking | ||
| 10 | 15 | ||
| 11 | $ python | 16 | aubio works with both Python 2 and Python 3. |
| 12 | [...] | ||
| 13 | >>> import aubio | ||
| 14 | >>> help(aubio.miditofreq) | ||
| 15 | 17 | ||
| 16 | Finding some inspiration | 18 | Links |
| 17 | ------------------------ | 19 | ----- |
| 18 | 20 | ||
| 19 | Some examples are available in the `python/demos` directory. These scripts are | 21 | - [module documentation][doc_python] |
| 20 | small programs written in python and using python-aubio. | 22 | - [installation instructions][doc_python_install] |
| 23 | - [aubio manual][manual] | ||
| 24 | - [aubio homepage][homepage] | ||
| 25 | - [issue tracker][bugtracker] | ||
| 21 | 26 | ||
| 22 | For instance, `demo_source.py` reads a media file. | 27 | Demos |
| 28 | ----- | ||
| 23 | 29 | ||
| 24 | $ ./python/demos/demo_source.py /path/to/sound/sample.wav | 30 | Some examples are available in the [`python/demos`][demos_dir] folder. Each |
| 31 | script is a command line program which accepts one ore more argument. | ||
| 25 | 32 | ||
| 26 | and `demo_timestretch_online.py` stretches the original file into a new one: | 33 | **Notes**: installing additional modules is required to run some of the demos. |
| 27 | 34 | ||
| 28 | $ ./python/demo/demo_timestretch_online.py loop.wav stretched_loop.wav 0.92` | 35 | ### Analysis |
| 29 | 36 | ||
| 30 | Note: you might need to install additional modules to run some of the demos. | 37 | - `demo_source.py` uses aubio to read audio samples from media files |
| 31 | Some demos use [matplotlib](http://matplotlib.org/) to draw plots, others use | 38 | - `demo_onset_plot.py` detects attacks in a sound file and plots the results |
| 32 | [PySoundCard](https://github.com/bastibe/PySoundCard) to play and record | 39 | using [matplotlib] |
| 33 | sounds. | 40 | - `demo_pitch.py` looks for fundamental frequency in a sound file and plots the |
| 41 | results using [matplotlib] | ||
| 42 | - `demo_spectrogram.py`, `demo_specdesc.py`, `demo_mfcc.py` for spectral | ||
| 43 | analysis. | ||
| 34 | 44 | ||
| 35 | Testing the Python module | 45 | ### Real-time |
| 36 | ------------------------- | ||
| 37 | 46 | ||
| 38 | Python tests are in `python/tests` and use [pytest]. | 47 | - `demo_pyaudio.py` and `demo_tapthebeat.py` use [pyaudio] |
| 48 | - `demo_pysoundcard_play.py`, `demo_pysoundcard.py` use [PySoundCard] | ||
| 49 | - `demo_alsa.py` uses [pyalsaaudio] | ||
| 39 | 50 | ||
| 40 | To run the all the python tests: | 51 | ### Others |
| 41 | 52 | ||
| 42 | $ cd aubio | 53 | - `demo_timestretch.py` can change the duration of an input file and write the |
| 43 | $ pytest | 54 | new sound to disk, |
| 55 | - `demo_wav2midi.py` detects the notes in a file and uses [mido] to write the | ||
| 56 | results into a MIDI file | ||
| 44 | 57 | ||
| 45 | Each test script can also be called one at a time. For instance: | 58 | ### Example |
| 46 | 59 | ||
| 47 | $ pytest -v python/tests/test_note2midi.py | 60 | Use `demo_timestretch_online.py` to slow down `loop.wav`, write the results in |
| 61 | `stretched_loop.wav`: | ||
| 48 | 62 | ||
| 49 | [pytest]: https://pytest.org | 63 | $ python demo_timestretch_online.py loop.wav stretched_loop.wav 0.92 |
| 50 | 64 | ||
| 51 | Install in a virtualenv | 65 | Built with |
| 52 | ----------------------- | ||
| 53 | |||
| 54 | You should be able to install python-aubio directly from the top source | ||
| 55 | directory of aubio. | ||
| 56 | |||
| 57 | First, create a virtualenv to hold the required python module: | ||
| 58 | |||
| 59 | $ virtualenv pyaubio | ||
| 60 | $ source pyaubio/bin/activate | ||
| 61 | |||
| 62 | Now install and build the python extension using: | ||
| 63 | |||
| 64 | $ pip install . | ||
| 65 | |||
| 66 | Install requirements | ||
| 67 | -------------------- | ||
| 68 | |||
| 69 | Before compiling this module, you must have compiled libaubio. | ||
| 70 | |||
| 71 | A simple way to do this is with pip: | ||
| 72 | |||
| 73 | $ pip install -r requirements.txt | ||
| 74 | |||
| 75 | For more information about how this module works, please refer to the [Python/C | ||
| 76 | API Reference Manual] (http://docs.python.org/c-api/index.html) and the | ||
| 77 | [Numpy/C API Reference](http://docs.scipy.org/doc/numpy/reference/c-api.html). | ||
| 78 | |||
| 79 | Compiling python aubio | ||
| 80 | ---------------------- | ||
| 81 | |||
| 82 | To build the aubio Python module, run the following command from the top source | ||
| 83 | directory of aubio: | ||
| 84 | |||
| 85 | $ ./setup.py build | ||
| 86 | |||
| 87 | Note: if libaubio was previously built using waf, the script will use it. | ||
| 88 | Otherwise, the entire library will be built inside the python extension. | ||
| 89 | |||
| 90 | To find out more about `setup.py` options: | ||
| 91 | |||
| 92 | $ ./setup.py --help | ||
| 93 | |||
| 94 | Installing | ||
| 95 | ---------- | 66 | ---------- |
| 96 | 67 | ||
| 97 | To install the Python module: | 68 | The core of aubio is written in C for portability and speed. In addition to |
| 98 | 69 | [NumPy], aubio can be optionally built to use one or more of the following | |
| 99 | $ ./setup.py install | 70 | libraries: |
| 100 | 71 | ||
| 101 | Alternatively, you may want to use the Python module without installing it by | 72 | - media file reading: |
| 102 | setting your PYTHONPATH, for instance as follows: | 73 | |
| 103 | 74 | - [ffmpeg] / [avcodec] to decode and read audio from almost any format, | |
| 104 | $ export PYTHONPATH=$PYTHONPATH:$PWD/`ls -rtd build/lib.* | head -1`:$PWD/tests | 75 | - [libsndfile] to read audio from uncompressed sound files, |
| 105 | 76 | - [libsamplerate] to re-sample audio signals, | |
| 77 | - [CoreAudio] to read all media formats supported by macOS, iOS, and tvOS. | ||
| 78 | |||
| 79 | - hardware acceleration: | ||
| 80 | |||
| 81 | - [Atlas] and [Blas], for accelerated vector and matrix computations, | ||
| 82 | - [fftw3], to compute fast Fourier Transforms of any size, | ||
| 83 | - [Accelerate] for accelerated FFT and matrix computations (macOS/iOS), | ||
| 84 | - [Intel IPP], accelerated vector computation and FFT implementation. | ||
| 85 | |||
| 86 | [ffmpeg]: https://ffmpeg.org | ||
| 87 | [avcodec]: https://libav.org | ||
| 88 | [libsndfile]: http://www.mega-nerd.com/libsndfile/ | ||
| 89 | [libsamplerate]: http://www.mega-nerd.com/SRC/ | ||
| 90 | [CoreAudio]: https://developer.apple.com/reference/coreaudio | ||
| 91 | [Atlas]: http://math-atlas.sourceforge.net/ | ||
| 92 | [Blas]: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms | ||
| 93 | [fftw3]: http://fftw.org | ||
| 94 | [Accelerate]: https://developer.apple.com/reference/accelerate | ||
| 95 | [Intel IPP]: https://software.intel.com/en-us/intel-ipp | ||
| 96 | |||
| 97 | [demos_dir]:https://github.com/aubio/aubio/tree/master/python/demos | ||
| 98 | [pyaudio]:https://people.csail.mit.edu/hubert/pyaudio/ | ||
| 99 | [PySoundCard]:https://github.com/bastibe/PySoundCard | ||
| 100 | [pyalsaaudio]:https://larsimmisch.github.io/pyalsaaudio/ | ||
| 101 | [mido]:https://mido.readthedocs.io | ||
| 102 | |||
| 103 | [manual]: https://aubio.org/manual/latest/ | ||
| 104 | [doc_python]: https://aubio.org/manual/latest/python.html | ||
| 105 | [doc_python_install]: https://aubio.org/manual/latest/python_module.html | ||
| 106 | [homepage]: https://aubio.org | ||
| 107 | [NumPy]: https://www.numpy.org | ||
| 108 | [bugtracker]: https://github.com/aubio/aubio/issues | ||
| 109 | [matplotlib]:https://matplotlib.org/ | ||
| @@ -8,7 +8,7 @@ import unittest · 7 unmodified lines | |||
| 8 | import aubio | 8 | import aubio |
| 9 | import numpy as np | 9 | import numpy as np |
| 10 | from numpy.testing import assert_equal | 10 | from numpy.testing import assert_equal |
| 11 | from utils import get_tmp_sink_path | 11 | from .utils import get_tmp_sink_path |
| 12 | 12 | ||
| 13 | class aubio_source_test_case(unittest.TestCase): | 13 | class aubio_source_test_case(unittest.TestCase): |
| 14 | 14 | ||
| @@ -62,13 +62,19 @@ classifiers = [ · 61 unmodified lines | |||
| 62 | 'GNU General Public License v3 or later (GPLv3+)', | 62 | 'GNU General Public License v3 or later (GPLv3+)', |
| 63 | ] | 63 | ] |
| 64 | 64 | ||
| 65 | thisdir = os.path.abspath(os.path.dirname(__file__)) | ||
| 66 | py_readme_file = os.path.join(thisdir, 'python', 'README.md') | ||
| 67 | with open(py_readme_file, 'r') as fp: | ||
| 68 | long_description = ''.join(fp.readlines()[3:]) | ||
| 69 | |||
| 65 | distrib = setup(name='aubio', | 70 | distrib = setup(name='aubio', |
| 66 | version = __version__, | 71 | version = __version__, |
| 67 | packages = ['aubio'], | 72 | packages = ['aubio'], |
| 68 | package_dir = {'aubio': 'python/lib/aubio'}, | 73 | package_dir = {'aubio': 'python/lib/aubio'}, |
| 69 | ext_modules = [aubio_extension], | 74 | ext_modules = [aubio_extension], |
| 70 | description = 'a collection of tools for music analysis', | 75 | description = 'a collection of tools for music analysis', |
| 71 | long_description = 'a collection of tools for music analysis', | 76 | long_description = long_description, |
| 77 | long_description_content_type = 'text/markdown', | ||
| 72 | license = 'GNU/GPL version 3', | 78 | license = 'GNU/GPL version 3', |
| 73 | author = 'Paul Brossier', | 79 | author = 'Paul Brossier', |
| 74 | author_email = 'piem@aubio.org', | 80 | author_email = 'piem@aubio.org', |
| @@ -152,7 +152,6 @@ uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf, · 151 unmodified lines | |||
| 152 | /** Mel filterbank initialization (Auditory Toolbox's parameters) | 152 | /** Mel filterbank initialization (Auditory Toolbox's parameters) |
| 153 | 153 | ||
| 154 | \param mf mfcc object | 154 | \param mf mfcc object |
| 155 | \param samplerate audio sampling rate, in Hz | ||
| 156 | 155 | ||
| 157 | The filter coefficients are built to match exactly Malcolm Slaney's Auditory | 156 | The filter coefficients are built to match exactly Malcolm Slaney's Auditory |
| 158 | Toolbox implementation. The number of filters should be 40. | 157 | Toolbox implementation. The number of filters should be 40. |
| @@ -167,6 +167,13 @@ uint_t aubio_wavetable_stop ( aubio_wavetable_t * s ) · 166 unmodified lines | |||
| 167 | return aubio_wavetable_set_playing (s, 0); | 167 | return aubio_wavetable_set_playing (s, 0); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | uint_t | ||
| 171 | aubio_wavetable_load ( aubio_wavetable_t *s UNUSED, const char_t *uri UNUSED) | ||
| 172 | { | ||
| 173 | AUBIO_ERR("wavetable: load method not implemented yet, see sampler\n"); | ||
| 174 | return AUBIO_FAIL; | ||
| 175 | } | ||
| 176 | |||
| 170 | uint_t aubio_wavetable_set_freq ( aubio_wavetable_t * s, smpl_t freq ) | 177 | uint_t aubio_wavetable_set_freq ( aubio_wavetable_t * s, smpl_t freq ) |
| 171 | { | 178 | { |
| 172 | return aubio_parameter_set_target_value ( s->freq, freq ); | 179 | return aubio_parameter_set_target_value ( s->freq, freq ); |
| @@ -51,6 +51,18 @@ typedef struct _aubio_wavetable_t aubio_wavetable_t; · 50 unmodified lines | |||
| 51 | */ | 51 | */ |
| 52 | aubio_wavetable_t * new_aubio_wavetable(uint_t samplerate, uint_t hop_size); | 52 | aubio_wavetable_t * new_aubio_wavetable(uint_t samplerate, uint_t hop_size); |
| 53 | 53 | ||
| 54 | /** load source in wavetable | ||
| 55 | |||
| 56 | TODO: This function is not implemented yet. See new_aubio_sampler() instead. | ||
| 57 | |||
| 58 | \param o wavetable, created by new_aubio_wavetable() | ||
| 59 | \param uri the uri of the source to load | ||
| 60 | |||
| 61 | \return 0 if successful, non-zero otherwise | ||
| 62 | |||
| 63 | */ | ||
| 64 | uint_t aubio_wavetable_load( aubio_wavetable_t * o, const char_t * uri ); | ||
| 65 | |||
| 54 | /** process wavetable function | 66 | /** process wavetable function |
| 55 | 67 | ||
| 56 | \param o wavetable, created by new_aubio_wavetable() | 68 | \param o wavetable, created by new_aubio_wavetable() |
| @@ -618,6 +618,7 @@ def dist(ctx): · 617 unmodified lines | |||
| 618 | ctx.excl += ' **/python/*.db' | 618 | ctx.excl += ' **/python/*.db' |
| 619 | ctx.excl += ' **/python.old/*' | 619 | ctx.excl += ' **/python.old/*' |
| 620 | ctx.excl += ' **/python/*/*.old' | 620 | ctx.excl += ' **/python/*/*.old' |
| 621 | ctx.excl += ' **/python/lib/aubio/*.so' | ||
| 621 | ctx.excl += ' **/python/tests/sounds' | 622 | ctx.excl += ' **/python/tests/sounds' |
| 622 | ctx.excl += ' **/**.asc' | 623 | ctx.excl += ' **/**.asc' |
| 623 | ctx.excl += ' **/dist*' | 624 | ctx.excl += ' **/dist*' |
| @@ -627,4 +628,4 @@ def dist(ctx): · 3 unmodified lines | |||
| 627 | ctx.excl += ' **/.appveyor.yml' | 628 | ctx.excl += ' **/.appveyor.yml' |
| 628 | ctx.excl += ' **/.circleci/*' | 629 | ctx.excl += ' **/.circleci/*' |
| 629 | ctx.excl += ' **/azure-pipelines.yml' | 630 | ctx.excl += ' **/azure-pipelines.yml' |
| 630 | ctx.excl += ' **/.coveragerc' | 631 | ctx.excl += ' **/.coverage*' |