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

void aubio_onsetdetection_specdiff ( aubio_onsetdetection_t o,
cvec_t fftgrain,
fvec_t onset 
)

Spectral difference method onset detection function

Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to rhythm analysis. In IEEE International Conference on Multimedia and Expo (ICME 2001), pages 881­884, Tokyo, Japan, August 2001.

Parameters:
o onset detection object as returned by new_aubio_onsetdetection()
fftgrain input spectral frame
onset output onset detection function

Definition at line 139 of file onsetdetection.c.

References _cvec_t::channels, _fvec_t::data, _aubio_onsetdetection_t::dev1, _aubio_onsetdetection_t::histog, _cvec_t::length, _cvec_t::norm, _aubio_onsetdetection_t::oldmag, and _aubio_onsetdetection_t::threshold.

                                              {
      uint_t i, j;
      uint_t nbins = fftgrain->length;
      for (i=0;i<fftgrain->channels; i++) {
            onset->data[i][0] = 0.0f;
            for (j=0;j<nbins; j++)  {
                  o->dev1->data[i][j] = SQRT(
                              ABS(SQR( fftgrain->norm[i][j])
                                    - SQR(o->oldmag->data[i][j])));
                  if (o->threshold < fftgrain->norm[i][j] )
                        o->dev1->data[i][j] = ABS(o->dev1->data[i][j]);
                  else 
                        o->dev1->data[i][j] = 0.0f;
                  o->oldmag->data[i][j] = fftgrain->norm[i][j];
            }

            /* apply o->histogram (act somewhat as a low pass on the
             * overall function)*/
            aubio_hist_dyn_notnull(o->histog,o->dev1);
            /* weight it */
            aubio_hist_weigth(o->histog);
            /* its mean is the result */
            onset->data[i][0] = aubio_hist_mean(o->histog); 

      }
}


Generated by  Doxygen 1.6.0   Back to index