Merge branch 'master' into dct
authorPaul Brossier <piem@piem.org>
Tue, 7 Aug 2018 12:05:49 +0000 (14:05 +0200)
committerPaul Brossier <piem@piem.org>
Tue, 7 Aug 2018 12:05:49 +0000 (14:05 +0200)
12 files changed:
.appveyor.yml
.travis.yml
README.md
doc/develop.rst
doc/statuslinks.rst
examples/parse_args.h
python/demos/demo_pitch_sinusoid.py
src/io/source_avcodec.c
src/io/source_wavread.c
src/notes/notes.c
src/onset/onset.c
src/pitch/pitchyinfft.c

index a39cd42..383b1cd 100644 (file)
@@ -42,22 +42,22 @@ install:
   - "%PYTHONDIR%\\python.exe --version"
   - "%PYTHONDIR%\\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\""
 
+  - "%PYTHONDIR%\\python.exe -m pip install --disable-pip-version-check --user --upgrade pip"
+  - "%PYTHONDIR%\\python.exe -m pip install --upgrade setuptools"
+
   # We need wheel installed to build wheels
   - "%PYTHONDIR%\\python.exe -m pip install wheel"
 
   - "SET PATH=%PATH_EXTRAS%;%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%"
 
-  - "pip install --disable-pip-version-check --user --upgrade pip"
-  - "pip install --upgrade setuptools"
-
 before_build:
   - "bash scripts/get_waf.sh"
 
 build_script:
   # build python module without using libaubio
-  - "pip install -r requirements.txt"
+  - "%PYTHONDIR%\\python.exe -m pip install -r requirements.txt"
   - "python setup.py build"
-  - "pip install ."
+  - "%PYTHONDIR%\\python.exe -m pip install ."
   - "python python\\demos\\demo_create_test_sounds.py"
   - "nose2 --verbose"
   # clean up
index c1fb2c4..788885a 100644 (file)
@@ -11,10 +11,6 @@ matrix:
     - python: 2.7
       os: linux
       compiler: gcc
-    - language: C
-      os: osx
-      osx_image: xcode8
-      compiler: clang
     - python: 3.5
       os: linux
       compiler: gcc
@@ -29,37 +25,21 @@ matrix:
       env: CFLAGS="`dpkg-buildflags --get CFLAGS`" LDFLAGS="`dpkg-buildflags --get LDFLAGS`"
     - language: C
       os: osx
-      osx_image: xcode8
-      compiler: clang
-      env: CFLAGS="-Os" HAVE_AUBIO_DOUBLE=1 WAFOPTS="--disable-accelerate"
-    - language: C
-      os: osx
-      osx_image: xcode8
-      compiler: clang
-      env: WAFOPTS="--enable-fat --disable-avcodec --disable-sndfile"
-    - language: C
-      os: osx
-      osx_image: xcode8
       compiler: clang
-      env: WAFOPTS="--with-target-platform=ios --disable-avcodec --disable-sndfile" AUBIO_NOTESTS=1
     - language: C
       os: osx
-      osx_image: xcode8
       compiler: clang
-      env: WAFOPTS="--with-target-platform=iosimulator --disable-avcodec --disable-sndfile" AUBIO_NOTESTS=1
+      env: CFLAGS="-Os" HAVE_AUBIO_DOUBLE=1 WAFOPTS="--disable-accelerate"
     - language: C
       os: osx
-      osx_image: xcode8.2
       compiler: clang
       env: WAFOPTS="--enable-fat --disable-avcodec --disable-sndfile"
     - language: C
       os: osx
-      osx_image: xcode8.2
       compiler: clang
       env: WAFOPTS="--with-target-platform=ios --disable-avcodec --disable-sndfile" AUBIO_NOTESTS=1
     - language: C
       os: osx
-      osx_image: xcode8.2
       compiler: clang
       env: WAFOPTS="--with-target-platform=iosimulator --disable-avcodec --disable-sndfile" AUBIO_NOTESTS=1
 
@@ -95,6 +75,10 @@ before_install:
      fi;
 
 install:
+  - |
+    if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+      alias pip=pip2
+    fi;
   - travis_retry pip install --upgrade pip
   - travis_retry make getwaf expandwaf deps_python
   - which pip
