Changeset 60fc05b


Ignore:
Timestamp:
Sep 5, 2015, 12:27:38 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
f264b17
Parents:
b257b60 (diff), f45dd12 (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 'develop' into notes

Files:
39 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rb257b60 r60fc05b  
    88        @[ -d wafilb ] || rm -fr waflib
    99        @chmod +x waf && ./waf --help > /dev/null
    10         @mv .waf-*/waflib . && rm -fr .waf-*
     10        @mv .waf*/waflib . && rm -fr .waf-*
    1111        @sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf
    1212        @chmod +x waf
  • doc/aubiomfcc.txt

    rb257b60 r60fc05b  
    11NAME
    2   aubiomfcc - a command line tool to compute Mel-frequency Cepstrum Coefficients
     2  aubiomfcc - a command line tool to compute Mel-Frequency Cepstrum Coefficients
    33
    44SYNOPSIS
     
    1111DESCRIPTION
    1212
    13   aubiomfcc compute the Mel Frequency Cepstrum Coefficients (MFCC).
     13  aubiomfcc compute the Mel-Frequency Cepstrum Coefficients (MFCC).
     14
     15  MFCCs are coefficients that make up for the mel-frequency spectrum, a
     16  representation of the short-term power spectrum of a sound. By default, 13
     17  coefficents are computed using 40 filters.
    1418
    1519  When started with an input source (-i/--input), the coefficients are given on
  • src/aubio.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    1919*/
    2020
    21 /** \mainpage 
    22  
     21/** \mainpage
     22
    2323  \section introduction Introduction
    24  
     24
    2525  aubio is a library to extract annotations from audio signals: it provides a
    2626  set of functions that take an input audio signal, and output pitch estimates,
    2727  attack times (onset), beat location estimates, and other annotation tasks.
    28  
    29   \section basics Basics 
    30  
     28
     29  \section basics Basics
     30
    3131  All object structures in aubio share the same function prefixes and suffixes:
    32  
     32
    3333    - \p new_aubio_foo creates the object \p foo
    3434    - \p aubio_foo_do executes the object \p foo
     
    3838  functions. Optionally, more than one \p _do methods are available.
    3939  Additional parameters can be adjusted and observed using:
    40  
     40
    4141    - \p aubio_foo_get_param, getter function, gets the value of a parameter
    4242    - \p aubio_foo_set_param, setter function, changes the value of a parameter
  • src/aubio_priv.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2121/** @file
    2222 * Private include file
    23  * 
     23 *
    2424 * This file is for inclusion from _within_ the library only.
    2525 */
     
    3030/*********************
    3131 *
    32  * External includes 
     32 * External includes
    3333 *
    3434 */
     
    7272
    7373/****
    74  * 
     74 *
    7575 * SYSTEM INTERFACE
    7676 *
     
    197197#define DB2LIN(g) (POW(10.0,(g)*0.05f))
    198198#define LIN2DB(v) (20.0*LOG10(v))
    199 #define SQR(_a)   (_a*_a)
    200 
    201 #define MAX(a,b)  ( a > b ? a : b)
    202 #define MIN(a,b)  ( a < b ? a : b)
     199#define SQR(_a)   ((_a)*(_a))
     200
     201#ifndef MAX
     202#define MAX(a,b)  (((a)>(b))?(a):(b))
     203#endif /* MAX */
     204#ifndef MIN
     205#define MIN(a,b)  (((a)<(b))?(a):(b))
     206#endif /* MIN */
    203207
    204208#define ELEM_SWAP(a,b) { register smpl_t t=(a);(a)=(b);(b)=t; }
  • src/cvec.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
  • src/fmat.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2009-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    6363  \param s vector to read from
    6464  \param channel channel to read from
    65   \param position sample position to read from 
     65  \param position sample position to read from
    6666
    6767*/
     
    7070/** write sample value in a buffer
    7171
    72   \param s vector to write to 
     72  \param s vector to write to
    7373  \param data value to write in s->data[channel][position]
    74   \param channel channel to write to 
    75   \param position sample position to write to 
     74  \param channel channel to write to
     75  \param position sample position to write to
    7676
    7777*/
     
    102102smpl_t ** fmat_get_data(fmat_t *s);
    103103
    104 /** print out fmat data 
     104/** print out fmat data
    105105
    106   \param s vector to print out 
     106  \param s vector to print out
    107107
    108108*/
     
    117117void fmat_set(fmat_t *s, smpl_t val);
    118118
    119 /** set all elements to zero 
     119/** set all elements to zero
    120120
    121121  \param s vector to modify
     
    124124void fmat_zeros(fmat_t *s);
    125125
    126 /** set all elements to ones 
     126/** set all elements to ones
    127127
    128128  \param s vector to modify
     
    149149void fmat_weight(fmat_t *s, fmat_t *weight);
    150150
    151 /** make a copy of a matrix 
     151/** make a copy of a matrix
    152152
    153153  \param s source vector
  • src/fvec.c

    rb257b60 r60fc05b  
    2121#include "aubio_priv.h"
    2222#include "fvec.h"
     23
     24#ifdef HAVE_ACCELERATE
     25#include <Accelerate/Accelerate.h>
     26#if !HAVE_AUBIO_DOUBLE
     27#define aubio_vDSP_mmov       vDSP_mmov
     28#define aubio_vDSP_vmul       vDSP_vmul
     29#define aubio_vDSP_vfill      vDSP_vfill
     30#else /* HAVE_AUBIO_DOUBLE */
     31#define aubio_vDSP_mmov       vDSP_mmovD
     32#define aubio_vDSP_vmul       vDSP_vmulD
     33#define aubio_vDSP_vfill      vDSP_vfillD
     34#endif /* HAVE_AUBIO_DOUBLE */
     35#endif
    2336
    2437fvec_t * new_fvec( uint_t length) {
     
    6174
    6275void fvec_set_all (fvec_t *s, smpl_t val) {
     76#ifndef HAVE_ACCELERATE
    6377  uint_t j;
    6478  for (j=0; j< s->length; j++) {
    6579    s->data[j] = val;
    6680  }
     81#else
     82  aubio_vDSP_vfill(&val, s->data, 1, s->length);
     83#endif
    6784}
    6885
    6986void fvec_zeros(fvec_t *s) {
    70 #if HAVE_MEMCPY_HACKS
     87#if !defined(HAVE_MEMCPY_HACKS) && !defined(HAVE_ACCELERATE)
     88  fvec_set_all (s, 0.);
     89#else
     90#if defined(HAVE_MEMCPY_HACKS)
    7191  memset(s->data, 0, s->length * sizeof(smpl_t));
    7292#else
    73   fvec_set_all (s, 0.);
     93  aubio_vDSP_vclr(s->data, 1, s->length);
     94#endif
    7495#endif
    7596}
     
    87108
    88109void fvec_weight(fvec_t *s, fvec_t *weight) {
     110#ifndef HAVE_ACCELERATE
    89111  uint_t j;
    90112  uint_t length = MIN(s->length, weight->length);
     
    92114    s->data[j] *= weight->data[j];
    93115  }
     116#else
     117  aubio_vDSP_vmul(s->data, 1, weight->data, 1, s->data, 1, s->length);
     118#endif /* HAVE_ACCELERATE */
    94119}
    95120
     
    100125    return;
    101126  }
    102 #if HAVE_MEMCPY_HACKS
    103   memcpy(t->data, s->data, t->length * sizeof(smpl_t));
    104 #else
     127#if !defined(HAVE_MEMCPY_HACKS) && !defined(HAVE_ACCELERATE)
    105128  uint_t j;
    106129  for (j=0; j< t->length; j++) {
    107130    t->data[j] = s->data[j];
    108131  }
     132#else
     133#if defined(HAVE_MEMCPY_HACKS)
     134  memcpy(t->data, s->data, t->length * sizeof(smpl_t));
     135#else
     136  aubio_vDSP_mmov(s->data, t->data, 1, s->length, 1, 1);
     137#endif
    109138#endif
    110139}
  • src/fvec.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    8787
    8888  \param s vector to read from
    89   \param position sample position to read from 
     89  \param position sample position to read from
    9090
    9191*/
     
    9494/** write sample value in a buffer
    9595
    96   \param s vector to write to 
     96  \param s vector to write to
    9797  \param data value to write in s->data[position]
    98   \param position sample position to write to 
     98  \param position sample position to write to
    9999
    100100*/
     
    108108smpl_t * fvec_get_data(fvec_t *s);
    109109
    110 /** print out fvec data 
     110/** print out fvec data
    111111
    112   \param s vector to print out 
     112  \param s vector to print out
    113113
    114114*/
     
    123123void fvec_set_all (fvec_t *s, smpl_t val);
    124124
    125 /** set all elements to zero 
     125/** set all elements to zero
    126126
    127127  \param s vector to modify
     
    130130void fvec_zeros(fvec_t *s);
    131131
    132 /** set all elements to ones 
     132/** set all elements to ones
    133133
    134134  \param s vector to modify
  • src/io/audio_unit.c

    rb257b60 r60fc05b  
    2020
    2121#include "config.h"
    22 #ifdef TARGET_OS_IPHONE
     22#ifdef HAVE_AUDIO_UNIT
    2323#include "aubio_priv.h"
    2424
     
    775775}
    776776
    777 #endif /* TARGET_OS_IPHONE */
     777#endif /* HAVE_AUDIO_UNIT */
  • src/io/sink_sndfile.c

    rb257b60 r60fc05b  
    3333#define MAX_CHANNELS 6
    3434#define MAX_SIZE 4096
     35
     36#if !HAVE_AUBIO_DOUBLE
     37#define aubio_sf_write_smpl sf_write_float
     38#else /* HAVE_AUBIO_DOUBLE */
     39#define aubio_sf_write_smpl sf_write_double
     40#endif /* HAVE_AUBIO_DOUBLE */
    3541
    3642struct _aubio_sink_sndfile_t {
     
    126132    AUBIO_ERR("sink_sndfile: Failed opening %s. %s\n", s->path, sf_strerror (NULL));
    127133    return AUBIO_FAIL;
    128   }     
     134  }
    129135
    130136  s->scratch_size = s->max_size*s->channels;
     
    135141    return AUBIO_FAIL;
    136142  }
    137   s->scratch_data = AUBIO_ARRAY(float,s->scratch_size);
     143  s->scratch_data = AUBIO_ARRAY(smpl_t,s->scratch_size);
    138144
    139145  return AUBIO_OK;
     
    141147
    142148void aubio_sink_sndfile_do(aubio_sink_sndfile_t *s, fvec_t * write_data, uint_t write){
    143   uint_t i, j,  channels = s->channels;
     149  uint_t i, j, channels = s->channels;
    144150  int nsamples = 0;
    145151  smpl_t *pwrite;
     
    162168  }
    163169
    164   written_frames = sf_write_float (s->handle, s->scratch_data, nsamples);
     170  written_frames = aubio_sf_write_smpl (s->handle, s->scratch_data, nsamples);
    165171  if (written_frames/channels != write) {
    166172    AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written\n",
     
    171177
    172178void aubio_sink_sndfile_do_multi(aubio_sink_sndfile_t *s, fmat_t * write_data, uint_t write){
    173   uint_t i, j,  channels = s->channels;
     179  uint_t i, j, channels = s->channels;
    174180  int nsamples = 0;
    175181  smpl_t *pwrite;
     
    192198  }
    193199
    194   written_frames = sf_write_float (s->handle, s->scratch_data, nsamples);
     200  written_frames = aubio_sf_write_smpl (s->handle, s->scratch_data, nsamples);
    195201  if (written_frames/channels != write) {
    196202    AUBIO_WRN("sink_sndfile: trying to write %d frames to %s, but only %d could be written\n",
  • src/io/source_avcodec.c

    rb257b60 r60fc05b  
    2323
    2424#ifdef HAVE_LIBAV
     25
     26// determine whether we use libavformat from ffmpe or libav
     27#define FFMPEG_LIBAVFORMAT (LIBAVFORMAT_VERSION_MICRO > 99)
    2528
    2629#include <libavcodec/avcodec.h>
     
    101104
    102105  // try to make sure max_analyze_duration is big enough for most songs
     106#if FFMPEG_LIBAVFORMAT
     107  avFormatCtx->max_analyze_duration2 *= 100;
     108#else
    103109  avFormatCtx->max_analyze_duration *= 100;
     110#endif
    104111
    105112  // retrieve stream information
  • src/io/source_sndfile.c

    rb257b60 r60fc05b  
    9191    AUBIO_ERR("source_sndfile: Failed opening %s: %s\n", s->path, sf_strerror (NULL));
    9292    goto beach;
    93   }     
     93  }
    9494
    9595  /* get input specs */
  • src/lvec.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    6262
    6363  \param s vector to read from
    64   \param position sample position to read from 
     64  \param position sample position to read from
    6565
    6666*/
     
    6969/** write sample value in a buffer
    7070
    71   \param s vector to write to 
     71  \param s vector to write to
    7272  \param data value to write in s->data[position]
    73   \param position sample position to write to 
     73  \param position sample position to write to
    7474
    7575*/
     
    8383lsmp_t * lvec_get_data(lvec_t *s);
    8484
    85 /** print out lvec data 
     85/** print out lvec data
    8686
    87   \param s vector to print out 
     87  \param s vector to print out
    8888
    8989*/
     
    9898void lvec_set_all(lvec_t *s, smpl_t val);
    9999
    100 /** set all elements to zero 
     100/** set all elements to zero
    101101
    102102  \param s vector to modify
     
    105105void lvec_zeros(lvec_t *s);
    106106
    107 /** set all elements to ones 
     107/** set all elements to ones
    108108
    109109  \param s vector to modify
  • src/mathutils.c

    rb257b60 r60fc05b  
    159159fvec_mean (fvec_t * s)
    160160{
    161   uint_t j;
    162161  smpl_t tmp = 0.0;
     162#ifndef HAVE_ACCELERATE
     163  uint_t j;
    163164  for (j = 0; j < s->length; j++) {
    164165    tmp += s->data[j];
    165166  }
    166167  return tmp / (smpl_t) (s->length);
     168#else
     169#if !HAVE_AUBIO_DOUBLE
     170  vDSP_meanv(s->data, 1, &tmp, s->length);
     171#else /* HAVE_AUBIO_DOUBLE */
     172  vDSP_meanvD(s->data, 1, &tmp, s->length);
     173#endif /* HAVE_AUBIO_DOUBLE */
     174  return tmp;
     175#endif /* HAVE_ACCELERATE */
    167176}
    168177
     
    170179fvec_sum (fvec_t * s)
    171180{
    172   uint_t j;
    173181  smpl_t tmp = 0.0;
     182#ifndef HAVE_ACCELERATE
     183  uint_t j;
    174184  for (j = 0; j < s->length; j++) {
    175185    tmp += s->data[j];
    176186  }
     187#else
     188#if !HAVE_AUBIO_DOUBLE
     189  vDSP_sve(s->data, 1, &tmp, s->length);
     190#else /* HAVE_AUBIO_DOUBLE */
     191  vDSP_sveD(s->data, 1, &tmp, s->length);
     192#endif /* HAVE_AUBIO_DOUBLE */
     193#endif /* HAVE_ACCELERATE */
    177194  return tmp;
    178195}
  • src/mathutils.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2014 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    8383
    8484/** swap the left and right halves of a vector
    85  
     85
    8686  This function swaps the left part of the signal with the right part of the
    8787signal. Therefore
    8888
    8989  \f$ a[0], a[1], ..., a[\frac{N}{2}], a[\frac{N}{2}+1], ..., a[N-1], a[N] \f$
    90  
     90
    9191  becomes
    92  
     92
    9393  \f$ a[\frac{N}{2}+1], ..., a[N-1], a[N], a[0], a[1], ..., a[\frac{N}{2}] \f$
    9494
     
    9696can be used before computing the FFT to simplify the phase relationship of the
    9797resulting spectrum. See Amalia de Götzen's paper referred to above.
    98  
     98
    9999*/
    100100void fvec_shift (fvec_t * v);
     
    112112
    113113  The High Frequency Content is defined as \f$ \sum_0^{N-1} (k+1) v[k] \f$.
    114  
    115   \param v vector to get the energy from 
     114
     115  \param v vector to get the energy from
    116116
    117117  \return the HFC of v
    118  
     118
    119119*/
    120120smpl_t fvec_local_hfc (fvec_t * v);
    121121
    122 /** computes the p-norm of a vector 
    123  
     122/** computes the p-norm of a vector
     123
    124124  Computes the p-norm of a vector for \f$ p = \alpha \f$
    125125
    126126  \f$ L^p = ||x||_p = (|x_1|^p + |x_2|^p + ... + |x_n|^p ) ^ \frac{1}{p} \f$
    127  
     127
    128128  If p = 1, the result is the Manhattan distance.
    129129
     
    134134
    135135  References:
    136  
     136
    137137    - <a href="http://en.wikipedia.org/wiki/Lp_space">\f$L^p\f$ space</a> on
    138138  Wikipedia
     
    142142
    143143  \return the p-norm of v
    144  
     144
    145145*/
    146146smpl_t fvec_alpha_norm (fvec_t * v, smpl_t p);
     
    148148/**  alpha normalisation
    149149
    150   This function divides all elements of a vector by the p-norm as computed by 
     150  This function divides all elements of a vector by the p-norm as computed by
    151151fvec_alpha_norm().
    152152
     
    166166
    167167/** remove the minimum value of the vector to each elements
    168  
     168
    169169  \param v vector to remove minimum from
    170170
     
    177177position of a vector, taking the median among post elements before and up to
    178178pre elements after pos.
    179  
     179
    180180  \param v input vector
    181181  \param tmp temporary vector of length post+1+pre
    182   \param post length of causal part to take before pos 
     182  \param post length of causal part to take before pos
    183183  \param pre length of anti-causal part to take after pos
    184   \param pos index to compute threshold for 
    185 
    186   \return moving median threshold value 
     184  \param pos index to compute threshold for
     185
     186  \return moving median threshold value
    187187
    188188*/
     
    197197  \param v input vector
    198198  \param tmp temporary vector of length post+1+pre
    199   \param post length of causal part to take before pos 
     199  \param post length of causal part to take before pos
    200200  \param pre length of anti-causal part to take after pos
    201201
     
    203203void fvec_adapt_thres (fvec_t * v, fvec_t * tmp, uint_t post, uint_t pre);
    204204
    205 /** returns the median of a vector 
     205/** returns the median of a vector
    206206
    207207  The QuickSelect routine is based on the algorithm described in "Numerical
     
    216216
    217217  \return the median of v
    218  
     218
    219219*/
    220220smpl_t fvec_median (fvec_t * v);
     
    249249
    250250/** Quadratic interpolation using Lagrange polynomial.
    251  
     251
    252252  Inspired from ``Comparison of interpolation algorithms in real-time sound
    253 processing'', Vladimir Arnost, 
    254  
    255   \param s0,s1,s2 are 3 consecutive samples of a curve 
     253processing'', Vladimir Arnost,
     254
     255  \param s0,s1,s2 are 3 consecutive samples of a curve
    256256  \param pf is the floating point index [0;2]
    257  
     257
    258258  \return \f$ s0 + (pf/2.)*((pf-3.)*s0-2.*(pf-2.)*s1+(pf-1.)*s2); \f$
    259259
  • src/musicutils.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    3030#endif
    3131
    32 /** create window 
     32/** create window
    3333
    3434  \param window_type type of the window to create
    3535  \param size length of the window to create (see fvec_set_window())
    36  
     36
    3737*/
    3838fvec_t *new_aubio_window (char_t * window_type, uint_t size);
     
    5050
    5151  References:
    52    
     52
    5353    - <a href="http://en.wikipedia.org/wiki/Window_function">Window
    5454function</a> on Wikipedia
     
    6969
    7070  \param phase unwrapped phase to map to the unit circle
    71  
     71
    7272  \return equivalent phase wrapped to the unit circle
    7373
     
    9494
    9595/** clean up cached memory at the end of program
    96  
     96
    9797  This function should be used at the end of programs to purge all cached
    9898  memory. So far it is only useful to clean FFTW's cache.
     
    138138
    139139/** check if buffer level in dB SPL is under a given threshold
    140  
     140
    141141  \param v vector to get level from
    142142  \param threshold threshold in dB SPL
  • src/onset/onset.c

    rb257b60 r60fc05b  
    6868    }
    6969  } else {
    70     // we are at the beginning of the file, and we don't find silence
    71     if (o->total_frames <= o->delay && o->last_onset < o ->minioi && aubio_silence_detection(input, o->silence) == 0) {
    72       //AUBIO_DBG ("beginning of file is not silent, marking as onset\n");
    73       isonset = o->delay / o->hop_size;
    74       o->last_onset = o->delay;
     70    // we are at the beginning of the file
     71    if (o->total_frames <= o->delay) {
     72      // and we don't find silence
     73      if (aubio_silence_detection(input, o->silence) == 0) {
     74        uint_t new_onset = o->total_frames;
     75        if (o->total_frames == 0 || o->last_onset + o->minioi < new_onset) {
     76          isonset = o->delay / o->hop_size;
     77          o->last_onset = o->total_frames + o->delay;
     78        }
     79      }
    7580    }
    7681  }
  • src/onset/peakpicker.h

    rb257b60 r60fc05b  
    1919*/
    2020
    21 /** \file 
    22  
     21/** \file
     22
    2323  Peak picking utilities function
    2424
    2525  \example onset/test-peakpicker.c
    26  
     26
    2727*/
    2828
  • src/pitch/pitchyinfft.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2020
    2121/** \file
    22  
     22
    2323  Pitch detection using a spectral implementation of the YIN algorithm
    24  
     24
    2525  This algorithm was derived from the YIN algorithm. In this implementation, a
    2626  Fourier transform is used to compute a tapered square difference function,
    2727  which allows spectral weighting. Because the difference function is tapered,
    2828  the selection of the period is simplified.
    29  
     29
    3030  Paul Brossier, [Automatic annotation of musical audio for interactive
    3131  systems](http://aubio.org/phd/), Chapter 3, Pitch Analysis, PhD thesis,
     
    4646typedef struct _aubio_pitchyinfft_t aubio_pitchyinfft_t;
    4747
    48 /** execute pitch detection on an input buffer 
    49  
     48/** execute pitch detection on an input buffer
     49
    5050  \param o pitch detection object as returned by new_aubio_pitchyinfft
    5151  \param samples_in input signal vector (length as specified at creation time)
    5252  \param cands_out pitch period candidates, in samples
    53  
     53
    5454*/
    5555void aubio_pitchyinfft_do (aubio_pitchyinfft_t * o, fvec_t * samples_in, fvec_t * cands_out);
    5656/** creation of the pitch detection object
    57  
     57
    5858  \param samplerate samplerate of the input signal
    59   \param buf_size size of the input buffer to analyse 
    60  
     59  \param buf_size size of the input buffer to analyse
     60
    6161*/
    6262aubio_pitchyinfft_t *new_aubio_pitchyinfft (uint_t samplerate, uint_t buf_size);
    6363/** deletion of the pitch detection object
    64  
     64
    6565  \param o pitch detection object as returned by new_aubio_pitchyinfft()
    66  
     66
    6767*/
    6868void del_aubio_pitchyinfft (aubio_pitchyinfft_t * o);
    6969
    70 /** get tolerance parameter for YIN algorithm 
    71  
    72   \param o YIN pitch detection object 
     70/** get tolerance parameter for YIN algorithm
     71
     72  \param o YIN pitch detection object
    7373
    7474  \return tolerance parameter for minima selection [default 0.15]
     
    7777smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * o);
    7878
    79 /** set tolerance parameter for YIN algorithm 
    80  
    81   \param o YIN pitch detection object 
     79/** set tolerance parameter for YIN algorithm
     80
     81  \param o YIN pitch detection object
    8282  \param tol tolerance parameter for minima selection [default 0.15]
    8383
  • src/spectral/fft.c

    rb257b60 r60fc05b  
    6767#warning "Using aubio in double precision with fftw3 in single precision"
    6868#endif /* HAVE_AUBIO_DOUBLE */
    69 #define real_t float 
     69#define real_t float
    7070#else /* HAVE_FFTW3F */
    7171#if !HAVE_AUBIO_DOUBLE
    7272#warning "Using aubio in single precision with fftw3 in double precision"
    7373#endif /* HAVE_AUBIO_DOUBLE */
    74 #define real_t double 
     74#define real_t double
    7575#endif /* HAVE_FFTW3F */
    7676
     
    8282// https://developer.apple.com/library/mac/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html
    8383#include <Accelerate/Accelerate.h>
     84
     85#if !HAVE_AUBIO_DOUBLE
     86#define aubio_vDSP_ctoz                vDSP_ctoz
     87#define aubio_vDSP_fft_zrip            vDSP_fft_zrip
     88#define aubio_vDSP_ztoc                vDSP_ztoc
     89#define aubio_vDSP_zvmags              vDSP_zvmags
     90#define aubio_vDSP_zvphas              vDSP_zvphas
     91#define aubio_vDSP_vsadd               vDSP_vsadd
     92#define aubio_vDSP_vsmul               vDSP_vsmul
     93#define aubio_vDSP_create_fftsetup     vDSP_create_fftsetup
     94#define aubio_vDSP_destroy_fftsetup    vDSP_destroy_fftsetup
     95#define aubio_DSPComplex               DSPComplex
     96#define aubio_DSPSplitComplex          DSPSplitComplex
     97#define aubio_FFTSetup                 FFTSetup
     98#define aubio_vvsqrt                   vvsqrtf
     99#else
     100#define aubio_vDSP_ctoz                vDSP_ctozD
     101#define aubio_vDSP_fft_zrip            vDSP_fft_zripD
     102#define aubio_vDSP_ztoc                vDSP_ztocD
     103#define aubio_vDSP_zvmags              vDSP_zvmagsD
     104#define aubio_vDSP_zvphas              vDSP_zvphasD
     105#define aubio_vDSP_vsadd               vDSP_vsaddD
     106#define aubio_vDSP_vsmul               vDSP_vsmulD
     107#define aubio_vDSP_create_fftsetup     vDSP_create_fftsetupD
     108#define aubio_vDSP_destroy_fftsetup    vDSP_destroy_fftsetupD
     109#define aubio_DSPComplex               DSPDoubleComplex
     110#define aubio_DSPSplitComplex          DSPDoubleSplitComplex
     111#define aubio_FFTSetup                 FFTSetupD
     112#define aubio_vvsqrt                   vvsqrt
     113#endif /* HAVE_AUBIO_DOUBLE */
    84114
    85115#else                         // using OOURA
     
    96126  real_t *in, *out;
    97127  fftw_plan pfw, pbw;
    98   fft_data_t * specdata;     /* complex spectral data */
     128  fft_data_t * specdata;      /* complex spectral data */
    99129#else
    100130#ifdef HAVE_ACCELERATE        // using ACCELERATE
    101131  int log2fftsize;
    102 #if !HAVE_AUBIO_DOUBLE
    103   FFTSetup fftSetup;
    104   DSPSplitComplex spec;
    105   float *in, *out;
    106 #else
    107   FFTSetupD fftSetup;
    108   DSPDoubleSplitComplex spec;
    109   double *in, *out;
    110 #endif
     132  aubio_FFTSetup fftSetup;
     133  aubio_DSPSplitComplex spec;
     134  smpl_t *in, *out;
    111135#else                         // using OOURA
    112136  smpl_t *in, *out;
     
    120144aubio_fft_t * new_aubio_fft (uint_t winsize) {
    121145  aubio_fft_t * s = AUBIO_NEW(aubio_fft_t);
     146  if ((sint_t)winsize < 1) {
     147    AUBIO_ERR("fft: got winsize %d, but can not be < 1\n", winsize);
     148    goto beach;
     149  }
    122150#ifdef HAVE_FFTW3
    123151  uint_t i;
     
    154182  s->compspec = new_fvec(winsize);
    155183  s->log2fftsize = (uint_t)log2f(s->fft_size);
    156 #if !HAVE_AUBIO_DOUBLE
    157   s->in = AUBIO_ARRAY(float, s->fft_size);
    158   s->out = AUBIO_ARRAY(float, s->fft_size);
    159   s->spec.realp = AUBIO_ARRAY(float, s->fft_size/2);
    160   s->spec.imagp = AUBIO_ARRAY(float, s->fft_size/2);
    161   s->fftSetup = vDSP_create_fftsetup(s->log2fftsize, FFT_RADIX2);
    162 #else
    163   s->in = AUBIO_ARRAY(double, s->fft_size);
    164   s->out = AUBIO_ARRAY(double, s->fft_size);
    165   s->spec.realp = AUBIO_ARRAY(double, s->fft_size/2);
    166   s->spec.imagp = AUBIO_ARRAY(double, s->fft_size/2);
    167   s->fftSetup = vDSP_create_fftsetupD(s->log2fftsize, FFT_RADIX2);
    168 #endif
    169 #else                         // using OOURA
     184  s->in = AUBIO_ARRAY(smpl_t, s->fft_size);
     185  s->out = AUBIO_ARRAY(smpl_t, s->fft_size);
     186  s->spec.realp = AUBIO_ARRAY(smpl_t, s->fft_size/2);
     187  s->spec.imagp = AUBIO_ARRAY(smpl_t, s->fft_size/2);
     188  s->fftSetup = aubio_vDSP_create_fftsetup(s->log2fftsize, FFT_RADIX2);
     189#else                         // using OOURA
     190  if (aubio_is_power_of_two(winsize) != 1) {
     191    AUBIO_ERR("fft: can only create with sizes power of two,"
     192              " requested %d\n", winsize);
     193    goto beach;
     194  }
    170195  s->winsize = winsize;
    171196  s->fft_size = winsize / 2 + 1;
     
    179204#endif /* HAVE_FFTW3 */
    180205  return s;
     206beach:
     207  AUBIO_FREE(s);
     208  return NULL;
    181209}
    182210
     
    192220  AUBIO_FREE(s->spec.realp);
    193221  AUBIO_FREE(s->spec.imagp);
    194 #if !HAVE_AUBIO_DOUBLE
    195   vDSP_destroy_fftsetup(s->fftSetup);
    196 #else
    197   vDSP_destroy_fftsetupD(s->fftSetup);
    198 #endif
     222  aubio_vDSP_destroy_fftsetup(s->fftSetup);
    199223#else                         // using OOURA
    200224  AUBIO_FREE(s->w);
     
    219243void aubio_fft_do_complex(aubio_fft_t * s, fvec_t * input, fvec_t * compspec) {
    220244  uint_t i;
     245#ifndef HAVE_MEMCPY_HACKS
    221246  for (i=0; i < s->winsize; i++) {
    222247    s->in[i] = input->data[i];
    223248  }
     249#else
     250  memcpy(s->in, input->data, s->winsize * sizeof(smpl_t));
     251#endif /* HAVE_MEMCPY_HACKS */
    224252#ifdef HAVE_FFTW3             // using FFTW3
    225253  fftw_execute(s->pfw);
     
    238266#else /* HAVE_FFTW3 */
    239267#ifdef HAVE_ACCELERATE        // using ACCELERATE
    240 #if !HAVE_AUBIO_DOUBLE
    241268  // convert real data to even/odd format used in vDSP
    242   vDSP_ctoz((DSPComplex*)s->in, 2, &s->spec, 1, s->fft_size/2);
     269  aubio_vDSP_ctoz((aubio_DSPComplex*)s->in, 2, &s->spec, 1, s->fft_size/2);
    243270  // compute the FFT
    244   vDSP_fft_zrip(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_FORWARD);
    245 #else
    246   // convert real data to even/odd format used in vDSP
    247   vDSP_ctozD((DSPDoubleComplex*)s->in, 2, &s->spec, 1, s->fft_size/2);
    248   // compute the FFT
    249   vDSP_fft_zripD(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_FORWARD);
    250 #endif
     271  aubio_vDSP_fft_zrip(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_FORWARD);
    251272  // convert from vDSP complex split to [ r0, r1, ..., rN, iN-1, .., i2, i1]
    252273  compspec->data[0] = s->spec.realp[0];
     
    258279  // apply scaling
    259280  smpl_t scale = 1./2.;
    260 #if !HAVE_AUBIO_DOUBLE
    261   vDSP_vsmul(compspec->data, 1, &scale, compspec->data, 1, s->fft_size);
    262 #else
    263   vDSP_vsmulD(compspec->data, 1, &scale, compspec->data, 1, s->fft_size);
    264 #endif
     281  aubio_vDSP_vsmul(compspec->data, 1, &scale, compspec->data, 1, s->fft_size);
    265282#else                         // using OOURA
    266283  rdft(s->winsize, 1, s->in, s->ip, s->w);
     
    305322    s->out[2 * i + 1] = compspec->data[s->winsize - i];
    306323  }
    307 #if !HAVE_AUBIO_DOUBLE
    308324  // convert to split complex format used in vDSP
    309   vDSP_ctoz((DSPComplex*)s->out, 2, &s->spec, 1, s->fft_size/2);
     325  aubio_vDSP_ctoz((aubio_DSPComplex*)s->out, 2, &s->spec, 1, s->fft_size/2);
    310326  // compute the FFT
    311   vDSP_fft_zrip(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_INVERSE);
     327  aubio_vDSP_fft_zrip(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_INVERSE);
    312328  // convert result to real output
    313   vDSP_ztoc(&s->spec, 1, (DSPComplex*)output->data, 2, s->fft_size/2);
     329  aubio_vDSP_ztoc(&s->spec, 1, (aubio_DSPComplex*)output->data, 2, s->fft_size/2);
    314330  // apply scaling
    315331  smpl_t scale = 1.0 / s->winsize;
    316   vDSP_vsmul(output->data, 1, &scale, output->data, 1, s->fft_size);
    317 #else
    318   // convert to split complex format used in vDSP
    319   vDSP_ctozD((DSPDoubleComplex*)s->out, 2, &s->spec, 1, s->fft_size/2);
    320   // compute the FFT
    321   vDSP_fft_zripD(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_INVERSE);
    322   // convert result to real output
    323   vDSP_ztocD(&s->spec, 1, (DSPDoubleComplex*)output->data, 2, s->fft_size/2);
    324   // apply scaling
    325   smpl_t scale = 1.0 / s->winsize;
    326   vDSP_vsmulD(output->data, 1, &scale, output->data, 1, s->fft_size);
    327 #endif
     332  aubio_vDSP_vsmul(output->data, 1, &scale, output->data, 1, s->fft_size);
    328333#else                         // using OOURA
    329334  smpl_t scale = 2.0 / s->winsize;
     
    392397  uint_t i;
    393398  for (i = 0; i < compspec->length / 2 + 1; i++) {
    394     compspec->data[i] = 
     399    compspec->data[i] =
    395400      spectrum->norm[i]*COS(spectrum->phas[i]);
    396401  }
  • src/spectral/fft.h

    rb257b60 r60fc05b  
    1919*/
    2020
    21 /** \file 
     21/** \file
    2222
    2323  Fast Fourier Transform
     
    4040
    4141/** FFT object
    42  
     42
    4343  This object computes forward and backward FFTs.
    4444
     
    5252*/
    5353aubio_fft_t * new_aubio_fft (uint_t size);
    54 /** delete FFT object 
     54/** delete FFT object
    5555
    5656  \param s fft object as returned by new_aubio_fft
     
    6262
    6363  \param s fft object as returned by new_aubio_fft
    64   \param input input signal 
    65   \param spectrum output spectrum 
     64  \param input input signal
     65  \param spectrum output spectrum
    6666
    6767*/
     
    7070
    7171  \param s fft object as returned by new_aubio_fft
    72   \param spectrum input spectrum 
    73   \param output output signal 
     72  \param spectrum input spectrum
     73  \param output output signal
    7474
    7575*/
     
    7979
    8080  \param s fft object as returned by new_aubio_fft
    81   \param input real input signal 
     81  \param input real input signal
    8282  \param compspec complex output fft real/imag
    8383
     
    8787
    8888  \param s fft object as returned by new_aubio_fft
    89   \param compspec real/imag input fft array 
    90   \param output real output array 
     89  \param compspec real/imag input fft array
     90  \param output real output array
    9191
    9292*/
    9393void aubio_fft_rdo_complex (aubio_fft_t *s, fvec_t * compspec, fvec_t * output);
    9494
    95 /** convert real/imag spectrum to norm/phas spectrum 
     95/** convert real/imag spectrum to norm/phas spectrum
    9696
    97   \param compspec real/imag input fft array 
    98   \param spectrum cvec norm/phas output array 
     97  \param compspec real/imag input fft array
     98  \param spectrum cvec norm/phas output array
    9999
    100100*/
    101101void aubio_fft_get_spectrum(fvec_t * compspec, cvec_t * spectrum);
    102 /** convert real/imag spectrum to norm/phas spectrum 
     102/** convert real/imag spectrum to norm/phas spectrum
    103103
    104   \param compspec real/imag input fft array 
    105   \param spectrum cvec norm/phas output array 
     104  \param compspec real/imag input fft array
     105  \param spectrum cvec norm/phas output array
    106106
    107107*/
    108108void aubio_fft_get_realimag(cvec_t * spectrum, fvec_t * compspec);
    109109
    110 /** compute phas spectrum from real/imag parts 
     110/** compute phas spectrum from real/imag parts
    111111
    112   \param compspec real/imag input fft array 
    113   \param spectrum cvec norm/phas output array 
     112  \param compspec real/imag input fft array
     113  \param spectrum cvec norm/phas output array
    114114
    115115*/
    116116void aubio_fft_get_phas(fvec_t * compspec, cvec_t * spectrum);
    117 /** compute imaginary part from the norm/phas cvec 
     117/** compute imaginary part from the norm/phas cvec
    118118
    119   \param spectrum norm/phas input array 
    120   \param compspec real/imag output fft array 
     119  \param spectrum norm/phas input array
     120  \param compspec real/imag output fft array
    121121
    122122*/
    123123void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec);
    124124
    125 /** compute norm component from real/imag parts 
     125/** compute norm component from real/imag parts
    126126
    127   \param compspec real/imag input fft array 
    128   \param spectrum cvec norm/phas output array 
     127  \param compspec real/imag input fft array
     128  \param spectrum cvec norm/phas output array
    129129
    130130*/
    131131void aubio_fft_get_norm(fvec_t * compspec, cvec_t * spectrum);
    132 /** compute real part from norm/phas components 
     132/** compute real part from norm/phas components
    133133
    134   \param spectrum norm/phas input array 
    135   \param compspec real/imag output fft array 
     134  \param spectrum norm/phas input array
     135  \param compspec real/imag output fft array
    136136
    137137*/
  • src/spectral/filterbank_mel.h

    rb257b60 r60fc05b  
    5959
    6060  The filter coefficients are built according to Malcolm Slaney's Auditory
    61   Toolbox, available at http://cobweb.ecn.purdue.edu/~malcolm/interval/1998-010/
     61  Toolbox, available at http://engineering.purdue.edu/~malcolm/interval/1998-010/
    6262  (see file mfcc.m).
    6363
  • src/spectral/mfcc.h

    rb257b60 r60fc05b  
    2222/** \file
    2323
    24   Mel-frequency cepstrum coefficients object
     24  Mel-Frequency Cepstrum Coefficients object
     25
     26  This object computes MFCC coefficients on an input cvec_t.
     27
     28  The implementation follows the specifications established by Malcolm Slaney
     29  in its Auditory Toolbox, available online (see file mfcc.m).
     30
     31  http://engineering.ecn.purdue.edu/~malcolm/interval/1998-010/
    2532
    2633  \example spectral/test-mfcc.c
  • src/spectral/phasevoc.h

    rb257b60 r60fc05b  
    5757
    5858/** compute spectral frame
    59  
     59
    6060  This function accepts an input vector of size [hop_s]. The
    6161  analysis buffer is rotated and filled with the new data. After windowing of
     
    6464
    6565  \param pv phase vocoder object as returned by new_aubio_pvoc
    66   \param in new input signal (hop_s long) 
     66  \param in new input signal (hop_s long)
    6767  \param fftgrain output spectral frame
    6868
     
    7575  synthesis is then computed using the previously synthetised frames, and the
    7676  output stored in out.
    77  
     77
    7878  \param pv phase vocoder object as returned by new_aubio_pvoc
    7979  \param fftgrain input spectral frame
    80   \param out output signal (hop_s long) 
     80  \param out output signal (hop_s long)
    8181
    8282*/
     
    9898#ifdef __cplusplus
    9999}
    100 #endif 
     100#endif
    101101
    102102#endif /* _AUBIO_PHASEVOC_H */
  • src/spectral/tss.h

    rb257b60 r60fc05b  
    6363
    6464/** split input into transient and steady states components
    65  
     65
    6666  \param o tss object as returned by new_aubio_tss()
    6767  \param input input spectral frame
     
    7373    cvec_t * stead);
    7474
    75 /** set transient / steady state separation threshold 
    76  
     75/** set transient / steady state separation threshold
     76
    7777  \param o tss object as returned by new_aubio_tss()
    7878  \param thrs new threshold value
     
    8282
    8383/** set parameter a, defaults to 3
    84  
     84
    8585  \param o tss object as returned by new_aubio_tss()
    8686  \param alpha new value for alpha parameter
     
    9090
    9191/** set parameter b, defaults to 3
    92  
     92
    9393  \param o tss object as returned by new_aubio_tss()
    9494  \param beta new value for beta parameter
  • src/tempo/beattracking.c

    rb257b60 r60fc05b  
    136136  uint_t numelem = 4;
    137137
    138   smpl_t phase;                 // beat alignment (step - lastbeat) 
    139   smpl_t beat;                  // beat position 
     138  smpl_t phase;                 // beat alignment (step - lastbeat)
     139  smpl_t beat;                  // beat position
    140140  smpl_t bp;                    // beat period
    141141  uint_t a, b;                  // used to build shift invariant comb filterbank
     
    227227  beat = bp - phase;
    228228
    229   // AUBIO_DBG ("bp: %f, phase: %f, lastbeat: %f, step: %d, winlen: %d\n", 
     229  // AUBIO_DBG ("bp: %f, phase: %f, lastbeat: %f, step: %d, winlen: %d\n",
    230230  //    bp, phase, bt->lastbeat, step, winlen);
    231231
     
    319319  }
    320320
    321   //now look for step change - i.e. a difference between gp and rp that 
     321  //now look for step change - i.e. a difference between gp and rp that
    322322  // is greater than 2*constthresh - always true in first case, since gp = 0
    323323  if (counter == 0) {
     
    342342    }
    343343  } else if (counter > 0) {
    344     //if counter doesn't = 1, 
     344    //if counter doesn't = 1,
    345345    counter = counter - 1;
    346346  }
  • src/tempo/beattracking.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Matthew Davies and Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Matthew Davies and Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    3535
    3636  \example tempo/test-beattracking.c
    37  
     37
    3838*/
    3939#ifndef _AUBIO_BEATTRACKING_H
     
    5050
    5151  \param winlen length of the onset detection window
    52   \param hop_size number of onset detection samples [512] 
     52  \param hop_size number of onset detection samples [512]
    5353  \param samplerate samplerate of the input signal
    5454
     
    5757    uint_t samplerate);
    5858
    59 /** track the beat 
     59/** track the beat
    6060
    6161  \param bt beat tracking object
    6262  \param dfframes current input detection function frame, smoothed by
    63   adaptive median threshold. 
    64   \param out stored detected beat locations 
     63  adaptive median threshold.
     64  \param out stored detected beat locations
    6565
    6666*/
     
    7878smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * bt);
    7979
    80 /** get current tempo confidence 
     80/** get current tempo confidence
    8181
    8282  \param bt beat tracking object
  • src/temporal/a_weighting.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2525
    2626  A-weighting filter coefficients
    27  
     27
    2828  This file creates an A-weighting digital filter, which reduces low and high
    2929  frequencies and enhance the middle ones to reflect the ability of the human
    3030  hearing.
    31  
     31
    3232  The implementation is based on the following standard:
    3333
    3434    - IEC/CD 1672: Electroacoustics-Sound Level Meters, IEC, Geneva, Nov.  1996,
    3535  for A- and C-weighting filters.
    36  
     36
    3737  See also:
    38  
     38
    3939    - <a href="http://en.wikipedia.org/wiki/A-weighting">A-Weighting on
    4040  Wikipedia</a>
     
    4343    - <a href="http://www.mathworks.com/matlabcentral/fileexchange/69">Christophe
    4444  Couvreur's 'octave' toolbox</a>
    45  
     45
    4646  The coefficients in this file have been computed using Christophe Couvreur's
    4747  scripts in octave 3.0 (debian package 1:3.0.5-6+b2 with octave-signal
     
    6363/** create new A-design filter
    6464
    65   \param samplerate sampling frequency of the signal to filter. Should be one of 
     65  \param samplerate sampling frequency of the signal to filter. Should be one of
    6666  8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and
    6767  192000 Hz
     
    7575
    7676  \param f filter object to get coefficients from
    77   \param samplerate sampling frequency of the signal to filter. Should be one of 
     77  \param samplerate sampling frequency of the signal to filter. Should be one of
    7878  8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and
    7979  192000 Hz
  • src/temporal/biquad.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2222#define _AUBIO_FILTER_BIQUAD_H
    2323
    24 /** \file 
     24/** \file
    2525
    2626  Second order Infinite Impulse Response filter
    2727
    2828  This file implements a normalised biquad filter (second order IIR):
    29  
     29
    3030  \f$ y[n] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] - a_1 y[n-1] - a_2 y[n-2] \f$
    3131
  • src/temporal/c_weighting.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2525
    2626  C-weighting filter coefficients
    27  
     27
    2828  This file creates a C-weighting digital filter, which reduces low and high
    2929  frequencies and enhance the middle ones to reflect the ability of the human
    3030  hearing.
    31  
     31
    3232  The implementation is based on the following standard:
    3333
    3434    - IEC/CD 1672: Electroacoustics-Sound Level Meters, IEC, Geneva, Nov.  1996,
    3535  for A- and C-weighting filters.
    36  
     36
    3737  See also:
    38  
     38
    3939    - <a href="http://en.wikipedia.org/wiki/A-weighting">A-Weighting on
    4040  Wikipedia</a>
     
    4343    - <a href="http://www.mathworks.com/matlabcentral/fileexchange/69">Christophe
    4444  Couvreur's 'octave' toolbox</a>
    45  
     45
    4646  The coefficients in this file have been computed using Christophe Couvreur's
    4747  scripts in octave 3.0 (debian package 1:3.0.5-6+b2 with octave-signal
     
    6363/** create new C-design filter
    6464
    65   \param samplerate sampling frequency of the signal to filter. Should be one of 
     65  \param samplerate sampling frequency of the signal to filter. Should be one of
    6666  8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and
    6767  192000 Hz
     
    7575
    7676  \param f filter object to get coefficients from
    77   \param samplerate sampling frequency of the signal to filter. Should be one of 
     77  \param samplerate sampling frequency of the signal to filter. Should be one of
    7878  8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and
    7979  192000 Hz
  • src/temporal/filter.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2222#define _AUBIO_FILTER_H
    2323
    24 /** \file 
     24/** \file
    2525
    2626  Digital filter
     
    2828  This object stores a digital filter of order \f$n\f$.
    2929  It contains the following data:
    30     - \f$ n*1 b_i \f$ feedforward coefficients 
    31     - \f$ n*1 a_i \f$ feedback coefficients 
     30    - \f$ n*1 b_i \f$ feedforward coefficients
     31    - \f$ n*1 a_i \f$ feedback coefficients
    3232    - \f$ n*c x_i \f$ input signal
    3333    - \f$ n*c y_i \f$ output signal
     
    4141  The function aubio_filter_do_outplace() computes the following output signal
    4242  \f$ y[n] \f$ from the input signal \f$ x[n] \f$:
    43  
     43
    4444  \f{eqnarray*}{
    4545     y[n] = b_0 x[n] & + & b_1 x[n-1] + b_2 x[n-2] + ... + b_P x[n-P] \\
     
    5454  operation.
    5555
    56   Some convenience functions are provided: 
     56  Some convenience functions are provided:
    5757    - new_aubio_filter_a_weighting() and aubio_filter_set_a_weighting(),
    5858    - new_aubio_filter_c_weighting() and aubio_filter_set_c_weighting().
     
    6060
    6161  \example temporal/test-filter.c
    62  
     62
    6363*/
    6464
     
    164164
    165165/** delete a filter object
    166  
     166
    167167  \param f filter object to delete
    168168
  • src/temporal/resampler.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2323
    2424/** \file
    25  
     25
    2626 Resampling object
    2727
    2828 This object resamples an input vector into an output vector using
    2929 libsamplerate. See http://www.mega-nerd.com/SRC/
    30  
     30
    3131*/
    3232
     
    3838typedef struct _aubio_resampler_t aubio_resampler_t;
    3939
    40 /** create resampler object 
     40/** create resampler object
    4141
    42   \param ratio output_sample_rate / input_sample_rate 
     42  \param ratio output_sample_rate / input_sample_rate
    4343  \param type libsamplerate resampling type, see http://www.mega-nerd.com/SRC/api_misc.html#Converters
    4444
  • src/types.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2323
    2424/** \file
    25  
     25
    2626  Definition of data types used in aubio
    27  
     27
    2828*/
    2929
  • src/utils/parameter.h

    rb257b60 r60fc05b  
    6161uint_t aubio_parameter_set_target_value ( aubio_parameter_t * param, smpl_t value );
    6262
    63 /** get next parameter 
     63/** get next parameter
    6464
    6565  \param param parameter, created by ::new_aubio_parameter
  • src/utils/scale.h

    rb257b60 r60fc05b  
    2121/** \file
    2222
    23  Vector scaling function 
    24  
     23 Vector scaling function
     24
    2525 This object, inspired from the scale object in FTS, the jMax engine, scales
    2626 the values of a vector according to an affine function defined as follow:
    27  
    28  \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$ 
    29  
     27
     28 \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$
     29
    3030*/
    3131#ifndef _AUBIO_SCALE_H
     
    4040
    4141/** create a scale object
    42  
     42
    4343  \param flow lower value of output function
    4444  \param fhig higher value of output function
     
    4949aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig,
    5050    smpl_t ilow, smpl_t ihig);
    51 /** delete a scale object 
     51/** delete a scale object
    5252
    5353  \param s scale object as returned by new_aubio_scale
     
    7676#ifdef __cplusplus
    7777}
    78 #endif 
     78#endif
    7979
    8080#endif /* _AUBIO_SCALE_H */
  • src/vecutils.h

    rb257b60 r60fc05b  
    11/*
    2   Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2009-2015 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
  • tests/src/spectral/test-fft.c

    rb257b60 r60fc05b  
    33int main (void)
    44{
     5  int return_code = 0;
    56  uint_t i, n_iters = 100; // number of iterations
    67  uint_t win_s = 500; // window size
     
    1011  // create fft object
    1112  aubio_fft_t * fft = new_aubio_fft(win_s);
     13
     14  if (!fft) {
     15    return_code = 1;
     16    goto beach;
     17  }
    1218
    1319  // fill input with some data
     
    3440  //fvec_print(out);
    3541  del_aubio_fft(fft);
     42beach:
    3643  del_fvec(in);
    3744  del_cvec(fftgrain);
    3845  del_fvec(out);
    3946  aubio_cleanup();
    40   return 0;
     47  return return_code;
    4148}
  • tests/src/test-delnull.c

    rb257b60 r60fc05b  
    22#include "aubio.h"
    33
    4 // Because aubio does not check for double free, this program will crash.
    5 // Programs that call these functions should check for null pointers.
     4// When creating an aubio object, the user should check whether the object is
     5// set NULL, indicating the creation failed and the object was not allocated.
    66
    77int main (void)
    88{
    9   del_fvec(NULL);
    10   del_lvec(NULL);
    11   del_cvec(NULL);
    12   return 0;
     9  uint_t return_code = 0;
     10  fvec_t *f = new_fvec(-12);
     11  cvec_t *c = new_cvec(-12);
     12  lvec_t *l = new_lvec(-12);
     13  aubio_fft_t *fft = new_aubio_fft(-12);
     14  if (f != NULL) {
     15    return_code = 1;
     16  } else if (c != NULL) {
     17    return_code = 2;
     18  } else if (l != NULL) {
     19    return_code = 3;
     20  } else if (fft != NULL) {
     21    return_code = 3;
     22  }
     23  return return_code;
    1324}
  • wscript

    rb257b60 r60fc05b  
    7676            help_str = 'build fat binaries (darwin only)',
    7777            help_disable_str = 'do not build fat binaries (default)')
     78    add_option_enable_disable(ctx, 'accelerate', default = None,
     79            help_str = 'use Accelerate framework (darwin only) (auto)',
     80            help_disable_str = 'do not use Accelerate framework')
     81    add_option_enable_disable(ctx, 'apple-audio', default = None,
     82            help_str = 'use CoreFoundation (darwin only) (auto)',
     83            help_disable_str = 'do not use CoreFoundation framework')
    7884
    7985    ctx.add_option('--with-target-platform', type='string',
     
    111117
    112118    if target_platform in [ 'darwin', 'ios', 'iosimulator']:
    113         ctx.env.FRAMEWORK = ['CoreFoundation', 'AudioToolbox', 'Accelerate']
    114         ctx.define('HAVE_SOURCE_APPLE_AUDIO', 1)
    115         ctx.define('HAVE_SINK_APPLE_AUDIO', 1)
    116         ctx.define('HAVE_ACCELERATE', 1)
     119        if (ctx.options.enable_apple_audio != False):
     120            ctx.env.FRAMEWORK += ['CoreFoundation', 'AudioToolbox']
     121            ctx.define('HAVE_SOURCE_APPLE_AUDIO', 1)
     122            ctx.define('HAVE_SINK_APPLE_AUDIO', 1)
     123        if (ctx.options.enable_accelerate != False):
     124            ctx.define('HAVE_ACCELERATE', 1)
     125            ctx.env.FRAMEWORK += ['Accelerate']
    117126
    118127    if target_platform in [ 'ios', 'iosimulator' ]:
    119         ctx.define('TARGET_OS_IPHONE', 1)
    120128        MINSDKVER="6.1"
    121129        ctx.env.CFLAGS += ['-std=c99']
     130        if (ctx.options.enable_audio_unit != False):
     131            ctx.define('HAVE_AUDIO_UNIT', 1)
     132            #ctx.env.FRAMEWORK += ['CoreFoundation', 'AudioToolbox']
    122133        if target_platform == 'ios':
    123134            DEVROOT = "/Applications/Xcode.app/Contents"
     
    239250                args = '--cflags --libs', uselib_store = 'AVRESAMPLE',
    240251                mandatory = ctx.options.enable_avcodec)
    241         if all ( 'HAVE_' + i in ctx.env.define_key
     252        if all ( 'HAVE_' + i in ctx.env
    242253                for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
    243254            ctx.define('HAVE_LIBAV', 1)
Note: See TracChangeset for help on using the changeset viewer.