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

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

Complex Domain Method onset detection function

Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain onset detection for musical signals. In Proceedings of the Digital Audio Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.

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

Definition at line 70 of file onsetdetection.c.

References CEXPC, _cvec_t::channels, _fvec_t::data, _aubio_onsetdetection_t::dev1, IMAG, _cvec_t::length, _aubio_onsetdetection_t::meas, _cvec_t::norm, _aubio_onsetdetection_t::oldmag, _cvec_t::phas, REAL, _aubio_onsetdetection_t::theta1, and _aubio_onsetdetection_t::theta2.

                                                                                                 {
      uint_t i, j;
      uint_t nbins = fftgrain->length;
      for (i=0;i<fftgrain->channels; i++) {
            onset->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]);
#ifdef HAVE_COMPLEX_H
                  o->meas[j] = fftgrain->norm[i][j]*CEXPC(I*o->dev1->data[i][j]);
                  /* sum on all bins */
                  onset->data[i][0]        += //(fftgrain->norm[i][j]);
                              SQRT(SQR( REAL(o->oldmag->data[i][j]-o->meas[j]) )
                                    +  SQR( IMAG(o->oldmag->data[i][j]-o->meas[j]) )
                                    );
#else
                  o->meas[j]             = (fftgrain->norm[i][j])*COS(o->dev1->data[i][j]);
                  o->meas[(nbins-1)*2-j] = (fftgrain->norm[i][j])*SIN(o->dev1->data[i][j]);
                  /* sum on all bins */
                  onset->data[i][0]        += //(fftgrain->norm[i][j]);
                              SQRT(SQR( (o->oldmag->data[i][j]-o->meas[j]) )
                                    +  SQR( (-o->meas[(nbins-1)*2-j]) )
                                    );
#endif
                  /* swap old phase data (need to remember 2 frames behind)*/
                  o->theta2->data[i][j] = o->theta1->data[i][j];
                  o->theta1->data[i][j] = fftgrain->phas[i][j];
                  /* swap old magnitude data (1 frame is enough) */
                  o->oldmag->data[i][j] = fftgrain->norm[i][j];
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index