index b3ca16f..5f6cfbd 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ aubio
 [![Travis build status](https://travis-ci.org/aubio/aubio.svg?branch=master)](https://travis-ci.org/aubio/aubio "Travis build status")
 [![Appveyor build status](https://img.shields.io/appveyor/ci/piem/aubio/master.svg)](https://ci.appveyor.com/project/piem/aubio "Appveyor build status")
 [![Landscape code health](https://landscape.io/github/aubio/aubio/master/landscape.svg?style=flat)](https://landscape.io/github/aubio/aubio/master "Landscape code health")
-[![Commits since last release](https://img.shields.io/github/commits-since/aubio/aubio/0.4.6.svg)](https://github.com/aubio/aubio "Commits since last release")
+[![Commits since last release](https://img.shields.io/github/commits-since/aubio/aubio/latest.svg)](https://github.com/aubio/aubio "Commits since last release")
 
 [![Documentation](https://readthedocs.org/projects/aubio/badge/?version=latest)](http://aubio.readthedocs.io/en/latest/?badge=latest "Latest documentation")
 [![DOI](https://zenodo.org/badge/396389.svg)](https://zenodo.org/badge/latestdoi/396389)
index f127ca9..fa27db0 100644 (file)
@@ -1,7 +1,7 @@
 .. _develop:
 
-Developping with aubio
-======================
+Developing with aubio
+=====================
 
 Here is a brief overview of the C library.
 
index 4bb540e..5be7ffb 100644 (file)
@@ -17,7 +17,7 @@ Current status
    :target: https://aubio.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation status
 
-.. image:: https://img.shields.io/github/commits-since/aubio/aubio/0.4.6.svg?maxAge=2592000
+.. image:: https://img.shields.io/github/commits-since/aubio/aubio/latest.svg
    :target: https://github.com/aubio/aubio
    :alt: Commits since last release
 
index f46629f..788ada8 100644 (file)
@@ -115,13 +115,13 @@ void usage (FILE * stream, int exit_code)
       "       -f      --force-overwrite  overwrite output file if needed\n"
       "                 do not fail if output file already exists\n"
 #endif /* PROG_HAS_OUTPUT */
-#ifdef PROG_HAS_JACK
+#if defined(PROG_HAS_JACK) && defined(HAVE_JACK)
       "       -j      --jack             use Jack\n"
 #if defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH)
       "       -N      --miditap-note     MIDI note; default=69.\n"
       "       -V      --miditap-velo     MIDI velocity; default=65.\n"
 #endif /* defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) */
-#endif /* PROG_HAS_JACK */
+#endif /* defined(PROG_HAS_JACK) && defined(HAVE_JACK) */
       "       -v      --verbose          be verbose\n"
       "       -h      --help             display this message\n"
       );
@@ -313,7 +313,8 @@ parse_args (int argc, char **argv)
     usejack = 1;
 #else
     errmsg("Error: no arguments given (and no available audio input)\n");
-    usage ( stderr, 1 );
+    errmsg("       consider recompiling with jack support (--enable-jack)\n");
+    exit ( 1 );
 #endif /* HAVE_JACK */
 #else
     errmsg("Error: no arguments given\n");
index 629f327..b7ef7b4 100755 (executable)
@@ -37,7 +37,7 @@ freqs[ pointer : pointer + partition ] = 1480
 
 pointer += partition
 pointer += partition
-freqs[ pointer : pointer + partition ] = 400 + 5 * np.random.random(sin_length/8)
+freqs[ pointer : pointer + partition ] = 400 + 5 * np.random.random(sin_length//8)
 
 a = build_sinusoid(sin_length, freqs, samplerate)
 
index ccdce80..2186858 100644 (file)
 #include "fmat.h"
 #include "source_avcodec.h"
 
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56, 56, 0)
 #define AUBIO_AVCODEC_MAX_BUFFER_SIZE FF_MIN_BUFFER_SIZE
+#else
+#define AUBIO_AVCODEC_MAX_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE
+#endif
 
 struct _aubio_source_avcodec_t {
   uint_t hop_size;
@@ -271,6 +275,8 @@ aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path, uint_t sa
   // default to mono output
   aubio_source_avcodec_reset_resampler(s, 0);
 
+  if (s->avr == NULL) goto beach;
+
   s->eof = 0;
   s->multi = 0;
 
@@ -419,6 +425,15 @@ void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s, uint_t * read_sam
     goto beach;
   }
 
+#if LIBAVUTIL_VERSION_MAJOR > 52
+  if (avFrame->channels != (sint_t)s->input_channels) {
+    AUBIO_WRN ("source_avcodec: trying to read from %d channel(s),"
+        "but configured for %d; is '%s' corrupt?\n", avFrame->channels,
+        s->input_channels, s->path);
+    goto beach;
+  }
+#endif
+
 #ifdef HAVE_AVRESAMPLE
   in_linesize = 0;
   av_samples_get_buffer_size(&in_linesize, avCodecCtx->channels,
index 640201b..90638af 100644 (file)
@@ -189,6 +189,26 @@ aubio_source_wavread_t * new_aubio_source_wavread(const char_t * path, uint_t sa
   // BitsPerSample
   bytes_read += fread(buf, 1, 2, s->fid);
   bitspersample = read_little_endian(buf, 2);
+
+  if ( channels == 0 ) {
+    AUBIO_ERR("source_wavread: Failed opening %s (number of channels can not be 0)\n", s->path);
+    goto beach;
+  }
+
+  if ( (sint_t)sr <= 0 ) {
+    AUBIO_ERR("source_wavread: Failed opening %s (samplerate can not be <= 0)\n", s->path);
+    goto beach;
+  }
+
+  if ( byterate == 0 ) {
+    AUBIO_ERR("source_wavread: Failed opening %s (byterate can not be 0)\n", s->path);
+    goto beach;
+  }
+
+  if ( bitspersample == 0 ) {
+    AUBIO_ERR("source_wavread: Failed opening %s (bitspersample can not be 0)\n", s->path);
+    goto beach;
+  }
 #if 0
   if ( bitspersample != 16 ) {
     AUBIO_ERR("source_wavread: can not process %dbit file %s\n",
index f6b7d56..343e5a0 100644 (file)
@@ -83,6 +83,7 @@ aubio_notes_t * new_aubio_notes (const char_t * method,
   o->onset_output = new_fvec (1);
 
   o->pitch = new_aubio_pitch (pitch_method, o->pitch_buf_size, o->hop_size, o->samplerate);
+  if (o->pitch == NULL) goto fail;
   if (o->pitch_tolerance != 0.) aubio_pitch_set_tolerance (o->pitch, o->pitch_tolerance);
   aubio_pitch_set_unit (o->pitch, "midi");
   o->pitch_output = new_fvec (1);
index 0c7ebba..4e0141a 100644 (file)
@@ -307,6 +307,8 @@ uint_t aubio_onset_set_default_parameters (aubio_onset_t * o, const char_t * ons
   } else if (strcmp (onset_mode, "phase") == 0) {
     o->apply_compression = 0;
     aubio_onset_set_awhitening (o, 0);
+  } else if (strcmp (onset_mode, "wphase") == 0) {
+    // use defaults for now
   } else if (strcmp (onset_mode, "mkl") == 0) {
     aubio_onset_set_threshold (o, 0.05);
     aubio_onset_set_awhitening(o, 1);
index f213ef2..b613f60 100644 (file)
@@ -44,7 +44,7 @@ static const smpl_t freqs[] = {
      0.,    20.,    25.,   31.5,    40.,    50.,    63.,    80.,   100.,   125.,
    160.,   200.,   250.,   315.,   400.,   500.,   630.,   800.,  1000.,  1250.,
   1600.,  2000.,  2500.,  3150.,  4000.,  5000.,  6300.,  8000.,  9000., 10000.,
- 12500., 15000., 20000., 25100
+ 12500., 15000., 20000., 25100., -1.
 };
 
 static const smpl_t weight[] = {
@@ -72,7 +72,10 @@ new_aubio_pitchyinfft (uint_t samplerate, uint_t bufsize)
   p->weight = new_fvec (bufsize / 2 + 1);
   for (i = 0; i < p->weight->length; i++) {
     freq = (smpl_t) i / (smpl_t) bufsize *(smpl_t) samplerate;
-    while (freq > freqs[j]) {
+    while (freq > freqs[j] && freqs[j] > 0) {
+      //AUBIO_DBG("freq %3.5f > %3.5f \tsamplerate %d (Hz) \t"
+      //    "(weight length %d, bufsize %d) %d %d\n", freq, freqs[j],
+      //    samplerate, p->weight->length, bufsize, i, j);
       j += 1;
     }
     a0 = weight[j - 1];