shithub: aubio

Download patch

ref: fc9c60e88820570a0317023180752a1d10653f50
parent: 1ec59e4cfdfcbe36295620926a7095e71b7d8066
parent: 9c730b54548644bfaa9c7b780311baebc1d5940e
author: Paul Brossier <piem@piem.org>
date: Thu Jul 2 11:34:26 EDT 2020

Merge branch 'master' into feature/autosink

--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -15,14 +15,6 @@
       PYTHON_VERSION: 2.7.x
       PYTHON_ARCH: 64
 
-    - PYTHONDIR: C:\Python35
-      PYTHON_VERSION: 3.5.x
-      PYTHON_ARCH: 32
-
-    - PYTHONDIR: C:\Python35-x64
-      PYTHON_VERSION: 3.5.x
-      PYTHON_ARCH: 64
-
     - PYTHONDIR: C:\Python36
       PYTHON_VERSION: 3.6.x
       PYTHON_ARCH: 32
@@ -37,6 +29,14 @@
 
     - PYTHONDIR: C:\Python37-x64
       PYTHON_VERSION: 3.7.x
+      PYTHON_ARCH: 64
+
+    - PYTHONDIR: C:\Python38
+      PYTHON_VERSION: 3.8.x
+      PYTHON_ARCH: 32
+
+    - PYTHONDIR: C:\Python38-x64
+      PYTHON_VERSION: 3.8.x
       PYTHON_ARCH: 64
 
 install:
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -66,9 +66,9 @@
       - store_artifacts:
           path: dist/
 
-  build-37:
+  build-latest:
     docker:
-      - image: circleci/python:3.7
+      - image: circleci/python:latest
     steps:
       - checkout
       - run: *apt-install
@@ -80,9 +80,9 @@
       - store_artifacts:
           path: dist/
 
-  build-37-nodeps:
+  build-latest-nodeps:
     docker:
-      - image: circleci/python:3.7
+      - image: circleci/python:latest
     steps:
       - checkout
       - run: *pip-install
@@ -100,5 +100,5 @@
     jobs:
       - build-27
       - build-36
-      - build-37
-      - build-37-nodeps
+      - build-latest
+      - build-latest-nodeps
--- a/.gitignore
+++ b/.gitignore
@@ -12,8 +12,8 @@
 RE:examples/[a-z]*
 
 # ignore compiled test programs
