Logo Search packages:      
Sourcecode: aubio version File versions  Download package

smpl_t aubio_level_detection ( fvec_t ibuf,
smpl_t  threshold 
)

get the current buffer level

returns level log(RMS(ibuf)) if < threshold, 1 otherwise

Bug:
mono

Definition at line 427 of file mathutils.c.

References _fvec_t::data, and _fvec_t::length.

                                                              {
  smpl_t loudness = 0;
  uint_t i=0,j;
  for (j=0;j<ibuf->length;j++) {
    loudness += SQR(ibuf->data[i][j]);
  }
  loudness = SQRT(loudness);
  loudness /= (smpl_t)ibuf->length;
  loudness = LIN2DB(loudness);

  if (loudness < threshold)
      return 1.;
  else
      return loudness;
}


Generated by  Doxygen 1.6.0   Back to index