Changes in / [057ecee:65a4fb4]


Ignore:
Files:
19 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • python/lib/moresetuptools.py

    r057ecee r65a4fb4  
    8080                'libswresample', 'libavresample',
    8181                'sndfile',
    82                 'hdf5',
    8382                #'fftw3f',
    8483               ]
     
    105104        ext.define_macros += [('HAVE_FFTW3F', 1)]
    106105        ext.define_macros += [('HAVE_FFTW3', 1)]
    107     if 'hdf5' in ext.libraries:
    108         ext.libraries += ['hdf5_hl']
    109         ext.define_macros += [('HAVE_HDF5', 1)]
    110106
    111107    # add accelerate on darwin
  • src/aubio_priv.h

    r057ecee r65a4fb4  
    134134#define aubio_cblas_swap      cblas_sswap
    135135#define aubio_cblas_dot       cblas_sdot
    136 #define aubio_cblas__gemv     cblas_sgemv
    137136#else /* HAVE_AUBIO_DOUBLE */
    138137#ifdef HAVE_ATLAS
     
    142141#define aubio_cblas_swap      cblas_dswap
    143142#define aubio_cblas_dot       cblas_ddot
    144 #define aubio_cblas__gemv     cblas_dgemv
    145143#endif /* HAVE_AUBIO_DOUBLE */
    146144#endif /* HAVE_BLAS */
     
    401399#endif /* DEBUG */
    402400
    403 // goto to failure if condition x is not true
    404 #define AUBIO_GOTO_FAILURE(x) if (!(x)) goto failure
    405 
    406 #define AUBIO_ASSERT_EQUAL_SHAPE(t1, t2) { \
    407     AUBIO_ASSERT(t1 && t2); \
    408     AUBIO_ASSERT(t1->ndim == t2->ndim); \
    409     uint_t nn; \
    410     for (nn = 0; nn < t1->ndim; nn++) \
    411       AUBIO_ASSERT(t1->shape[nn] == t2->shape[nn]); \
    412     }
    413 
    414401#endif /* AUBIO_PRIV_H */
  • src/fmat.c

    r057ecee r65a4fb4  
    2424fmat_t * new_fmat (uint_t height, uint_t length) {
    2525  fmat_t * s;
    26   uint_t i;
     26  uint_t i,j;
    2727  if ((sint_t)length <= 0 || (sint_t)height <= 0 ) {
    2828    return NULL;
     
    3232  s->length = length;
    3333  s->data = AUBIO_ARRAY(smpl_t*,s->height);
    34   s->data[0] = AUBIO_ARRAY(smpl_t, s->length * s->height);
    35   for (i=1; i< s->height; i++) {
    36     s->data[i] = s->data[0] + i * s->length;
     34  for (i=0; i< s->height; i++) {
     35    s->data[i] = AUBIO_ARRAY(smpl_t, s->length);
     36    for (j=0; j< s->length; j++) {
     37      s->data[i][j]=0.;
     38    }
    3739  }
    3840  return s;
     
    4042
    4143void del_fmat (fmat_t *s) {
    42   AUBIO_ASSERT(s);
    43   if (s->data[0])
    44     AUBIO_FREE(s->data[0]);
    45   if (s->data)
    46     AUBIO_FREE(s->data);
     44  uint_t i;
     45  for (i=0; i<s->height; i++) {
     46    AUBIO_FREE(s->data[i]);
     47  }
     48  AUBIO_FREE(s->data);
    4749  AUBIO_FREE(s);
    4850}
     
    154156
    155157void fmat_vecmul(const fmat_t *s, const fvec_t *scale, fvec_t *output) {
     158  uint_t k;
     159#if 0
     160  assert(s->height == output->length);
     161  assert(s->length == scale->length);
     162#endif
    156163#if !defined(HAVE_ACCELERATE) && !defined(HAVE_BLAS)
    157   uint_t j, k;
    158   AUBIO_ASSERT(s->height == output->length);
    159   AUBIO_ASSERT(s->length == scale->length);
     164  uint_t j;
    160165  fvec_zeros(output);
    161166  for (j = 0; j < s->length; j++) {
    162167    for (k = 0; k < s->height; k++) {
    163       output->data[k] += scale->data[j] * s->data[k][j];
     168      output->data[k] += scale->data[j]
     169          * s->data[k][j];
    164170    }
    165171  }
    166172#elif defined(HAVE_BLAS)
    167 #if 0
    168173  for (k = 0; k < s->height; k++) {
    169174    output->data[k] = aubio_cblas_dot( s->length, scale->data, 1, s->data[k], 1);
    170175  }
    171 #else
    172   aubio_cblas__gemv(CblasColMajor, CblasTrans,
    173       s->length, s->height, 1.,
    174       s->data[0], s->length,
    175       scale->data, 1, 0.,
    176       output->data, 1);
    177 #endif
    178176#elif defined(HAVE_ACCELERATE)
    179177#if 0
     
    181179  vDSP_mmul (s->data[0], 1, scale->data, 1, output->data, 1, s->height, 1, s->length);
    182180#else
    183   uint_t k;
    184181  for (k = 0; k < s->height; k++) {
    185182    aubio_vDSP_dotpr( scale->data, 1, s->data[k], 1, &(output->data[k]), s->length);
     
    188185#endif
    189186}
    190 
    191 void fvec_matmul(const fvec_t *scale, const fmat_t *s, fvec_t *output) {
    192   AUBIO_ASSERT(s->height == scale->length);
    193   AUBIO_ASSERT(s->length == output->length);
    194 #if !defined(HAVE_ACCELERATE) && !defined(HAVE_BLAS)
    195   uint_t j, k;
    196   fvec_zeros(output);
    197   for (k = 0; k < s->height; k++) {
    198     for (j = 0; j < s->length; j++) {
    199       output->data[j] += s->data[k][j] * scale->data[k];
    200     }
    201   }
    202 #elif defined(HAVE_BLAS)
    203 #if 0
    204   for (k = 0; k < s->length; k++) {
    205     output->data[k] = aubio_cblas_dot( scale->length, scale->data, 1,
    206         &s->data[0][0] + k, s->length);
    207   }
    208 #else
    209   aubio_cblas__gemv(CblasColMajor, CblasNoTrans,
    210       s->length, s->height, 1.,
    211       s->data[0], s->length,
    212       scale->data, 1, 0.,
    213       output->data, 1);
    214 #endif
    215 #elif defined(HAVE_ACCELERATE)
    216 #if 0
    217   // seems slower and less precise (and dangerous?)
    218   vDSP_mmul (s->data[0], 1, scale->data, 1, output->data, 1, s->height, 1, s->length);
    219 #else
    220   uint_t k;
    221   for (k = 0; k < s->height; k++) {
    222     aubio_vDSP_dotpr( scale->data, 1, s->data[k], 1, &(output->data[k]), scale->length);
    223   }
    224 #endif
    225 #endif
    226 }
  • src/fmat.h

    r057ecee r65a4fb4  
    161161   \param s matrix to compute product with
    162162   \param scale vector to compute product with
    163    \param output vector of results
    164 
     163   \param output vector to store restults in
    165164
    166165*/
    167166void fmat_vecmul(const fmat_t *s, const fvec_t *scale, fvec_t *output);
    168 
    169 /** compute the product of a vector by a matrix
    170 
    171    \param s matrix to compute product with
    172    \param scale input to compute product with
    173    \param output vector of results
    174 
    175 */
    176 void fvec_matmul(const fvec_t *scale, const fmat_t *s, fvec_t *output);
    177167
    178168#ifdef __cplusplus
  • src/fvec.c

    r057ecee r65a4fb4  
    9999}
    100100
    101 void fvec_vecadd(fvec_t *s, const fvec_t *bias) {
    102   uint_t j;
    103   uint_t length = MIN(s->length, bias->length);
    104   for (j = 0; j < length; j++) {
    105     s->data[j] += bias->data[j];
    106   }
    107 }
    108 
    109101void fvec_weight(fvec_t *s, const fvec_t *weight) {
    110102  uint_t length = MIN(s->length, weight->length);
  • src/fvec.h

    r057ecee r65a4fb4  
    144144void fvec_rev(fvec_t *s);
    145145
    146 /** add a vector b to vector a, modifying a
    147 
    148   \param a  input vector to add b to
    149   \param b  input vector of the values to be added to a
    150 
    151   Upon return, he content of a[i] will be set to a[i] + b[i].
    152 
    153 */
    154 void fvec_vecadd(fvec_t *a, const fvec_t *b);
    155 
    156146/** apply weight to vector
    157147
  • src/pitch/pitch.c

    r057ecee r65a4fb4  
    4949  aubio_pitcht_yinfast,    /**< `yinfast`, YIN fast */
    5050  aubio_pitcht_specacf,    /**< `specacf`, Spectral autocorrelation */
    51   aubio_pitcht_crepe,      /**< `crepe`, convolutional neural network */
    5251  aubio_pitcht_default
    5352    = aubio_pitcht_yinfft, /**< `default` */
     
    10099static void aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
    101100static void aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
    102 static void aubio_pitch_do_crepe (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf);
    103101
    104102/* internal functions for frequency conversion */
     
    106104static smpl_t freqconvmidi (smpl_t f, uint_t samplerate, uint_t bufsize);
    107105static smpl_t freqconvpass (smpl_t f, uint_t samplerate, uint_t bufsize);
    108 
    109 typedef struct _aubio_pitch_crepe_t aubio_pitch_crepe_t;
    110 extern aubio_pitch_crepe_t *new_aubio_pitch_crepe(void);
    111 extern void aubio_pitch_crepe_do(aubio_pitch_crepe_t *t, fvec_t *input, fvec_t *out);
    112 extern void del_aubio_pitch_crepe(aubio_pitch_crepe_t *t);
    113 extern smpl_t aubio_pitch_crepe_get_confidence (aubio_pitch_crepe_t * o);
    114 uint_t aubio_pitch_crepe_set_tolerance(aubio_pitch_crepe_t * o, smpl_t
    115     tolerance);
    116 smpl_t aubio_pitch_crepe_get_tolerance (aubio_pitch_crepe_t * o);
    117106
    118107/* adapter to stack ibuf new samples at the end of buf, and trim `buf` to `bufsize` */
     
    144133  else if (strcmp (pitch_mode, "specacf") == 0)
    145134    pitch_type = aubio_pitcht_specacf;
    146   else if (strcmp (pitch_mode, "crepe") == 0)
    147     pitch_type = aubio_pitcht_crepe;
    148135  else if (strcmp (pitch_mode, "default") == 0)
    149136    pitch_type = aubio_pitcht_default;
     
    227214      aubio_pitchspecacf_set_tolerance (p->p_object, 0.85);
    228215      break;
    229     case aubio_pitcht_crepe:
    230       // TODO add resampling and blocking
    231       if (samplerate != 16000) {
    232         AUBIO_ERROR("pitch: crepe samplerate must be 16000Hz, got %d\n",
    233             samplerate);
    234         goto beach;
    235       }
    236       if (bufsize != 1024) {
    237         AUBIO_ERROR("pitch: crepe buffer size must be 1024, got %d\n",
    238             bufsize);
    239         goto beach;
    240       }
    241       p->buf = new_fvec (bufsize);
    242       p->p_object = new_aubio_pitch_crepe();
    243       if (!p->p_object) goto beach;
    244       p->detect_cb = aubio_pitch_do_crepe;
    245       p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitch_crepe_get_confidence;
    246       //aubio_pitch_crepe_set_tolerance (p->p_object, 0.85);
    247       break;
    248216    default:
    249217      break;
     
    292260      del_fvec (p->buf);
    293261      del_aubio_pitchspecacf (p->p_object);
    294       break;
    295     case aubio_pitcht_crepe:
    296       del_fvec (p->buf);
    297       del_aubio_pitch_crepe (p->p_object);
    298262      break;
    299263    default:
     
    386350      aubio_pitchyinfast_set_tolerance (p->p_object, tol);
    387351      break;
    388     case aubio_pitcht_crepe:
    389       aubio_pitch_crepe_set_tolerance (p->p_object, tol);
    390       break;
    391352    default:
    392353      break;
     
    408369    case aubio_pitcht_yinfast:
    409370      tolerance = aubio_pitchyinfast_get_tolerance (p->p_object);
    410       break;
    411     case aubio_pitcht_crepe:
    412       tolerance = aubio_pitch_crepe_get_tolerance (p->p_object);
    413371      break;
    414372    default:
     
    521479
    522480void
    523 aubio_pitch_do_crepe (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
    524 {
    525   //smpl_t pitch = 0., period;
    526   aubio_pitch_slideblock (p, ibuf);
    527   aubio_pitch_crepe_do(p->p_object, p->buf, out);
    528   out->data[0] = aubio_miditofreq(out->data[0]);
    529 }
    530 
    531 void
    532481aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out)
    533482{
  • src/wscript_build

    r057ecee r65a4fb4  
    1313uselib += ['AVUTIL']
    1414uselib += ['BLAS']
    15 uselib += ['HDF5', 'HDF5_HL']
    1615
    1716source = ctx.path.ant_glob('*.c **/*.c')
  • wscript

    r057ecee r65a4fb4  
    9898            help_disable_str = 'do not compile source_wavwrite')
    9999
    100     add_option_enable_disable(ctx, 'hdf5', default = None,
    101             help_str = 'use libhdf5 (default)',
    102             help_disable_str = 'do not use libhdf5')
    103 
    104100    add_option_enable_disable(ctx, 'docs', default = None,
    105101            help_str = 'build documentation (auto)',
     
    464460    if (ctx.options.enable_memcpy == True):
    465461        ctx.define('HAVE_MEMCPY_HACKS', 1)
    466 
    467     if (ctx.options.enable_hdf5 != True):
    468         ctx.check_cfg(package='hdf5', args='--cflags --libs',
    469                 uselib_store='HDF5', mandatory=ctx.options.enable_hdf5)
    470         ctx.check(lib=['hdf5_hl'], use = ['HDF5'],
    471                 uselib_store='HDF5_HL', mandatory=ctx.options.enable_hdf5)
    472462
    473463    # write configuration header
Note: See TracChangeset for help on using the changeset viewer.