-RE:tests/src/test-[a-z-_]*$
-RE:tests/cpp/test-[a-z-_]*$
+RE:tests/src/test-[a-z_-]*$
+RE:tests/cpp/test-[a-z_-]*$
 
 # only sgml manpages count
 doc/*.1
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,55 +2,63 @@
 
 matrix:
   include:
-    - python: 3.6
+    - name: "Linux (Python 3.8)"
+      python: 3.8
       os: linux
-      compiler: gcc
-    - python: 3.5
+      distro: bionic
+    - name: "Linux (Python 3.6)"
+      python: 3.6
       os: linux
-      compiler: gcc
       env: WAFOPTS="--build-type=debug"
-    - python: 2.7
+    - name: "Linux (Python 2.7, nodeps)"
+      python: 2.7
       os: linux
-      compiler: gcc
-    - python: "pypy3.5"
+      distro: trusty
+      env: WAFOPTS="--nodeps"
+    - name: "Linux (Python pypy3.5)"
+      language: python
+      python: "pypy3.5"
       os: linux
-      compiler: gcc
-      env: CFLAGS="-Os" WAFOPTS="--disable-avcodec"
-    - python: 3.6
+    - name: "Linux (double, fftw3)"
+      python: 3.8
       os: linux
-      compiler: gcc
-      env: CFLAGS="-Os" WAFOPTS="--disable-samplerate"
-    - python: 3.5
-      os: linux
-      compiler: gcc
       env: HAVE_AUBIO_DOUBLE=1 CFLAGS="-O3" WAFOPTS="--enable-fftw3"
-    - python: 2.7
+    - name: "Linux (default, dpkg-buildflags)"
       os: linux
-      compiler: gcc
       env: CFLAGS="`dpkg-buildflags --get CFLAGS`" LDFLAGS="`dpkg-buildflags --get LDFLAGS`"
-    - language: C
+
+    - name: "macOS (xcode11)"
+      language: shell
       os: osx
-      compiler: clang
-    - language: C
+      osx_image: xcode11
+    - name: "macOS (xcode12, lib only)"
+      language: shell
       os: osx
-      compiler: clang
-      env: CFLAGS="-Os" HAVE_AUBIO_DOUBLE=1 WAFOPTS="--disable-accelerate"
-    - language: C
+      osx_image: xcode12
+      script:
+        - make test_lib_only_clean
+    - name: "macOS (xcode10, noopt, nodeps)"
+      language: shell
       os: osx
-      compiler: clang
-      env: WAFOPTS="--enable-fat --disable-avcodec --disable-sndfile --disable-samplerate --disable-vorbis --disable-flac"
-    - language: C
+      osx_image: xcode10
+      env: CFLAGS="-Os" HAVE_AUBIO_DOUBLE=1 WAFOPTS="--disable-accelerate --nodeps"
+    - name: "iOS"
+      language: shell
       os: osx
-      compiler: clang
-      env: WAFOPTS="--with-target-platform=ios --disable-avcodec --disable-sndfile --disable-samplerate --disable-vorbis --disable-flac" AUBIO_NOTESTS=1
-    - language: C
+      env: WAFOPTS="--with-target-platform=ios --nodeps" AUBIO_NOTESTS=1
+    - name: "iOSSimulator"
+      language: shell
       os: osx
-      compiler: clang
-      env: WAFOPTS="--with-target-platform=iosimulator --disable-avcodec --disable-sndfile --disable-samplerate --disable-vorbis --disable-flac" AUBIO_NOTESTS=1
+      env: WAFOPTS="--with-target-platform=iosimulator --nodeps" AUBIO_NOTESTS=1
 
-# use trusty
-dist: trusty
-sudo: required
+#    - name: "Windows (Python 3.8.0, lib only)"
+#      language: shell
+#      os: windows
+#      before_install:
+#        - choco install python --version 3.8.0
+#        - choco install make
+#        - python -m pip install --upgrade pip
+#      env: PATH=/c/Python38:/c/Python38/Scripts:$PATH AUBIO_NOTESTS=1
 
 addons:
   apt:
@@ -79,19 +87,8 @@
     - lcov
     update: true
 
-before_install:
-   - |
-     if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
-       export PATH="$HOME/Library/Python/2.7/bin/:$PATH"
-     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
+  - make getwaf deps_python
   - which pip
   - pip --version
   - pip install coverage
--- a/Makefile
+++ b/Makefile
@@ -183,7 +183,7 @@
 	-$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav"   synth 5    brownnoise      vol 0.9
 	-$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav"    synth 127s sine 440        vol 0.9
 	-$(SOX) -r  8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav"      trim 0 30
-	-$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav"       synth 60   sine 100-20000  vol 0.9
+	-$(SOX) -r 48000 -b 16 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav"       synth 60   sine 100-20000  vol 0.9
 	-$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav"  synth 44100s   sine 441 	vol 0.9
 	-$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav"    synth 100s sine 441 	vol 0.9
 
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -3,14 +3,27 @@
 
 - job: linux
   pool:
-    vmImage: 'ubuntu-16.04'
+    vmImage: 'ubuntu-latest'
   steps:
   - script: |
+      sudo apt install libavformat-dev
+    displayName: 'deps'
+  - script: |
       make
     displayName: 'make'
     env:
       CFLAGS: -Werror
 
+- job: linux_nodeps
+  pool:
+    vmImage: 'ubuntu-latest'
+  steps:
+  - script: |
+      make
+    displayName: 'make'
+    env:
+      CFLAGS: -Werror
+
 - job: windows
   pool:
     vmImage: 'vs2017-win2016'
@@ -24,7 +37,7 @@
 
 - job: macos
   pool:
-    vmImage: 'macos-10.13'
+    vmImage: 'macos-latest'
   steps:
   - script: |
       brew update
--- a/doc/develop.rst
+++ b/doc/develop.rst
@@ -92,7 +92,7 @@
 
 .. literalinclude:: ../tests/src/io/test-source.c
    :language: C
-   :lines: 22-24, 30-32, 34
+   :lines: 24-26, 30, 32-34
 
 .. note::
    With ``samplerate = 0``, ``aubio_source`` will be created with the file's
@@ -102,13 +102,13 @@
 
 .. literalinclude:: ../tests/src/io/test-source.c
    :language: C
-   :lines: 40-44
+   :lines: 41-45
 
 At the end of the processing loop, memory is deallocated:
 
 .. literalinclude:: ../tests/src/io/test-source.c
    :language: C
-   :lines: 55-56
+   :lines: 55-58
 
 See the complete example: :download:`test-source.c
 <../tests/src/io/test-source.c>`.
@@ -126,13 +126,13 @@
 
 .. literalinclude:: ../tests/src/spectral/test-phasevoc.c
    :language: C
-   :lines: 20-37
+   :lines: 27-44
 
 Time to clean up the previously allocated memory:
 
 .. literalinclude:: ../tests/src/spectral/test-phasevoc.c
    :language: C
-   :lines: 39-44
+   :lines: 47-50
 
 See the complete example: :download:`test-phasevoc.c
 <../tests/src/spectral/test-phasevoc.c>`.
--- a/doc/requirements.rst
+++ b/doc/requirements.rst
@@ -31,6 +31,8 @@
     If ``pkg-config`` is not found in ``PATH``, the configure step will
     succeed, but none of the external libraries will be used.
 
+To build aubio with no external libraries, use the ``--nodeps`` build option.
+
 Media libraries
 ---------------
 
--- a/examples/parse_args.h
+++ b/examples/parse_args.h
@@ -25,6 +25,7 @@
 #endif
 
 extern int verbose;
+extern int quiet;
 // input / output
 extern int usejack;
 extern char_t *source_uri;
@@ -127,6 +128,7 @@
       "       -V      --miditap-velo     MIDI velocity; default=65.\n"
 #endif /* defined(PROG_HAS_ONSET) && !defined(PROG_HAS_PITCH) */
 #endif /* defined(PROG_HAS_JACK) && defined(HAVE_JACK) */
