shithub: aubio

Download patch

ref: 1dfe40925bf16faa125beae73a84e425dec95480
parent: 08246ee55357da38cb8b16822834e5c610814cca
parent: f55630c5e9397c94d3f0e683c6eeb2c89fd6d490
author: Paul Brossier <piem@piem.org>
date: Sun Mar 31 19:12:40 EDT 2019

Merge branch 'master' into feature/autosink

--- a/.landscape.yml
+++ /dev/null
@@ -1,5 +1,0 @@
-strictness: medium
-test-warnings: true
-python-targets:
-  - 2
-  - 3
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@
     - python: 3.5
       os: linux
       compiler: gcc
+      env: WAFOPTS="--build-type=debug"
     - python: 2.7
       os: linux
       compiler: gcc
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,83 @@
+2018-12-19 Paul Brossier <piem@aubio.org>
+
+	[ Overview ]
+
+	* VERSION: bump to 0.4.9
+	* library: improve stability, fixing potential crashes and memory leaks on
+	invalid arguments; improve library messages and reporting of system errors
+	* tests/: major clean-up, check return codes, increase code coverage
+	* python/tests/: switch to pytest (closes gh-163), check emitted warnings
+	* python/: add pages to manual with brief descriptions of classes
+
+	[ Fixes ]
+
+	* security: improve arguments validation in new_aubio_filterbank (prevent
+	possible null-pointer dereference on invalid n_filters, CVE-2018-19801),
+	new_aubio-tempo (prevent possible buffer overflow, CVE-2018-19800), and
+	new_aubio_onset (prevent null-pointer dereference, CVE-2018-19802). Thanks
+	to Guoxiang Niu (@niugx), from the EaglEye Team for reporting these issues.
+	* tempo: fix delay_ms methods
+	* filterbank: fix aubio_filterbank_get_power (thanks to @romanbsd who
+	also noticed this issue)
+	* dct: creation fail on negative sizes or invalid accelerate radix,
+	fix typo in error and warning messages, prevent possible memory leak
+	* pitch: prevent null pointer dereference in yinfast, comment out unused
+	functions in mcomb and yin, prevent possible leak in specacf
+	* mfcc: always use dct module, strengthen input validation, change
+	get_{scale,power} to return smpl_t
+	* specdesc: improve error message
+	* notes: prevent null pointer dereference
+	* hist: add validation for size argument, prevent possible leak
+	* awhitening: use shortest length available (closes gh-216)
+	* io: add macros to display system errors, add helpers to validate input
+	arguments of source and sink methods, always clean-up after failure
+	* source: validate input sizes to prevent invalid reads
+	* apple_audio: use native format conversions in source and sink, prevent
+	possible apple_audio crash on empty string, get_duration returns 0 on failure
+	* ffmpeg/avcodec: prevent deprecation warnings, read after close, and skipped
+	samples warnings, improve warning messages, only show a warning when
+	swr_convert failed, prevent possible memory leak when closing swr context
+	* wavwrite: copy to all channels if needed, check fseek and fwrite return
+	values, call fflush in open to return failure on full disk-system
+	* source_sndfile: fix reading sizes when resampling, set error message when
+	reading after close
+	* aubio_priv.h: include blas first (see gh-225), add STRERROR macros
+
+	[ Python ]
+
+	* documentation: add pages to manual, add minimal docstrings for fft,
+	digital_filter, and generated objects, improve specdesc documentation
+	* filterbank: add get_norm/power documentation
+	* source: take a copy of the last frame before resizing it, raise an
+	exception when read failed, fix compilation warning
+	* fixes: remove unneeded check convert with PyFloat_FromDouble or
+	PyFloat_FromDouble, check if sink, digital_filter, were created before
+	deleting
+
+	[ Tests ]
+
+	* python/tests/: switch to pytest (slightly slower than nose2 but better at
+	capturing warnings and parametrization), improve coding style and coverage.
+	Tests should now be run with `pytest`.
+	* tests/: Each test program in C must now return 0, otherwise the test will
+	fail. Examples have been modified to run themselves on a test audio file,
+	but can still be run with arguments. Tests for `source` and `sink` have been
+	factorised, and some code cleaning. A python script is used to create a
+	test sound file. Tested on linux, macos, and windows, improvements to
+	test-mfcc (closes gh-219).
+
+	[ Build system ]
+
+	* waf: upgrade to 2.0.14, check the return code of each test program,
+	update rules to build manual and api documentation into build/, check
+	for errno.h
+	* osx: use -Os in scripts/build_apple_frameworks
+	* Makefile: improve coverage reports
+	* appveyor, travis, circleci: switch to pytest, set one travis config to use
+	sndfile only
+	* travis: add py3.6, drop py3.4, use py3.5 to test debug mode
+	* azure: add basic configuration
+
 2018-11-21 Paul Brossier <piem@aubio.org>
 
 	[ Overview ]
