Changeset 1a74ac3


Ignore:
Timestamp:
Feb 4, 2011, 10:26:10 AM (9 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:
34422b4, 42515ac
Parents:
b583b9fb
Message:

src/mathutils.c: fix aubio_db_spl, thanks to Eric, closes #15

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    rb583b9fb r1a74ac3  
    215215    energy += SQR (f->data[j]);
    216216  }
    217   return energy;
     217  return energy / f->length;
    218218}
    219219
     
    450450aubio_db_spl (fvec_t * o)
    451451{
    452   smpl_t val = SQRT (fvec_local_energy (o));
    453   val /= (smpl_t) o->length;
    454   return LIN2DB (val);
     452  return 10. * LOG10 (fvec_local_energy (o));
    455453}
    456454
  • src/mathutils.h

    rb583b9fb r1a74ac3  
    107107/** compute the energy of a vector
    108108
    109   This function compute the sum of the squared elements of a vector.
     109  This function compute the sum of the squared elements of a vector, normalised
     110  by its length.
    110111 
    111112  \param v vector to get the energy from
  • src/pitch/pitchmcomb.c

    rb583b9fb r1a74ac3  
    112112    newmag->data[j] = fftgrain->norm[j];
    113113  /* detect only if local energy > 10. */
    114   //if (fvec_local_energy(newmag)>10.) {
     114  //if (fvec_local_energy(newmag) * newmag->length > 10.) {
    115115  //hfc = fvec_local_hfc(newmag); //not used
    116116  aubio_pitchmcomb_spectral_pp (p, newmag);
     
    147147    newmag->data[j] = fftgrain->norm[j];
    148148  /* detect only if local energy > 10. */
    149   if (fvec_local_energy (newmag) > 10.) {
     149  if (fvec_local_energy (newmag) * newmag->length > 10.) {
    150150    /* hfc = fvec_local_hfc(newmag); do not use */
    151151    aubio_pitchmcomb_spectral_pp (p, newmag);
Note: See TracChangeset for help on using the changeset viewer.