Changes in / [bf3f09b:e893e6fe]


Ignore:
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • .travis.yml

    rbf3f09b re893e6fe  
    6363    - sox
    6464    - lcov
     65  homebrew:
     66    packages:
     67    - sox
     68    - ffmpeg
     69    - libsndfile
     70    - lcov
     71    #update: true
    6572
    6673before_install:
    6774   - |
    6875     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
    7476       export PATH="$HOME/Library/Python/2.7/bin/:$PATH"
    7577     fi;
     
    8486  - which pip
    8587  - pip --version
    86   - pip install python-coveralls
    87   - gem install coveralls-lcov
    8888
    8989script:
     
    100100  - |
    101101    if [[ -z "$AUBIO_NOTESTS" ]]; then
    102       # upload lcov coverage to coveralls.io
    103       coveralls-lcov build/coverage.info
    104       # upload python coverage
    105       #coveralls
    106102      # upload to codecov
    107103      bash <(curl -s https://codecov.io/bash)
  • ChangeLog

    rbf3f09b re893e6fe  
     12018-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
    1772018-09-22 Paul Brossier <piem@aubio.org>
    278
  • MANIFEST.in

    rbf3f09b re893e6fe  
    22include python/README.md
    33include this_version.py
     4include waf_gensyms.py
    45include waf
    56recursive-include waflib *.py
  • Makefile

    rbf3f09b re893e6fe  
    4343TESTSOUNDS := python/tests/sounds
    4444
     45LCOVOPTS += --rc lcov_branch_coverage=1
     46
    4547all: build
    4648
     
    244246coverage: force_uninstall_python deps_python \
    245247        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
    247252        pip install -v -e .
     253        # run tests, with python coverage
    248254        coverage run `which pytest`
    249         lcov --capture --no-external --directory . --output-file build/coverage_python.info
    250         lcov -a build/coverage_python.info -a build/coverage_lib.info -o build/coverage.info
     255        # capture coverage again
     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
    251264
    252265# make sure we don't build the doc, which builds a temporary python module
    253266coverage_report: export WAFOPTS += --disable-docs
    254267coverage_report: coverage
    255         genhtml build/coverage.info --output-directory lcov_html
    256         mkdir -p gcovr_html/
    257         gcovr -r . --html --html-details \
    258                 --output gcovr_html/index.html \
    259                 --exclude ".*tests/.*" --exclude ".*examples/.*"
     268        # create coverage report dir
     269        mkdir -p build/coverage/
     270        # generate report with lcov's genhtml
     271        genhtml build/coverage_lib.info --output-directory build/coverage/lcov \
     272                --branch-coverage --highlight --legend
     273        # generate python report with coverage python package
    260274        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
    262278
    263279sphinx: configure
  • VERSION

    rbf3f09b re893e6fe  
    22AUBIO_MINOR_VERSION=4
    33AUBIO_PATCH_VERSION=8
    4 AUBIO_VERSION_STATUS='~alpha'
     4AUBIO_VERSION_STATUS=''
    55LIBAUBIO_LT_CUR=5
    6 LIBAUBIO_LT_REV=3
    7 LIBAUBIO_LT_AGE=7
     6LIBAUBIO_LT_REV=4
     7LIBAUBIO_LT_AGE=8
  • doc/aubiocut.txt

    rbf3f09b re893e6fe  
    5151  each slice (default 0).
    5252
     53  --create-first  Alway create first slice.
     54
    5355  -h, --help  Print a short help message and exit.
    5456
  • doc/python_module.rst

    rbf3f09b re893e6fe  
    44===========================
    55
    6 The aubio extension for Python is available for Python 2.7 and Python 3.
     6aubio is available as a package for Python 2.7 and Python 3. The aubio
     7extension 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
     12For general documentation on how to install Python packages, see `Installing
     13Packages`_.
    714
    815Installing aubio with pip
    916-------------------------
    1017
    11 aubio can now be installed using ``pip``:
     18aubio can be installed from `PyPI`_ using ``pip``:
    1219
    1320.. code-block:: console
     
    1522    $ pip install aubio
    1623
    17 Building the module
    18 -------------------
     24See also `Installing from PyPI`_ for general documentation.
    1925
    20 From ``aubio`` source directory, run the following:
     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
     37Installing aubio with conda
     38---------------------------
     39
     40`Conda packages`_ are available through the `conda-forge`_ channel for Linux,
     41macOS, and Windows:
    2142
    2243.. code-block:: console
    2344
    24     $ ./setup.py clean
    25     $ ./setup.py build
    26     $ sudo ./setup.py install
     45    $ conda config --add channels conda-forge
     46    $ conda install -c conda-forge aubio
    2747
     48.. _Conda packages: https://anaconda.org/conda-forge/aubio
     49.. _conda-forge: https://conda-forge.org/
    2850
    2951.. _py-doubleprecision:
     
    6890------------
    6991
    70 A number of python tests are provided. To run them, use [pytest] from the
    71 aubio source tree:
     92A number of Python tests are provided in the `python/tests`_ folder. To run
     93them, install `pytest`_ and run it from the aubio source directory:
    7294
     95.. code-block:: console
     96
     97    $ pip install pytest
     98    $ git clone https://git.aubio.org/aubio/aubio
    7399    $ cd aubio
    74100    $ pytest
    75101
    76 Each test script can also be called individually. For instance:
    77 
    78     $ ./python/tests/test_note2midi.py -v
    79 
    80 [pytest]: https://pytest.org
     102.. _python/tests: https://github.com/aubio/aubio/blob/master/python/tests
     103.. _pytest: https://pytest.org
  • doc/requirements.rst

    rbf3f09b re893e6fe  
    303303................
    304304
     305The 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
     309higher precision, for instance to prevent arithmetic underflow in recursive
     310filters.  In aubio, these special samples are named `lsmp_t` and defined as
     311`double` by default (64-bit).
     312
     313Sometimes it may be useful to compile aubio in `double-precision`, for instance
     314to reproduce numerical results obtained with 64-bit routines. In this case,
     315`smpl_t` will be defined as `double`.
     316
     317The following table shows how `smpl_t` and `lsmp_t` are defined in single- and
     318double-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
    305333To compile aubio in double precision mode, configure with ``--enable-double``.
    306334
    307 To compile aubio in single precision mode, use ``--disable-double`` (default,
    308 recommended).
     335To compile in single-precision mode (default), use ``--disable-double`` (or
     336simply none of these two options).
    309337
    310338Disabling the tests
  • python/README.md

    rbf3f09b re893e6fe  
    1 Python aubio module
    2 ===================
     1aubio
     2=====
    33
    4 This module wraps the aubio library for Python using the numpy module.
     4aubio is a collection of tools for music and audio analysis.
    55
    6 Using the Python aubio module
    7 -----------------------------
     6This package integrates the aubio library with [NumPy] to provide a set of
     7efficient tools to process and analyse audio signals, including:
    88
    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
    1015
    11     $ python
    12     [...]
    13     >>> import aubio
    14     >>> help(aubio.miditofreq)
     16aubio works with both Python 2 and Python 3.
    1517
    16 Finding some inspiration
    17 ------------------------
     18Links
     19-----
    1820
    19 Some examples are available in the `python/demos` directory. These scripts are
    20 small programs written in python and using python-aubio.
     21- [module documentation][doc_python]
     22- [installation instructions][doc_python_install]
     23- [aubio manual][manual]
     24- [aubio homepage][homepage]
     25- [issue tracker][bugtracker]
    2126
    22 For instance, `demo_source.py` reads a media file.
     27Demos
     28-----
    2329
    24     $ ./python/demos/demo_source.py /path/to/sound/sample.wav
     30Some examples are available in the [`python/demos`][demos_dir] folder. Each
     31script is a command line program which accepts one ore more argument.
    2532
    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.
    2734
    28     $ ./python/demo/demo_timestretch_online.py loop.wav stretched_loop.wav 0.92`
     35### Analysis
    2936
    30 Note: you might need to install additional modules to run some of the demos.
    31 Some demos use [matplotlib](http://matplotlib.org/) to draw plots, others use
    32 [PySoundCard](https://github.com/bastibe/PySoundCard) to play and record
    33 sounds.
     37- `demo_source.py` uses aubio to read audio samples from media files
     38- `demo_onset_plot.py` detects attacks in a sound file and plots the results
     39  using [matplotlib]
     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.
    3444
    35 Testing the Python module
    36 -------------------------
     45### Real-time
    3746
    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]
    3950
    40 To run the all the python tests:
     51### Others
    4152
    42     $ cd aubio
    43     $ pytest
     53- `demo_timestretch.py` can change the duration of an input file and write the
     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
    4457
    45 Each test script can also be called one at a time. For instance:
     58### Example
    4659
    47     $ pytest -v python/tests/test_note2midi.py
     60Use `demo_timestretch_online.py` to slow down `loop.wav`, write the results in
     61`stretched_loop.wav`:
    4862
    49 [pytest]: https://pytest.org
     63    $ python demo_timestretch_online.py loop.wav stretched_loop.wav 0.92
    5064
    51 Install in a virtualenv
    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
     65Built with
    9566----------
    9667
    97 To install the Python module:
     68The core of aubio is written in C for portability and speed. In addition to
     69[NumPy], aubio can be optionally built to use one or more of the following
     70libraries:
    9871
    99     $ ./setup.py install
     72- media file reading:
    10073
    101 Alternatively, you may want to use the Python module without installing it by
    102 setting your PYTHONPATH, for instance as follows:
     74    - [ffmpeg] / [avcodec] to decode and read audio from almost any format,
     75    - [libsndfile] to read audio from uncompressed sound files,
     76    - [libsamplerate] to re-sample audio signals,
     77    - [CoreAudio] to read all media formats supported by macOS, iOS, and tvOS.
    10378
    104     $ export PYTHONPATH=$PYTHONPATH:$PWD/`ls -rtd build/lib.* | head -1`:$PWD/tests
     79- hardware acceleration:
    10580
     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/
  • python/tests/test_source_channels.py

    rbf3f09b re893e6fe  
    99import numpy as np
    1010from numpy.testing import assert_equal
    11 from utils import get_tmp_sink_path
     11from .utils import get_tmp_sink_path
    1212
    1313class aubio_source_test_case(unittest.TestCase):
  • setup.py

    rbf3f09b re893e6fe  
    6363    ]
    6464
     65thisdir = os.path.abspath(os.path.dirname(__file__))
     66py_readme_file = os.path.join(thisdir, 'python', 'README.md')
     67with open(py_readme_file, 'r') as fp:
     68    long_description = ''.join(fp.readlines()[3:])
     69
    6570distrib = setup(name='aubio',
    6671    version = __version__,
     
    6974    ext_modules = [aubio_extension],
    7075    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',
    7278    license = 'GNU/GPL version 3',
    7379    author = 'Paul Brossier',
  • src/spectral/mfcc.h

    rbf3f09b re893e6fe  
    153153
    154154  \param mf mfcc object
    155   \param samplerate audio sampling rate, in Hz
    156155
    157156  The filter coefficients are built to match exactly Malcolm Slaney's Auditory
  • src/synth/wavetable.c

    rbf3f09b re893e6fe  
    168168}
    169169
     170uint_t
     171aubio_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
    170177uint_t aubio_wavetable_set_freq ( aubio_wavetable_t * s, smpl_t freq )
    171178{
  • src/synth/wavetable.h

    rbf3f09b re893e6fe  
    5151*/
    5252aubio_wavetable_t * new_aubio_wavetable(uint_t samplerate, uint_t hop_size);
     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*/
     64uint_t aubio_wavetable_load( aubio_wavetable_t * o, const char_t * uri );
    5365
    5466/** process wavetable function
  • wscript

    rbf3f09b re893e6fe  
    619619    ctx.excl += ' **/python.old/*'
    620620    ctx.excl += ' **/python/*/*.old'
     621    ctx.excl += ' **/python/lib/aubio/*.so'
    621622    ctx.excl += ' **/python/tests/sounds'
    622623    ctx.excl += ' **/**.asc'
     
    628629    ctx.excl += ' **/.circleci/*'
    629630    ctx.excl += ' **/azure-pipelines.yml'
    630     ctx.excl += ' **/.coveragerc'
     631    ctx.excl += ' **/.coverage*'
Note: See TracChangeset for help on using the changeset viewer.