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

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

Phase Based Method onset detection function

Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset detection for music signals. In Proceedings of the IEEE International Conference on Acoustics Speech and Signal Processing, pages 441­444, Hong-Kong, 2003.

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

Definition at line 107 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, _cvec_t::phas, _aubio_onsetdetection_t::theta1, _aubio_onsetdetection_t::theta2, 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;
            o->dev1->data[i][0]=0.;
            for ( j=0;j<nbins; j++ )      {
                  o->dev1->data[i][j] = 
                        aubio_unwrap2pi(
                                    fftgrain->phas[i][j]
                                    -2.0*o->theta1->data[i][j]
                                    +o->theta2->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;
                  /* keep a track of the past frames */
                  o->theta2->data[i][j] = o->theta1->data[i][j];
                  o->theta1->data[i][j] = fftgrain->phas[i][j];
            }
            /* apply o->histogram */
            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); 
            //onset->data[i][0] = vec_mean(o->dev1);
      }
}


Generated by  Doxygen 1.6.0   Back to index