--- a/README.md
+++ b/README.md
@@ -3,7 +3,6 @@
 
 [![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/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")
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 AUBIO_MAJOR_VERSION=0
-AUBIO_MINOR_VERSION=4
-AUBIO_PATCH_VERSION=9
+AUBIO_MINOR_VERSION=5
+AUBIO_PATCH_VERSION=0
 AUBIO_VERSION_STATUS='~alpha'
 LIBAUBIO_LT_CUR=5
 LIBAUBIO_LT_REV=4
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -3,7 +3,7 @@
 
 - job: linux
   pool:
-    vmImage: 'Ubuntu 16.04'
+    vmImage: 'ubuntu-16.04'
   steps:
   - script: |
       make
@@ -13,7 +13,7 @@
 
 - job: windows
   pool:
-    vmIMage: 'VS2017-Win2016'
+    vmImage: 'vs2017-win2016'
   steps:
   - script: |
       make
@@ -24,7 +24,7 @@
 
 - job: macos
   pool:
-    vmIMage: macOS-10.13
+    vmImage: 'macos-10.13'
   steps:
   - script: |
       brew update
--- a/doc/statuslinks.rst
+++ b/doc/statuslinks.rst
@@ -9,10 +9,6 @@
    :target: https://ci.appveyor.com/project/piem/aubio/
    :alt: Appveyor build status
 
-.. image:: https://landscape.io/github/aubio/aubio/master/landscape.svg?style=flat
-   :target: https://landscape.io/github/aubio/aubio/master
-   :alt: Landscape code health
-
 .. image:: https://readthedocs.org/projects/aubio/badge/?version=latest
    :target: https://aubio.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation status
--- a/python/demos/demo_wav2midi.py
+++ b/python/demos/demo_wav2midi.py
@@ -63,7 +63,7 @@
         delta = frames2tick(total_frames) - last_time
         if new_note[2] > 0:
             track.append(Message('note_off', note=int(new_note[2]),
-                velocity=127, time=0)
+                velocity=127, time=delta)
                 )
         track.append(Message('note_on',
             note=int(new_note[0]),
--- a/python/ext/py-source.c
+++ b/python/ext/py-source.c
@@ -581,7 +581,10 @@
       return vec;
     } else if (PyLong_AsLong(size) > 0) {
       // short read, return a shorter array
-      PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0);
+      PyObject *vec = PyTuple_GetItem(done, 0);
+      // take a copy to prevent resizing internal arrays
+      PyArrayObject *shortread = (PyArrayObject*)PyArray_FROM_OTF(vec,
+          NPY_NOTYPE, NPY_ARRAY_ENSURECOPY);
       PyArray_Dims newdims;
       PyObject *reshaped;
       newdims.len = PyArray_NDIM(shortread);
@@ -594,6 +597,7 @@
       }
       reshaped = PyArray_Newshape(shortread, &newdims, NPY_CORDER);
       Py_DECREF(shortread);
+      Py_DECREF(vec);
       return reshaped;
     } else {
       PyErr_SetNone(PyExc_StopIteration);
--- a/python/lib/moresetuptools.py
+++ b/python/lib/moresetuptools.py
@@ -68,7 +68,7 @@
     # define macros (waf puts them in build/src/config.h)
     for define_macro in ['HAVE_STDLIB_H', 'HAVE_STDIO_H',
                          'HAVE_MATH_H', 'HAVE_STRING_H',
-                         'HAVE_C99_VARARGS_MACROS',
+                         'HAVE_ERRNO_H', 'HAVE_C99_VARARGS_MACROS',
                          'HAVE_LIMITS_H', 'HAVE_STDARG_H',
                          'HAVE_MEMCPY_HACKS']:
         ext.define_macros += [(define_macro, 1)]
--- a/python/tests/test_sink.py
+++ b/python/tests/test_sink.py
@@ -3,7 +3,8 @@
 from numpy.testing import TestCase
 from aubio import fvec, source, sink
 from utils import list_all_sounds, get_tmp_sink_path, del_tmp_sink_path
-from _tools import parametrize, skipTest, assert_raises
+from utils import parse_file_samplerate
+from _tools import parametrize, skipTest, assert_raises, assert_warns
 
 list_of_sounds = list_all_sounds('sounds')
 samplerates = [0, 44100, 8000, 32000]
@@ -60,8 +61,14 @@
 
     @parametrize('hop_size, samplerate, path', all_params)
     def test_read_and_write(self, hop_size, samplerate, path):
+        orig_samplerate = parse_file_samplerate(soundfile)
         try:
-            f = source(path, samplerate, hop_size)
+            if orig_samplerate is not None and orig_samplerate < samplerate:
+                # upsampling should emit a warning
+                with assert_warns(UserWarning):
+                    f = source(soundfile, samplerate, hop_size)
+            else:
+                f = source(soundfile, samplerate, hop_size)
         except RuntimeError as e:
             err_msg = '{:s} (hop_s = {:d}, samplerate = {:d})'
             skipTest(err_msg.format(str(e), hop_size, samplerate))
@@ -78,8 +85,14 @@
 
     @parametrize('hop_size, samplerate, path', all_params)
     def test_read_and_write_multi(self, hop_size, samplerate, path):
+        orig_samplerate = parse_file_samplerate(soundfile)
         try:
-            f = source(path, samplerate, hop_size)
+            if orig_samplerate is not None and orig_samplerate < samplerate:
+                # upsampling should emit a warning
+                with assert_warns(UserWarning):
+                    f = source(soundfile, samplerate, hop_size)
+            else:
+                f = source(soundfile, samplerate, hop_size)
         except RuntimeError as e:
             err_msg = '{:s} (hop_s = {:d}, samplerate = {:d})'
             skipTest(err_msg.format(str(e), hop_size, samplerate))
--- a/python/tests/test_source.py
+++ b/python/tests/test_source.py
@@ -3,9 +3,10 @@
 
 from numpy.testing import TestCase, assert_equal
 from aubio import source
-from utils import list_all_sounds
+from utils import list_all_sounds, parse_file_samplerate
 import unittest
-from _tools import parametrize, assert_raises, assert_equal, skipTest
+from _tools import assert_raises, assert_equal, assert_warns
+from _tools import parametrize, skipTest
 
 list_of_sounds = list_all_sounds('sounds')
 samplerates = [0, 44100, 8000, 32000]
@@ -23,6 +24,7 @@
 
 _debug = False
 
+
 class Test_aubio_source_test_case(TestCase):
 
     def setUp(self):
@@ -74,8 +76,14 @@
 
     @parametrize('hop_size, samplerate, soundfile', all_params)
     def test_samplerate_hopsize(self, hop_size, samplerate, soundfile):
+        orig_samplerate = parse_file_samplerate(soundfile)
         try:
-            f = source(soundfile, samplerate, hop_size)
+            if orig_samplerate is not None and orig_samplerate < samplerate:
+                # upsampling should emit a warning
+                with assert_warns(UserWarning):
+                    f = source(soundfile, samplerate, hop_size)
+            else:
+                f = source(soundfile, samplerate, hop_size)
         except RuntimeError as e:
             err_msg = 'failed opening with hop_s={:d}, samplerate={:d} ({:s})'
             skipTest(err_msg.format(hop_size, samplerate, str(e)))
--- a/python/tests/utils.py
+++ b/python/tests/utils.py
@@ -1,6 +1,7 @@
 #! /usr/bin/env python
 
 import os
+import re
 import glob
 import numpy as np
 from tempfile import mkstemp
@@ -77,3 +78,16 @@
                 if file_path:
                     total_files += 1
     return total_files
+
+def parse_file_samplerate(soundfile):
+    samplerate = None
+    # parse samplerate
+    re_sr = re.compile(r'/([0-9]{4,})Hz_.*')
+    match_samplerate = re_sr.findall(soundfile)
+    if match_samplerate:
+        samplerate = int(match_samplerate[0])
+    else:
+        import warnings
+        warnings.warn(UserWarning("could not parse samplerate for {:s}"
+            .format(soundfile)))
+    return samplerate
--- a/scripts/get_waf.sh
+++ b/scripts/get_waf.sh
@@ -3,7 +3,7 @@
 set -e
 #set -x
 
-WAFVERSION=2.0.13
+WAFVERSION=2.0.14
 WAFTARBALL=waf-$WAFVERSION.tar.bz2
 WAFURL=https://waf.io/$WAFTARBALL
 WAFUPSTREAMKEY=https://gitlab.com/ita1024/waf/raw/master/utils/pubkey.asc
--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -62,6 +62,10 @@
 #include <string.h>
 #endif
 
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
 #ifdef HAVE_LIMITS_H
 #include <limits.h> // for CHAR_BIT, in C99 standard
 #endif
@@ -70,12 +74,8 @@
 #include <stdarg.h>
 #endif
 
-#if defined(HAVE_ACCELERATE)
-#define HAVE_ATLAS 1
-#define HAVE_BLAS 1
-#include <Accelerate/Accelerate.h>
-#elif defined(HAVE_ATLAS_CBLAS_H)
-#elif defined(HAVE_BLAS)
+#if defined(HAVE_BLAS) // --enable-blas=true
+// check which cblas header we found
 #if defined(HAVE_ATLAS_CBLAS_H)
 #define HAVE_ATLAS 1
 #include <atlas/cblas.h>
@@ -83,11 +83,17 @@
 #include <openblas/cblas.h>
 #elif defined(HAVE_CBLAS_H)
 #include <cblas.h>
+#elif !defined(HAVE_ACCELERATE)
+#error "HAVE_BLAS was defined, but no blas header was found"
+#endif /* end of cblas includes */
 #endif
-#endif
 
-#ifdef HAVE_ACCELERATE
+#if defined(HAVE_ACCELERATE)
+// include accelerate framework after blas
+#define HAVE_ATLAS 1
+#define HAVE_BLAS 1
 #include <Accelerate/Accelerate.h>
+
 #ifndef HAVE_AUBIO_DOUBLE
 #define aubio_vDSP_mmov       vDSP_mmov
 #define aubio_vDSP_vmul       vDSP_vmul
@@ -328,6 +334,18 @@
 #define AUBIO_STRERROR(errno,buf,len) strerror_r(errno, buf, len)
 #else
 #define AUBIO_STRERROR(errno,buf,len) strerror_s(buf, len, errno)
+#endif
+
+#ifdef HAVE_C99_VARARGS_MACROS
+#define AUBIO_STRERR(...)            \
+    char errorstr[256]; \
+    AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); \
+    AUBIO_ERR(__VA_ARGS__)
+#else
+#define AUBIO_STRERR(format, args...)   \
+    char errorstr[256]; \
+    AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); \
+    AUBIO_ERR(format, ##args)
 #endif
 
 /* handy shortcuts */
--- a/src/io/sink.c
+++ b/src/io/sink.c
@@ -215,7 +215,7 @@
 }
 
 void del_aubio_sink(aubio_sink_t * s) {
-  AUBIO_ASSERT(s);
+  //AUBIO_ASSERT(s);
   if (s && s->s_del && s->sink)
     s->s_del((void *)s->sink);
   AUBIO_FREE(s);
--- a/src/io/sink_wavwrite.c
+++ b/src/io/sink_wavwrite.c
@@ -28,8 +28,6 @@
 #include "io/sink_wavwrite.h"
 #include "io/ioutils.h"
 
-#include <errno.h>
-
 #define MAX_SIZE 4096
 
 #define FLOAT_TO_SHORT(x) (short)(x * 32768)
@@ -167,9 +165,7 @@
   /* open output file */
   s->fid = fopen((const char *)s->path, "wb");
   if (!s->fid) {
-    char errorstr[256];
-    AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
-    AUBIO_ERR("sink_wavwrite: could not open %s (%s)\n", s->path, errorstr);
+    AUBIO_STRERR("sink_wavwrite: could not open %s (%s)\n", s->path, errorstr);
     goto beach;
   }
 
@@ -215,11 +211,11 @@
   written += fwrite(write_little_endian(0, buf, 4), 4, 1, s->fid);
 
   // fwrite(*, *, 1, s->fid) was called 13 times, check success
-  if (written != 13) {
-    char errorstr[256];
-    AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
-    AUBIO_WRN("sink_wavwrite: writing header to %s failed, expected %d"
-        " write but got only %d (%s)\n", s->path, 13, written, errorstr);
+  if (written != 13 || fflush(s->fid)) {
+    AUBIO_STRERR("sink_wavwrite: writing header to %s failed"
+        " (wrote %d/%d, %s)\n", s->path, written, 13, errorstr);
+    fclose(s->fid);
+    s->fid = NULL;
     return AUBIO_FAIL;
   }
 
@@ -246,9 +242,7 @@
   written_frames = fwrite(s->scratch_data, 2 * s->channels, write, s->fid);
 
   if (written_frames != write) {
-    char errorstr[256];
-    AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
-    AUBIO_WRN("sink_wavwrite: trying to write %d frames to %s, but only %d"
+    AUBIO_STRERR("sink_wavwrite: trying to write %d frames to %s, but only %d"
         " could be written (%s)\n", write, s->path, written_frames, errorstr);
   }
   s->total_frames_written += written_frames;
@@ -297,16 +291,12 @@
   err += fseek(s->fid, 40, SEEK_SET);
   written += fwrite(write_little_endian(data_size, buf, 4), 4, 1, s->fid);
   if (written != 2 || err != 0) {
-    char errorstr[256];
-    AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
-    AUBIO_WRN("sink_wavwrite: updating header of %s failed, expected %d"
+    AUBIO_STRERR("sink_wavwrite: updating header of %s failed, expected %d"
         " write but got only %d (%s)\n", s->path, 2, written, errorstr);
   }
   // close file
   if (fclose(s->fid)) {
-    char errorstr[256];
-    AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
-    AUBIO_ERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, errorstr);
+    AUBIO_STRERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, errorstr);
   }
   s->fid = NULL;
   return AUBIO_OK;
--- a/src/io/source.c
+++ b/src/io/source.c
@@ -138,7 +138,7 @@
 }
 
 void del_aubio_source(aubio_source_t * s) {
-  AUBIO_ASSERT(s);
+  //AUBIO_ASSERT(s);
   if (s && s->s_del && s->source)
     s->s_del((void *)s->source);
   AUBIO_FREE(s);
--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -30,7 +30,6 @@
 #include <libavresample/avresample.h>
 #endif
 #include <libavutil/opt.h>
-#include <stdlib.h>
 
 // determine whether we use libavformat from ffmpeg or from libav
 #define FFMPEG_LIBAVFORMAT (LIBAVFORMAT_VERSION_MICRO > 99 )
@@ -120,9 +119,9 @@
 aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path,
     uint_t samplerate, uint_t hop_size) {
   aubio_source_avcodec_t * s = AUBIO_NEW(aubio_source_avcodec_t);
-  AVFormatContext *avFormatCtx = s->avFormatCtx;
-  AVCodecContext *avCodecCtx = s->avCodecCtx;
-  AVFrame *avFrame = s->avFrame;
+  AVFormatContext *avFormatCtx = NULL;
+  AVCodecContext *avCodecCtx = NULL;
+  AVFrame *avFrame = NULL;
   sint_t selected_stream = -1;
 #if FF_API_LAVF_AVCTX
   AVCodecParameters *codecpar;
@@ -464,9 +463,9 @@
       (uint8_t **)&output, max_out_samples,
       (const uint8_t **)avFrame->data, in_samples);
 #endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
-  if (out_samples <= 0) {
-    AUBIO_WRN("source_avcodec: no sample found while converting frame (%s)\n",
-        s->path);
+  if (out_samples < 0) {
+    AUBIO_WRN("source_avcodec: error while resampling %s (%d)\n",
+        s->path, out_samples);
     goto beach;
   }
 
@@ -473,14 +472,6 @@
   *read_samples = out_samples;
 
 beach:
-  s->avFormatCtx = avFormatCtx;
-  s->avCodecCtx = avCodecCtx;
-  s->avFrame = avFrame;
-#if defined(HAVE_AVRESAMPLE) || defined(HAVE_SWRESAMPLE)
-  s->avr = avr;
-#endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
-  s->output = output;
-
   av_packet_unref(&avPacket);
 }
 
@@ -628,10 +619,11 @@
   if (s->avr != NULL) {
 #ifdef HAVE_AVRESAMPLE
     avresample_close( s->avr );
+    av_free ( s->avr );
 #elif defined(HAVE_SWRESAMPLE)
     swr_close ( s->avr );
+    swr_free ( &s->avr );
 #endif
-    av_free ( s->avr );
   }
   s->avr = NULL;
   if (s->avCodecCtx != NULL) {
--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -174,6 +174,11 @@
       s->hop_size, read_data->length);
   sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data,
       s->scratch_size);