+      "       -q      --quiet            be quiet\n"
       "       -v      --verbose          be verbose\n"
       "       -h      --help             display this message\n"
       );
@@ -141,7 +143,7 @@
 parse_args (int argc, char **argv)
 {
 #ifdef HAVE_GETOPT_H
-  const char *options = "hv"
+  const char *options = "hvq"
     "i:r:B:H:"
 #ifdef PROG_HAS_JACK
     "j"
@@ -173,6 +175,7 @@
   struct option long_options[] = {
     {"help",                  0, NULL, 'h'},
     {"verbose",               0, NULL, 'v'},
+    {"quiet",                 0, NULL, 'q'},
     {"input",                 1, NULL, 'i'},
     {"samplerate",            1, NULL, 'r'},
     {"bufsize",               1, NULL, 'B'},
@@ -225,6 +228,9 @@
         return -1;
       case 'v':                /* verbose */
         verbose = 1;
+        break;
+      case 'q':                /* quiet */
+        quiet = 1;
         break;
       case 'j':
         usejack = 1;
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -32,6 +32,7 @@
 #endif /* HAVE_JACK */
 
 int verbose = 0;
+int quiet = 0;
 int usejack = 0;
 // input / output
 char_t *sink_uri = NULL;
@@ -169,7 +170,7 @@
       aubio_source_do (this_source, input_buffer, &read);
       process_func (input_buffer, output_buffer);
       // print to console if verbose or no output given
-      if (verbose || sink_uri == NULL) {
+      if ((verbose || sink_uri == NULL) && !quiet) {
         print();
       }
       if (this_sink) {
--- a/python/demos/demo_pitch.py
+++ b/python/demos/demo_pitch.py
@@ -97,7 +97,7 @@
 # draw a line at tolerance
 ax3.plot(times, [tolerance]*len(confidences))
 ax3.axis( xmin = times[0], xmax = times[-1])
-ax3.set_ylabel('condidence')
+ax3.set_ylabel('confidence')
 set_xlabels_sample2time(ax3, times[-1], samplerate)
 plt.show()
 #plt.savefig(os.path.basename(filename) + '.svg')
--- a/python/ext/ufuncs.c
+++ b/python/ext/ufuncs.c
@@ -3,8 +3,8 @@
 
 typedef smpl_t (*aubio_unary_func_t)(smpl_t input);
 
-static void aubio_PyUFunc_d_d(char **args, npy_intp *dimensions,
-                            npy_intp* steps, void* data)
+static void aubio_PyUFunc_d_d(char **args, const npy_intp *dimensions,
+                            const npy_intp* steps, void* data)
 {
     npy_intp i;
     npy_intp n = dimensions[0];
@@ -22,8 +22,8 @@
     }
 }
 
-static void aubio_PyUFunc_f_f_As_d_d(char **args, npy_intp *dimensions,
-                            npy_intp* steps, void* data)
+static void aubio_PyUFunc_f_f_As_d_d(char **args, const npy_intp *dimensions,
+                            const npy_intp* steps, void* data)
 {
     npy_intp i;
     npy_intp n = dimensions[0];
--- a/scripts/get_waf.sh
+++ b/scripts/get_waf.sh
@@ -3,7 +3,7 @@
 set -e
 #set -x
 
-WAFVERSION=2.0.17
+WAFVERSION=2.0.20
 WAFTARBALL=waf-$WAFVERSION.tar.bz2
 WAFURL=https://waf.io/$WAFTARBALL
 WAFUPSTREAMKEY=https://gitlab.com/ita1024/waf/raw/master/utils/pubkey.asc
@@ -48,7 +48,7 @@
 buildwaf
 popd
 
-cp -prv $WAFBUILDDIR/waf-$WAFVERSION/waf $PWD
+cp -prv $WAFBUILDDIR/waf-$WAFVERSION/waf "$PWD"
 chmod +x waf
 
 cleanup
--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -236,14 +236,25 @@
 #define AUBIO_ERR(...)               aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " __VA_ARGS__)
 #define AUBIO_INF(...)               aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " __VA_ARGS__)
 #define AUBIO_MSG(...)               aubio_log(AUBIO_LOG_MSG, __VA_ARGS__)
-#define AUBIO_DBG(...)               aubio_log(AUBIO_LOG_DBG, __VA_ARGS__)
+#define _AUBIO_DBG(...)              aubio_log(AUBIO_LOG_DBG, __VA_ARGS__)
 #define AUBIO_WRN(...)               aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " __VA_ARGS__)
 #else
 #define AUBIO_ERR(format, args...)   aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " format , ##args)
 #define AUBIO_INF(format, args...)   aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " format , ##args)
 #define AUBIO_MSG(format, args...)   aubio_log(AUBIO_LOG_MSG, format , ##args)
-#define AUBIO_DBG(format, args...)   aubio_log(AUBIO_LOG_DBG, format , ##args)
+#define _AUBIO_DBG(format, args...)  aubio_log(AUBIO_LOG_DBG, format , ##args)
 #define AUBIO_WRN(format, args...)   aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " format, ##args)
+#endif
+
+#ifdef DEBUG
+#define AUBIO_DBG _AUBIO_DBG
+#else
+// disable debug output
+#ifdef HAVE_C99_VARARGS_MACROS
+#define AUBIO_DBG(...)               {}
+#else
+#define AUBIO_DBG(format, args...)   {}
+#endif
 #endif
 
 #define AUBIO_ERROR   AUBIO_ERR
--- a/src/musicutils.h
+++ b/src/musicutils.h
@@ -240,7 +240,7 @@
   \param v vector to get level from
   \param threshold threshold in dB SPL
 
-  \return 0 if level is under the given threshold, 1 otherwise
+  \return 1 if level is under the given threshold, 0 otherwise
 
 */
 uint_t aubio_silence_detection (const fvec_t * v, smpl_t threshold);
--- a/wscript
+++ b/wscript
@@ -45,6 +45,12 @@
             help = 'whether to compile with (--build-type=release)' \
                     ' or without (--build-type=debug)' \
                     ' compiler opimizations [default: release]')
+    ctx.add_option('--debug', action = 'store_const',
+            dest = 'build_type', const = 'debug',
+            help = 'build in debug mode (see --build-type)')
+    ctx.add_option('--nodeps', action = 'store_const',
+            dest = 'nodeps', const = 'debug',
+            help = 'build with no external dependencies')
     add_option_enable_disable(ctx, 'fftw3f', default = False,
             help_str = 'compile with fftw3f instead of ooura (recommended)',
             help_disable_str = 'do not compile with fftw3f')
@@ -128,6 +134,27 @@
     target_platform = sys.platform
     if ctx.options.target_platform:
         target_platform = ctx.options.target_platform
+
+    if ctx.options.nodeps:
+        external_deps = [
+                'sndfile',
+                'samplerate',
+                'jack',
+                'avcodec',
+                'blas',
+                'fftw3',
+                'fftw3f',
+        ]
+        for d in external_deps:
+            if not hasattr(ctx.options, 'enable_' + d):
+                raise ctx.errors.ConfigurationError ('--enable-%s missing from options' % d)
+            if getattr(ctx.options, 'enable_' + d) == True:
+                msg = 'Option --nodeps can not be used along with --enable-%s' % d
+                raise ctx.errors.ConfigurationError (msg)
+            elif getattr(ctx.options, 'enable_' + d) is None:
+                msg = 'Option --nodeps used but automatic detection with --enable-%s' % d
+                ctx.msg('Warning', msg)
+            setattr(ctx.options, 'enable_' + d, False)
 
     from waflib import Options