Changeset 7380327 for src/mathutils.c


Ignore:
Timestamp:
Mar 8, 2014, 9:30:49 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
5fe5591
Parents:
1e18df6
Message:

src/mathutils.h: add fvec_quadratic_peak_mag to find the magnitude of interpolated peaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    r1e18df6 r7380327  
    11/*
    2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2003-2014 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    430430}
    431431
     432smpl_t fvec_quadratic_peak_mag (fvec_t *x, smpl_t pos) {
     433  smpl_t x0, x1, x2;
     434  uint_t index = (uint_t)(pos - .5) + 1;
     435  if (pos >= x->length || pos < 0.) return 0.;
     436  if ((smpl_t)index == pos) return x->data[index];
     437  x0 = x->data[index - 1];
     438  x1 = x->data[index];
     439  x2 = x->data[index + 1];
     440  return x1 - .25 * (x0 - x2) * (pos - index);
     441}
     442
    432443uint_t fvec_peakpick(fvec_t * onset, uint_t pos) {
    433444  uint_t tmp=0;
Note: See TracChangeset for help on using the changeset viewer.