+  uint_t read_length = read_samples / s->input_channels;
+
+  /* where to store de-interleaved data */
+  smpl_t *ptr_data;
+
   if (!s->handle) {
     AUBIO_ERR("source_sndfile: could not read from %s (file was closed)\n",
         s->path);
@@ -181,10 +186,6 @@
     return;
   }
 
-  uint_t read_length = read_samples / s->input_channels;
-
-  /* where to store de-interleaved data */
-  smpl_t *ptr_data;
 #ifdef HAVE_SAMPLERATE
   if (s->ratio != 1) {
     ptr_data = s->input_data->data;
@@ -225,6 +226,11 @@
       s->path, s->input_channels, read_data->height);
   sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data,
       s->scratch_size);
+  uint_t read_length = read_samples / s->input_channels;
+
+  /* where to store de-interleaved data */
+  smpl_t **ptr_data;
+
   if (!s->handle) {
     AUBIO_ERR("source_sndfile: could not read from %s (file was closed)\n",
         s->path);
@@ -232,10 +238,6 @@
     return;
   }
 
-  uint_t read_length = read_samples / s->input_channels;
-
-  /* where to store de-interleaved data */
-  smpl_t **ptr_data;
 #ifdef HAVE_SAMPLERATE
   if (s->ratio != 1) {
     ptr_data = s->input_mat->data;
--- a/src/io/source_wavread.c
+++ b/src/io/source_wavread.c
@@ -27,11 +27,9 @@
 #include "ioutils.h"
 #include "source_wavread.h"
 
-#include <errno.h>
-
 #define AUBIO_WAVREAD_BUFSIZE 1024
 
-#define SHORT_TO_FLOAT(x) (smpl_t)(x * 3.0517578125e-05)
+//#define SHORT_TO_FLOAT(x) (smpl_t)(x * 3.0517578125e-05)
 
 struct _aubio_source_wavread_t {
   uint_t hop_size;
@@ -100,7 +98,7 @@
 
   s->fid = fopen((const char *)path, "rb");
   if (!s->fid) {
-    AUBIO_ERR("source_wavread: Failed opening %s (System error: %s)\n", s->path, strerror(errno));
+    AUBIO_STRERR("source_wavread: Failed opening %s (%s)\n", s->path, errorstr);
     goto beach;
   }
 
@@ -133,8 +131,8 @@
     buf[4] = '\0';
     bytes_junk += read_little_endian(buf, 4);
     if (fseek(s->fid, bytes_read + bytes_junk, SEEK_SET) != 0) {
-      AUBIO_ERR("source_wavread: Failed opening %s (could not seek past JUNK Chunk: %s)\n",
-          s->path, strerror(errno));
+      AUBIO_STRERR("source_wavread: Failed opening %s (could not seek past JUNK Chunk: %s)\n",
+          s->path, errorstr);
       goto beach;
     }
     bytes_read += bytes_junk;
@@ -261,8 +259,8 @@
     buf[4] = '\0';
     bytes_junk += read_little_endian(buf, 4);
     if (fseek(s->fid, bytes_read + bytes_junk, SEEK_SET) != 0) {
-      AUBIO_ERR("source_wavread: could not seek past unknown chunk in %s (%s)\n",
-          s->path, strerror(errno));
+      AUBIO_STRERR("source_wavread: could not seek past unknown chunk in %s (%s)\n",
+          s->path, errorstr);
       goto beach;
     }
     bytes_read += bytes_junk;
@@ -442,7 +440,7 @@
   }
   ret = fseek(s->fid, s->seek_start + pos * s->blockalign, SEEK_SET);
   if (ret != 0) {
-    AUBIO_ERR("source_wavread: could not seek %s at %d (%s)\n", s->path, pos, strerror(errno));
+    AUBIO_STRERR("source_wavread: could not seek %s at %d (%s)\n", s->path, pos, errorstr);
     return AUBIO_FAIL;
   }
   // reset some values
@@ -463,7 +461,7 @@
     return AUBIO_OK;
   }
   if (fclose(s->fid)) {
-    AUBIO_ERR("source_wavread: could not close %s (%s)\n", s->path, strerror(errno));
+    AUBIO_STRERR("source_wavread: could not close %s (%s)\n", s->path, errorstr);
     return AUBIO_FAIL;
   }
   s->fid = NULL;
