Changeset b799241


Ignore:
Timestamp:
Mar 10, 2017, 8:16:28 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler
Children:
d0f0d55
Parents:
b75f890
Message:

src/musicutils.h: add fvec_clamp, basic limiter

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    rb75f890 rb799241  
    298298}
    299299
     300void fvec_clamp(fvec_t *in, smpl_t absmax) {
     301  uint_t i;
     302  for (i = 0; i < in->length; i++) {
     303    if (in->data[i] > 0 && in->data[i] > ABS(absmax)) {
     304      in->data[i] = absmax;
     305    } else if (in->data[i] < 0 && in->data[i] < -ABS(absmax)) {
     306      in->data[i] = -absmax;
     307    }
     308  }
     309}
     310
    300311smpl_t
    301312aubio_level_lin (const fvec_t * f)
  • src/musicutils.h

    rb75f890 rb799241  
    157157smpl_t aubio_level_detection (const fvec_t * v, smpl_t threshold);
    158158
     159/** clamp the values of a vector within the range [-abs(max), abs(max)]
     160
     161  \param in vector to clamp
     162  \param max maximum value over which input vector elements should be clamped
     163
     164*/
     165void fvec_clamp(fvec_t *in, smpl_t absmax);
     166
    159167#ifdef __cplusplus
    160168}
Note: See TracChangeset for help on using the changeset viewer.