Changeset 7380327 for src


Ignore:
Timestamp:
Mar 8, 2014, 9:30:49 PM (11 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:
5fe5591
Parents:
1e18df6
Message:

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

Location:
src
Files:
2 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;
  • src/mathutils.h

    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.
     
    235235smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t p);
    236236
     237/** finds magnitude of peak by quadratic interpolation
     238
     239  See [Quadratic Interpolation of Spectral
     240  Peaks](https://ccrma.stanford.edu/~jos/sasp/Quadratic_Peak_Interpolation.html),
     241  by Julius O. Smith III
     242
     243  \param x vector to get the magnitude of the interpolated peak position from
     244  \param p index of the peak in vector `x`
     245  \return magnitude of interpolated peak
     246
     247*/
     248smpl_t fvec_quadratic_peak_mag (fvec_t * x, smpl_t p);
     249
    237250/** Quadratic interpolation using Lagrange polynomial.
    238251 
Note: See TracChangeset for help on using the changeset viewer.