--- a/tests/src/spectral/test-mfcc.c
+++ b/tests/src/spectral/test-mfcc.c
@@ -33,9 +33,9 @@
   aubio_pvoc_t *pv = 0;
   aubio_mfcc_t *mfcc = 0;
 
-  fvec_t *in = new_fvec (win_s); // input buffer
-  cvec_t *fftgrain = new_cvec (win_s); // input buffer
-  fvec_t *out = new_fvec (n_coeffs); // output coefficients
+  fvec_t *in = new_fvec (hop_s);       // phase vocoder input
+  cvec_t *fftgrain = new_cvec (win_s); // pvoc output / mfcc input
+  fvec_t *out = new_fvec (n_coeffs);   // mfcc output
 
   if (!in || !fftgrain || !out) { err = 1; goto failure; }
 
--- a/wscript
+++ b/wscript
@@ -145,6 +145,7 @@
     ctx.check(header_name='stdio.h')
     ctx.check(header_name='math.h')
     ctx.check(header_name='string.h')
+    ctx.check(header_name='errno.h')
     ctx.check(header_name='limits.h')
     ctx.check(header_name='stdarg.h')
     ctx.check(header_name='getopt.h', mandatory = False)
@@ -649,7 +650,7 @@
     ctx.excl += ' **/.pytest_cache'
     ctx.excl += ' **/.cache'
     ctx.excl += ' **/**.zip **/**.tar.bz2'
-    ctx.excl += ' **.tar.bz2'
+    ctx.excl += ' **.tar.bz2**'
     ctx.excl += ' **/doc/full/* **/doc/web/*'
     ctx.excl += ' **/doc/full.cfg'
     ctx.excl += ' **/python/*.db'
@@ -661,7 +662,6 @@
     ctx.excl += ' **/dist*'
     ctx.excl += ' **/.DS_Store'
     ctx.excl += ' **/.travis.yml'
-    ctx.excl += ' **/.landscape.yml'
     ctx.excl += ' **/.appveyor.yml'
     ctx.excl += ' **/.circleci/*'
     ctx.excl += ' **/azure-pipelines.yml'