- Timestamp:
- Mar 8, 2014, 9:30:49 PM (11 years ago)
- 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
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
r1e18df6 r7380327 1 1 /* 2 Copyright (C) 2003-201 3Paul Brossier <piem@aubio.org>2 Copyright (C) 2003-2014 Paul Brossier <piem@aubio.org> 3 3 4 4 This file is part of aubio. … … 430 430 } 431 431 432 smpl_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 432 443 uint_t fvec_peakpick(fvec_t * onset, uint_t pos) { 433 444 uint_t tmp=0; -
src/mathutils.h
r1e18df6 r7380327 1 1 /* 2 Copyright (C) 2003-201 3Paul Brossier <piem@aubio.org>2 Copyright (C) 2003-2014 Paul Brossier <piem@aubio.org> 3 3 4 4 This file is part of aubio. … … 235 235 smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t p); 236 236 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 */ 248 smpl_t fvec_quadratic_peak_mag (fvec_t * x, smpl_t p); 249 237 250 /** Quadratic interpolation using Lagrange polynomial. 238 251
Note: See TracChangeset
for help on using the changeset viewer.