Changeset f87e191


Ignore:
Timestamp:
Nov 26, 2018, 10:33:30 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/constantq
Children:
868c6b8
Parents:
d1d4ad4 (diff), db3eb5c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/constantq

Files:
1 added
33 edited

Legend:

Unmodified
Added
Removed
  • .travis.yml

    rd1d4ad4 rf87e191  
    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

    rd1d4ad4 rf87e191  
     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

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

    rd1d4ad4 rf87e191  
    4343TESTSOUNDS := python/tests/sounds
    4444
     45LCOVOPTS += --rc lcov_branch_coverage=1
     46
    4547all: build
    4648
     
    246248coverage: force_uninstall_python deps_python \
    247249        clean_python clean distclean build local_dylib
    248         lcov --capture --no-external --directory . --output-file build/coverage_lib.info
     250        # capture coverage after running c tests
     251        lcov $(LCOVOPTS) --capture --no-external --directory . \
     252                --output-file build/coverage_lib.info
     253        # build and test python
    249254        pip install -v -e .
     255        # run tests, with python coverage
    250256        coverage run `which nose2`
    251         lcov --capture --no-external --directory . --output-file build/coverage_python.info
    252         lcov -a build/coverage_python.info -a build/coverage_lib.info -o build/coverage.info
     257        # capture coverage again
     258        lcov $(LCOVOPTS) --capture --no-external --directory . \
     259                --output-file build/coverage_python.info
     260        # merge both coverage info files
     261        lcov $(LCOVOPTS) -a build/coverage_python.info -a build/coverage_lib.info \
     262                --output-file build/coverage.info
     263        # remove tests
     264        lcov $(LCOVOPTS) --remove build/coverage.info '*/tests/*' '*/ooura_fft8g*' \
     265                --output-file build/coverage_lib.info
    253266
    254267# make sure we don't build the doc, which builds a temporary python module
    255268coverage_report: export WAFOPTS += --disable-docs
    256269coverage_report: coverage
    257         genhtml build/coverage.info --output-directory lcov_html
    258         mkdir -p gcovr_html/
    259         gcovr -r . --html --html-details \
    260                 --output gcovr_html/index.html \
    261                 --exclude ".*tests/.*" --exclude ".*examples/.*"
     270        # create coverage report dir
     271        mkdir -p build/coverage/
     272        # generate report with lcov's genhtml
     273        genhtml build/coverage_lib.info --output-directory build/coverage/lcov \
     274                --branch-coverage --highlight --legend
     275        # generate python report with coverage python package
    262276        coverage report
    263         coverage html
     277        coverage html -d build/coverage/coverage
     278        # show links to generated reports
     279        for i in $$(ls build/coverage/*/index.html); do echo file://$(PWD)/$$i; done
    264280
    265281sphinx: configure
  • VERSION

    rd1d4ad4 rf87e191  
    11AUBIO_MAJOR_VERSION=0
    22AUBIO_MINOR_VERSION=4
    3 AUBIO_PATCH_VERSION=8
     3AUBIO_PATCH_VERSION=9
    44AUBIO_VERSION_STATUS='~alpha'
    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

    rd1d4ad4 rf87e191  
    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

    rd1d4ad4 rf87e191  
    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
    71 ``python/tests/run_all_tests``.
     92A number of Python tests are provided in the `python tests`_. To run them,
     93install `nose2`_ and run the script ``python/tests/run_all_tests``:
     94
     95.. code-block:: console
     96
     97    $ pip install nose2
     98    $ ./python/tests/run_all_tests
    7299
    73100.. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py
    74101.. _python tests: https://github.com/aubio/aubio/blob/master/python/tests
     102.. _nose2: https://github.com/nose-devs/nose2
  • doc/requirements.rst

    rd1d4ad4 rf87e191  
    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

    rd1d4ad4 rf87e191  
    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 the [nose2 python package][nose2].
     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, use the script:
     51### Others
    4152
    42     $ ./python/tests/run_all_tests
     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
    4357
    44 Each test script can also be called one at a time. For instance:
     58### Example
    4559
    46     $ ./python/tests/test_note2midi.py -v
     60Use `demo_timestretch_online.py` to slow down `loop.wav`, write the results in
     61`stretched_loop.wav`:
    4762
    48 [nose2]: https://github.com/nose-devs/nose2
     63    $ python demo_timestretch_online.py loop.wav stretched_loop.wav 0.92
    4964
    50 Install in a virtualenv
    51 -----------------------
    52 
    53 You should be able to install python-aubio directly from the top source
    54 directory of aubio.
    55 
    56 First, create a virtualenv to hold the required python module:
    57 
    58     $ virtualenv pyaubio
    59     $ source pyaubio/bin/activate
    60 
    61 Now install and build the python extension using:
    62 
    63     $ pip install .
    64 
    65 Install requirements
    66 --------------------
    67 
    68 Before compiling this module, you must have compiled libaubio.
    69 
    70 A simple way to do this is with pip:
    71 
    72     $ pip install -r requirements.txt
    73 
    74 For more information about how this module works, please refer to the [Python/C
    75 API Reference Manual] (http://docs.python.org/c-api/index.html) and the
    76 [Numpy/C API Reference](http://docs.scipy.org/doc/numpy/reference/c-api.html).
    77 
    78 Compiling python aubio
    79 ----------------------
    80 
    81 To build the aubio Python module, run the following command from the top source
    82 directory of aubio:
    83 
    84     $ ./setup.py build
    85 
    86 Note: if libaubio was previously built using waf, the script will use it.
    87 Otherwise, the entire library will be built inside the python extension.
    88 
    89 To find out more about `setup.py` options:
    90 
    91     $ ./setup.py --help
    92 
    93 Installing
     65Built with
    9466----------
    9567
    96 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:
    9771
    98     $ ./setup.py install
     72- media file reading:
    9973
    100 Alternatively, you may want to use the Python module without installing it by
    101 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.
    10278
    103     $ export PYTHONPATH=$PYTHONPATH:$PWD/`ls -rtd build/lib.* | head -1`:$PWD/tests
     79- hardware acceleration:
    10480
     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_phasevoc.py

    rd1d4ad4 rf87e191  
    5656                        + 'This is expected when using fftw3 on powerpc.')
    5757            assert_equal ( r, 0.)
     58
     59    def test_no_overlap(self):
     60        win_s, hop_s = 1024, 1024
     61        f = pvoc (win_s, hop_s)
     62        t = fvec (hop_s)
     63        for _ in range(4):
     64            s = f(t)
     65            r = f.rdo(s)
     66            assert_equal ( t, 0.)
    5867
    5968    @params(
  • python/tests/test_source_channels.py

    rd1d4ad4 rf87e191  
    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

    rd1d4ad4 rf87e191  
    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/onset/onset.c

    rd1d4ad4 rf87e191  
    257257  o->pp = new_aubio_peakpicker();
    258258  o->od = new_aubio_specdesc(onset_mode,buf_size);
    259   if (o->od == NULL) goto beach_specdesc;
    260259  o->fftgrain = new_cvec(buf_size);
    261260  o->desc = new_fvec(1);
    262261  o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate);
    263262
     263  if (!o->pv || !o->pp || !o->od || !o->fftgrain
     264      || !o->desc || !o->spectral_whitening)
     265    goto beach;
     266
    264267  /* initialize internal variables */
    265268  aubio_onset_set_default_parameters (o, onset_mode);
     
    268271  return o;
    269272
    270 beach_specdesc:
    271   del_aubio_peakpicker(o->pp);
    272   del_aubio_pvoc(o->pv);
    273273beach:
    274   AUBIO_FREE(o);
     274  del_aubio_onset(o);
    275275  return NULL;
    276276}
     
    340340void del_aubio_onset (aubio_onset_t *o)
    341341{
    342   del_aubio_spectral_whitening(o->spectral_whitening);
    343   del_aubio_specdesc(o->od);
    344   del_aubio_peakpicker(o->pp);
    345   del_aubio_pvoc(o->pv);
    346   del_fvec(o->desc);
    347   del_cvec(o->fftgrain);
     342  if (o->spectral_whitening)
     343    del_aubio_spectral_whitening(o->spectral_whitening);
     344  if (o->od)
     345    del_aubio_specdesc(o->od);
     346  if (o->pp)
     347    del_aubio_peakpicker(o->pp);
     348  if (o->pv)
     349    del_aubio_pvoc(o->pv);
     350  if (o->desc)
     351    del_fvec(o->desc);
     352  if (o->fftgrain)
     353    del_cvec(o->fftgrain);
    348354  AUBIO_FREE(o);
    349355}
  • src/spectral/dct.c

    rd1d4ad4 rf87e191  
    8282aubio_dct_t* new_aubio_dct (uint_t size) {
    8383  aubio_dct_t * s = AUBIO_NEW(aubio_dct_t);
    84   if ((sint_t)size <= 0) goto beach;
    8584#if defined(HAVE_ACCELERATE)
    8685  // vDSP supports sizes = f * 2 ** n, where n >= 4 and f in [1, 3, 5, 15]
     
    8988    uint_t radix = size;
    9089    uint_t order = 0;
    91     while ((radix / 2) * 2 == radix) {
     90    while ((radix >= 1) && ((radix / 2) * 2 == radix)) {
    9291      radix /= 2;
    9392      order++;
     
    113112    return s;
    114113  } else {
    115     AUBIO_WRN("dct: unexcepected error while creating dct_fftw with size %d",
     114    AUBIO_WRN("dct: unexpected error while creating dct_fftw with size %d\n",
    116115        size);
    117116    goto plain;
     
    126125    return s;
    127126  } else {
    128     AUBIO_WRN("dct: unexcepected error while creating dct_ipp with size %d",
     127    AUBIO_WRN("dct: unexpected error while creating dct_ipp with size %d\n",
    129128        size);
    130129    goto plain;
     
    144143#endif
    145144  // falling back to plain mode
    146   AUBIO_WRN("dct: d no optimised implementation could be created for size %d",
     145  AUBIO_WRN("dct: no optimised implementation could be created for size %d\n",
    147146      size);
    148147plain:
     
    157156  }
    158157beach:
    159   AUBIO_ERROR("dct: failed creating with size %d, should be > 0", size);
    160   AUBIO_FREE (s);
     158  AUBIO_ERROR("dct: failed creating with size %d, should be > 0\n", size);
     159  del_aubio_dct(s);
    161160  return NULL;
    162161}
  • src/spectral/dct_fftw.c

    rd1d4ad4 rf87e191  
    6464aubio_dct_fftw_t * new_aubio_dct_fftw (uint_t size) {
    6565  aubio_dct_fftw_t * s = AUBIO_NEW(aubio_dct_fftw_t);
    66   if (!s) {
     66  if ((sint_t)size <= 0) {
     67    AUBIO_ERR("dct_fftw: can only create with size > 0, requested %d\n",
     68        size);
    6769    goto beach;
    6870  }
  • src/spectral/dct_ooura.c

    rd1d4ad4 rf87e191  
    3939aubio_dct_ooura_t * new_aubio_dct_ooura (uint_t size) {
    4040  aubio_dct_ooura_t * s = AUBIO_NEW(aubio_dct_ooura_t);
    41   if (aubio_is_power_of_two(size) != 1) {
    42     AUBIO_ERR("dct: can only create with sizes power of two, requested %d\n",
     41  if (aubio_is_power_of_two(size) != 1 || (sint_t)size <= 0) {
     42    AUBIO_ERR("dct_ooura: can only create with sizes power of two, requested %d\n",
    4343        size);
    4444    goto beach;
  • src/spectral/dct_plain.c

    rd1d4ad4 rf87e191  
    3232};
    3333
     34void del_aubio_dct_plain (aubio_dct_plain_t *s);
     35
    3436aubio_dct_plain_t * new_aubio_dct_plain (uint_t size) {
    3537  aubio_dct_plain_t * s = AUBIO_NEW(aubio_dct_plain_t);
     
    3840  if (aubio_is_power_of_two (size) == 1 && size > 16) {
    3941    AUBIO_WRN("dct_plain: using plain dct but size %d is a power of two\n", size);
     42  }
     43  if ((sint_t)size <= 0) {
     44    AUBIO_ERR("dct_plain: can only create with size > 0, requested %d\n",
     45        size);
     46    goto failure;
    4047  }
    4148
     
    6976  }
    7077  return s;
     78failure:
     79  del_aubio_dct_plain(s);
     80  return NULL;
    7181}
    7282
    7383void del_aubio_dct_plain (aubio_dct_plain_t *s) {
    74   del_fmat(s->dct_coeffs);
    75   del_fmat(s->idct_coeffs);
     84  if (s->dct_coeffs)
     85    del_fmat(s->dct_coeffs);
     86  if (s->idct_coeffs)
     87    del_fmat(s->idct_coeffs);
    7688  AUBIO_FREE(s);
    7789}
     
    7991void aubio_dct_plain_do(aubio_dct_plain_t *s, const fvec_t *input, fvec_t *output) {
    8092  if (input->length != output->length || input->length != s->size) {
    81     AUBIO_WRN("dct_plain: using input length %d, but output length = %d and size = %d",
     93    AUBIO_WRN("dct_plain: using input length %d, but output length = %d and size = %d\n",
    8294        input->length, output->length, s->size);
    8395  }
     
    8799void aubio_dct_plain_rdo(aubio_dct_plain_t *s, const fvec_t *input, fvec_t *output) {
    88100  if (input->length != output->length || input->length != s->size) {
    89     AUBIO_WRN("dct_plain: using input length %d, but output length = %d and size = %d",
     101    AUBIO_WRN("dct_plain: using input length %d, but output length = %d and size = %d\n",
    90102        input->length, output->length, s->size);
    91103  }
  • src/spectral/filterbank.c

    rd1d4ad4 rf87e191  
    4343  /* allocate space for filterbank object */
    4444  aubio_filterbank_t *fb = AUBIO_NEW (aubio_filterbank_t);
     45
     46  if ((sint_t)n_filters <= 0) {
     47    AUBIO_ERR("filterbank: n_filters should be > 0, got %d\n", n_filters);
     48    goto fail;
     49  }
     50  if ((sint_t)win_s <= 0) {
     51    AUBIO_ERR("filterbank: win_s should be > 0, got %d\n", win_s);
     52    goto fail;
     53  }
    4554  fb->win_s = win_s;
    4655  fb->n_filters = n_filters;
     
    5463
    5564  return fb;
     65fail:
     66  AUBIO_FREE (fb);
     67  return NULL;
    5668}
    5769
  • src/spectral/mfcc.c

    rd1d4ad4 rf87e191  
    3232#include "spectral/mfcc.h"
    3333
    34 #ifdef HAVE_NOOPT
    35 #define HAVE_SLOW_DCT 1
    36 #endif
    37 
    3834/** Internal structure for mfcc object */
    3935
     
    4642  aubio_filterbank_t *fb;   /** filter bank */
    4743  fvec_t *in_dct;           /** input buffer for dct * [fb->n_filters] */
    48 #if defined(HAVE_SLOW_DCT)
    49   fmat_t *dct_coeffs;       /** DCT transform n_filters * n_coeffs */
    50 #else
    51   aubio_dct_t *dct;
    52   fvec_t *output;
    53 #endif
     44  aubio_dct_t *dct;         /** dct object */
     45  fvec_t *output;           /** dct output */
    5446  smpl_t scale;
    5547};
     
    6355  /* allocate space for mfcc object */
    6456  aubio_mfcc_t *mfcc = AUBIO_NEW (aubio_mfcc_t);
    65 #if defined(HAVE_SLOW_DCT)
    66   smpl_t scaling;
    6757
    68   uint_t i, j;
    69 #endif
     58  if ((sint_t)n_coefs <= 0) {
     59    AUBIO_ERR("mfcc: n_coefs should be > 0, got %d\n", n_coefs);
     60    goto failure;
     61  }
     62  if ((sint_t)samplerate <= 0) {
     63    AUBIO_ERR("mfcc: samplerate should be > 0, got %d\n", samplerate);
     64    goto failure;
     65  }
    7066
    7167  mfcc->win_s = win_s;
     
    7672  /* filterbank allocation */
    7773  mfcc->fb = new_aubio_filterbank (n_filters, mfcc->win_s);
     74
     75  if (!mfcc->fb)
     76    goto failure;
     77
    7878  if (n_filters == 40)
    7979    aubio_filterbank_set_mel_coeffs_slaney (mfcc->fb, samplerate);
     
    8585  mfcc->in_dct = new_fvec (n_filters);
    8686
    87 #if defined(HAVE_SLOW_DCT)
    88   mfcc->dct_coeffs = new_fmat (n_coefs, n_filters);
    89 
    90   /* compute DCT transform dct_coeffs[j][i] as
    91      cos ( j * (i+.5) * PI / n_filters ) */
    92   scaling = 1. / SQRT (n_filters / 2.);
    93   for (i = 0; i < n_filters; i++) {
    94     for (j = 0; j < n_coefs; j++) {
    95       mfcc->dct_coeffs->data[j][i] =
    96           scaling * COS (j * (i + 0.5) * PI / n_filters);
    97     }
    98     mfcc->dct_coeffs->data[0][i] *= SQRT (2.) / 2.;
    99   }
    100 #else
    10187  mfcc->dct = new_aubio_dct (n_filters);
    10288  mfcc->output = new_fvec (n_filters);
    103 #endif
     89
     90  if (!mfcc->in_dct || !mfcc->dct || !mfcc->output)
     91    goto failure;
    10492
    10593  mfcc->scale = 1.;
    10694
    10795  return mfcc;
     96
     97failure:
     98  del_aubio_mfcc(mfcc);
     99  return NULL;
    108100}
    109101
     
    111103del_aubio_mfcc (aubio_mfcc_t * mf)
    112104{
    113 
    114   /* delete filterbank */
    115   del_aubio_filterbank (mf->fb);
    116 
    117   /* delete buffers */
    118   del_fvec (mf->in_dct);
    119 #if defined(HAVE_SLOW_DCT)
    120   del_fmat (mf->dct_coeffs);
    121 #else
    122   del_aubio_dct (mf->dct);
    123   del_fvec (mf->output);
    124 #endif
    125 
    126   /* delete mfcc object */
     105  if (mf->fb)
     106    del_aubio_filterbank (mf->fb);
     107  if (mf->in_dct)
     108    del_fvec (mf->in_dct);
     109  if (mf->dct)
     110    del_aubio_dct (mf->dct);
     111  if (mf->output)
     112    del_fvec (mf->output);
    127113  AUBIO_FREE (mf);
    128114}
     
    132118aubio_mfcc_do (aubio_mfcc_t * mf, const cvec_t * in, fvec_t * out)
    133119{
    134 #ifndef HAVE_SLOW_DCT
    135120  fvec_t tmp;
    136 #endif
    137121
    138122  /* compute filterbank */
     
    145129
    146130  /* compute mfccs */
    147 #if defined(HAVE_SLOW_DCT)
    148   fmat_vecmul(mf->dct_coeffs, mf->in_dct, out);
    149 #else
    150131  aubio_dct_do(mf->dct, mf->in_dct, mf->output);
    151132  // copy only first n_coeffs elements
     
    154135  tmp.length = out->length;
    155136  fvec_copy(&tmp, out);
    156 #endif
    157137
    158138  return;
  • src/spectral/mfcc.h

    rd1d4ad4 rf87e191  
    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/spectral/specdesc.c

    rd1d4ad4 rf87e191  
    297297      onset_type = aubio_onset_default;
    298298  else {
    299       AUBIO_ERR("unknown spectral descriptor type %s\n", onset_mode);
     299      AUBIO_ERR("specdesc: unknown spectral descriptor type '%s'\n",
     300          onset_mode);
    300301      AUBIO_FREE(o);
    301302      return NULL;
  • src/synth/wavetable.c

    rd1d4ad4 rf87e191  
    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

    rd1d4ad4 rf87e191  
    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
  • src/tempo/tempo.c

    rd1d4ad4 rf87e191  
    129129
    130130uint_t aubio_tempo_set_delay_ms(aubio_tempo_t * o, smpl_t delay) {
    131   o->delay = 1000. * delay * o->samplerate;
    132   return AUBIO_OK;
     131  return aubio_tempo_set_delay_s(o, delay / 1000.);
    133132}
    134133
     
    142141
    143142smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t * o) {
    144   return o->delay / (smpl_t)(o->samplerate) / 1000.;
     143  return aubio_tempo_get_delay_s(o) * 1000.;
    145144}
    146145
     
    169168{
    170169  aubio_tempo_t * o = AUBIO_NEW(aubio_tempo_t);
    171   char_t specdesc_func[20];
     170  char_t specdesc_func[PATH_MAX];
    172171  o->samplerate = samplerate;
    173172  // check parameters are valid
     
    204203  aubio_peakpicker_set_threshold (o->pp, o->threshold);
    205204  if ( strcmp(tempo_mode, "default") == 0 ) {
    206     strcpy(specdesc_func, "specflux");
     205    strncpy(specdesc_func, "specflux", PATH_MAX - 1);
    207206  } else {
    208     strcpy(specdesc_func, tempo_mode);
     207    strncpy(specdesc_func, tempo_mode, PATH_MAX - 1);
     208    specdesc_func[PATH_MAX - 1] = '\0';
    209209  }
    210210  o->od       = new_aubio_specdesc(specdesc_func,buf_size);
     
    216216    onset2 = new_fvec(1);
    217217  }*/
     218  if (!o->dfframe || !o->fftgrain || !o->out || !o->pv ||
     219      !o->pp || !o->od || !o->of || !o->bt || !o->onset) {
     220    AUBIO_ERR("tempo: failed creating tempo object\n");
     221    goto beach;
     222  }
    218223  o->last_tatum = 0;
    219224  o->tatum_signature = 4;
     
    221226
    222227beach:
    223   AUBIO_FREE(o);
     228  del_aubio_tempo(o);
    224229  return NULL;
    225230}
     
    278283void del_aubio_tempo (aubio_tempo_t *o)
    279284{
    280   del_aubio_specdesc(o->od);
    281   del_aubio_beattracking(o->bt);
    282   del_aubio_peakpicker(o->pp);
    283   del_aubio_pvoc(o->pv);
    284   del_fvec(o->out);
    285   del_fvec(o->of);
    286   del_cvec(o->fftgrain);
    287   del_fvec(o->dfframe);
    288   del_fvec(o->onset);
     285  if (o->od)
     286    del_aubio_specdesc(o->od);
     287  if (o->bt)
     288    del_aubio_beattracking(o->bt);
     289  if (o->pp)
     290    del_aubio_peakpicker(o->pp);
     291  if (o->pv)
     292    del_aubio_pvoc(o->pv);
     293  if (o->out)
     294    del_fvec(o->out);
     295  if (o->of)
     296    del_fvec(o->of);
     297  if (o->fftgrain)
     298    del_cvec(o->fftgrain);
     299  if (o->dfframe)
     300    del_fvec(o->dfframe);
     301  if (o->onset)
     302    del_fvec(o->onset);
    289303  AUBIO_FREE(o);
    290   return;
    291 }
     304}
  • tests/src/onset/test-onset.c

    rd1d4ad4 rf87e191  
    11#include <aubio.h>
    22#include "utils_tests.h"
     3
     4int test_wrong_params(void);
    35
    46int main (int argc, char **argv)
     
    79  if (argc < 2) {
    810    err = 2;
    9     PRINT_ERR("not enough arguments\n");
    10     PRINT_MSG("read a wave file as a mono vector\n");
     11    PRINT_WRN("no arguments, running tests\n");
     12    if (test_wrong_params() != 0) {
     13      PRINT_ERR("tests failed!\n");
     14      err = 1;
     15    } else {
     16      err = 0;
     17    }
    1118    PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
    1219    return err;
     
    6168  return err;
    6269}
     70
     71int test_wrong_params(void)
     72{
     73  uint_t win_size = 1024;
     74  uint_t hop_size = win_size / 2;
     75  uint_t samplerate = 44100;
     76  // hop_size < 1
     77  if (new_aubio_onset("default", 5, 0, samplerate))
     78    return 1;
     79  // buf_size < 2
     80  if (new_aubio_onset("default", 1, 1, samplerate))
     81    return 1;
     82  // buf_size < hop_size
     83  if (new_aubio_onset("default", hop_size, win_size, samplerate))
     84    return 1;
     85  // samplerate < 1
     86  if (new_aubio_onset("default", 1024, 512, 0))
     87    return 1;
     88
     89  // specdesc creation failed
     90  if (new_aubio_onset("abcd", win_size, win_size/2, samplerate))
     91    return 1;
     92  // pv creation failed
     93  if (new_aubio_onset("default", 5, 2, samplerate))
     94    return 1;
     95
     96  aubio_onset_t *o;
     97  o = new_aubio_onset("default", win_size, hop_size, samplerate);
     98  if (!aubio_onset_set_default_parameters(o, "wrong_type"))
     99    return 1;
     100  del_aubio_onset(o);
     101
     102  return 0;
     103}
  • tests/src/spectral/test-awhitening.c

    rd1d4ad4 rf87e191  
    11#include <aubio.h>
    22#include "utils_tests.h"
     3
     4int test_wrong_params(void);
    35
    46int main (int argc, char **argv)
     
    810  if (argc < 3) {
    911    err = 2;
    10     PRINT_ERR("not enough arguments\n");
     12    PRINT_WRN("no arguments, running tests\n");
     13    if (test_wrong_params() != 0) {
     14      PRINT_ERR("tests failed!\n");
     15      err = 1;
     16    } else {
     17      err = 0;
     18    }
    1119    PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]);
    1220    return err;
     
    8391}
    8492
     93int test_wrong_params(void)
     94{
     95  uint_t buf_size = 512;
     96  uint_t hop_size = 256;
     97  uint_t samplerate = 44100;
     98  aubio_spectral_whitening_t *o;
     99
     100  if (new_aubio_spectral_whitening(       0, hop_size, samplerate)) return 1;
     101  if (new_aubio_spectral_whitening(buf_size,        0, samplerate)) return 1;
     102  if (new_aubio_spectral_whitening(buf_size, hop_size,          0)) return 1;
     103
     104  o = new_aubio_spectral_whitening(buf_size, hop_size, samplerate);
     105
     106  aubio_spectral_whitening_get_relax_time(o);
     107  aubio_spectral_whitening_get_floor(o);
     108
     109  del_aubio_spectral_whitening(o);
     110
     111  return 0;
     112}
  • tests/src/spectral/test-dct.c

    rd1d4ad4 rf87e191  
    1010  // create dct object
    1111  aubio_dct_t * dct = new_aubio_dct(win_s);
     12  aubio_dct_t * tmp;
     13
     14  if (new_aubio_dct(0)) return 1;
    1215
    1316  fvec_t * in = new_fvec (win_s); // input buffer
    1417  fvec_t * dctout = new_fvec (win_s); // output buffer
    1518  fvec_t * out = new_fvec (win_s); // input buffer
     19
     20  if ((tmp = new_aubio_dct(1)) == 0) return 1;
     21  //aubio_dct_do(tmp, dctout, out);
     22  //aubio_dct_rdo(tmp, dctout, out);
     23  del_aubio_dct(tmp);
    1624
    1725  if (!dct || !in || !dctout) {
  • tests/src/spectral/test-filterbank.c

    rd1d4ad4 rf87e191  
    88  cvec_t *in_spec = new_cvec (win_s); // input vector of samples
    99  fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
     10
     11  if (new_aubio_filterbank(0, win_s)) return 1;
     12  if (new_aubio_filterbank(n_filters, 0)) return 1;
    1013
    1114  // create filterbank object
  • tests/src/spectral/test-mfcc.c

    rd1d4ad4 rf87e191  
    55  uint_t win_s = 512; // fft size
    66  uint_t n_filters = 40; // number of filters
    7   uint_t n_coefs = 13; // number of coefficients
     7  uint_t n_coeffs = 13; // number of coefficients
    88  smpl_t samplerate = 16000.; // samplerate
    99  cvec_t *in = new_cvec (win_s); // input buffer
    10   fvec_t *out = new_fvec (n_coefs); // output coefficients
     10  fvec_t *out = new_fvec (n_coeffs); // output coefficients
     11
     12  if (new_aubio_mfcc(    0, n_filters, n_coeffs, samplerate)) return 1;
     13  if (new_aubio_mfcc(win_s,         0, n_coeffs, samplerate)) return 1;
     14  if (new_aubio_mfcc(win_s, n_filters,        0, samplerate)) return 1;
     15  if (new_aubio_mfcc(win_s, n_filters, n_coeffs,          0)) return 1;
    1116
    1217  // create mfcc object
    13   aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate);
     18  aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coeffs, samplerate);
    1419
    1520  cvec_norm_set_all (in, 1.);
  • tests/src/spectral/test-phasevoc.c

    rd1d4ad4 rf87e191  
    1313  // allocate fft and other memory space
    1414  aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
     15
     16  if (new_aubio_pvoc(win_s, 0)) return 1;
     17
     18  if (aubio_pvoc_get_win(pv) != win_s) return 1;
     19  if (aubio_pvoc_get_hop(pv) != hop_s) return 1;
     20
     21  if (aubio_pvoc_set_window(pv, "hanningz") != 0) return 1;
    1522
    1623  // fill input with some data
  • tests/src/spectral/test-tss.c

    rd1d4ad4 rf87e191  
    3535  }
    3636
     37  aubio_tss_set_alpha(tss, 4.);
     38  aubio_tss_set_beta(tss, 3.);
     39  aubio_tss_set_threshold(tss, 3.);
     40
    3741  del_aubio_pvoc(pv);
    3842  del_aubio_pvoc(pvt);
  • tests/src/tempo/test-tempo.c

    rd1d4ad4 rf87e191  
    11#include <aubio.h>
    22#include "utils_tests.h"
     3
     4int test_wrong_params(void);
    35
    46int main (int argc, char **argv)
     
    79  if (argc < 2) {
    810    err = 2;
    9     PRINT_ERR("not enough arguments\n");
    10     PRINT_MSG("read a wave file as a mono vector\n");
    11     PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n", argv[0]);
     11    PRINT_WRN("no arguments, running tests\n");
     12    if (test_wrong_params() != 0) {
     13      PRINT_ERR("tests failed!\n");
     14      err = 1;
     15    } else {
     16      err = 0;
     17    }
     18    PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n",
     19        argv[0]);
    1220    return err;
    1321  }
     
    2129
    2230  char_t *source_path = argv[1];
    23   aubio_source_t * source = new_aubio_source(source_path, samplerate, hop_size);
     31  aubio_source_t * source = new_aubio_source(source_path, samplerate,
     32      hop_size);
    2433  if (!source) { err = 1; goto beach; }
    2534
     
    3140
    3241  // create tempo object
    33   aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size, samplerate);
     42  aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size,
     43      samplerate);
     44
     45  if (!o) { err = 1; goto beach_tempo; }
    3446
    3547  do {
     
    4052    // do something with the beats
    4153    if (out->data[0] != 0) {
    42       PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2fbpm with confidence %.2f\n",
     54      PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm "
     55          "with confidence %.2f\n",
    4356          aubio_tempo_get_last_ms(o), aubio_tempo_get_last_s(o),
    44           aubio_tempo_get_last(o), aubio_tempo_get_bpm(o), aubio_tempo_get_confidence(o));
     57          aubio_tempo_get_last(o), aubio_tempo_get_bpm(o),
     58          aubio_tempo_get_confidence(o));
    4559    }
    4660    n_frames += read;
     
    5468  // clean up memory
    5569  del_aubio_tempo(o);
     70beach_tempo:
    5671  del_fvec(in);
    5772  del_fvec(out);
     
    6277  return err;
    6378}
     79
     80int test_wrong_params(void)
     81{
     82  uint_t win_size = 1024;
     83  uint_t hop_size = 256;
     84  uint_t samplerate = 44100;
     85  aubio_tempo_t *t;
     86  fvec_t* in, *out;
     87  uint_t i;
     88
     89  // test wrong method fails
     90  if (new_aubio_tempo("unexisting_method", win_size, hop_size, samplerate))
     91    return 1;
     92
     93  // test hop > win fails
     94  if (new_aubio_tempo("default", hop_size, win_size, samplerate))
     95    return 1;
     96
     97  // test null hop_size fails
     98  if (new_aubio_tempo("default", win_size, 0, samplerate))
     99    return 1;
     100
     101  // test 1 buf_size fails
     102  if (new_aubio_tempo("default", 1, 1, samplerate))
     103    return 1;
     104
     105  // test null samplerate fails
     106  if (new_aubio_tempo("default", win_size, hop_size, 0))
     107    return 1;
     108
     109  // test short sizes workaround
     110  t = new_aubio_tempo("default", 2048, 2048, 500);
     111  if (!t)
     112    return 1;
     113
     114  del_aubio_tempo(t);
     115
     116  t = new_aubio_tempo("default", win_size, hop_size, samplerate);
     117  if (!t)
     118    return 1;
     119
     120  in = new_fvec(hop_size);
     121  out = new_fvec(1);
     122
     123  // up to step = (next_power_of_two(5.8 * samplerate / hop_size ) / 4 )
     124  for (i = 0; i < 256 + 1; i++)
     125  {
     126    aubio_tempo_do(t,in,out);
     127    PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm "
     128        "with confidence %.2f, was tatum %d\n",
     129        aubio_tempo_get_last_ms(t), aubio_tempo_get_last_s(t),
     130        aubio_tempo_get_last(t), aubio_tempo_get_bpm(t),
     131        aubio_tempo_get_confidence(t), aubio_tempo_was_tatum(t));
     132  }
     133
     134  del_aubio_tempo(t);
     135  del_fvec(in);
     136  del_fvec(out);
     137
     138  return 0;
     139}
  • wscript

    rd1d4ad4 rf87e191  
    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.