andrew@0: /* andrew@0: Copyright (C) 2003 Paul Brossier andrew@0: andrew@0: This program is free software; you can redistribute it and/or modify andrew@0: it under the terms of the GNU General Public License as published by andrew@0: the Free Software Foundation; either version 2 of the License, or andrew@0: (at your option) any later version. andrew@0: andrew@0: This program is distributed in the hope that it will be useful, andrew@0: but WITHOUT ANY WARRANTY; without even the implied warranty of andrew@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrew@0: GNU General Public License for more details. andrew@0: andrew@0: You should have received a copy of the GNU General Public License andrew@0: along with this program; if not, write to the Free Software andrew@0: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. andrew@0: andrew@0: */ andrew@0: andrew@0: /** \file andrew@0: andrew@0: Onset detection functions andrew@0: andrew@0: All of the following onset detection function take as arguments the FFT of a andrew@0: windowed signal (as created with aubio_pvoc). They output one smpl_t per andrew@0: buffer and per channel (stored in a vector of size [channels]x[1]). andrew@0: andrew@0: These functions were first adapted from Juan Pablo Bello's code, and now andrew@0: include further improvements and modifications made within aubio. andrew@0: andrew@0: */ andrew@0: andrew@0: andrew@0: #ifndef ONSETDETECTION_H andrew@0: #define ONSETDETECTION_H andrew@0: andrew@0: #ifdef __cplusplus andrew@0: extern "C" { andrew@0: #endif andrew@0: andrew@0: /** onsetdetection types */ andrew@0: typedef enum { andrew@0: aubio_onset_energy, /**< energy based */ andrew@0: aubio_onset_specdiff, /**< spectral diff */ andrew@0: aubio_onset_hfc, /**< high frequency content */ andrew@0: aubio_onset_complex, /**< complex domain */ andrew@0: aubio_onset_phase, /**< phase fast */ andrew@0: aubio_onset_kl, /**< Kullback Liebler */ andrew@0: aubio_onset_mkl /**< modified Kullback Liebler */ andrew@0: } aubio_onsetdetection_type; andrew@0: andrew@0: /** onsetdetection structure */ andrew@0: typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t; andrew@0: /** Energy based onset detection function andrew@0: andrew@0: This function calculates the local energy of the input spectral frame. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input spectral frame andrew@0: \param onset output onset detection function andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** High Frequency Content onset detection function andrew@0: andrew@0: This method computes the High Frequency Content (HFC) of the input spectral andrew@0: frame. The resulting function is efficient at detecting percussive onsets. andrew@0: andrew@0: Paul Masri. Computer modeling of Sound for Transformation and Synthesis of andrew@0: Musical Signal. PhD dissertation, University of Bristol, UK, 1996. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input spectral frame andrew@0: \param onset output onset detection function andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** Complex Domain Method onset detection function andrew@0: andrew@0: Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain andrew@0: onset detection for musical signals. In Proceedings of the Digital Audio andrew@0: Effects Conference, DAFx-03, pages 90-93, London, UK, 2003. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input spectral frame andrew@0: \param onset output onset detection function andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** Phase Based Method onset detection function andrew@0: andrew@0: Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset andrew@0: detection for music signals. In Proceedings of the IEEE International andrew@0: Conference on Acoustics Speech and Signal Processing, pages 441­444, andrew@0: Hong-Kong, 2003. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input spectral frame andrew@0: \param onset output onset detection function andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** Spectral difference method onset detection function andrew@0: andrew@0: Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to andrew@0: rhythm analysis. In IEEE International Conference on Multimedia and Expo andrew@0: (ICME 2001), pages 881­884, Tokyo, Japan, August 2001. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input spectral frame andrew@0: \param onset output onset detection function andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** Kullback-Liebler onset detection function andrew@0: andrew@0: Stephen Hainsworth and Malcom Macleod. Onset detection in music audio andrew@0: signals. In Proceedings of the International Computer Music Conference andrew@0: (ICMC), Singapore, 2003. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input spectral frame andrew@0: \param onset output onset detection function andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** Modified Kullback-Liebler onset detection function andrew@0: andrew@0: Paul Brossier, ``Automatic annotation of musical audio for interactive andrew@0: systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital andrew@0: music, Queen Mary University of London, London, UK, 2006. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input spectral frame andrew@0: \param onset output onset detection function andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** execute onset detection function on a spectral frame andrew@0: andrew@0: Generic function to compute onset detection. andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: \param fftgrain input signal spectrum as computed by aubio_pvoc_do andrew@0: \param onset output vector (one sample long, to send to the peak picking) andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); andrew@0: /** creation of an onset detection object andrew@0: andrew@0: \param type onset detection mode andrew@0: \param size length of the input spectrum frame andrew@0: \param channels number of input channels andrew@0: andrew@0: */ andrew@0: aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, ba_uint_t size, ba_uint_t channels); andrew@0: /** deletion of an onset detection object andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: andrew@0: */ andrew@0: void del_aubio_onsetdetection(aubio_onsetdetection_t *o); andrew@0: /** deletion of an onset detection object (obsolete) andrew@0: andrew@0: \param o onset detection object as returned by new_aubio_onsetdetection() andrew@0: andrew@0: */ andrew@0: void aubio_onsetdetection_free(aubio_onsetdetection_t *o); andrew@0: andrew@0: andrew@0: #ifdef __cplusplus andrew@0: } andrew@0: #endif andrew@0: andrew@0: #endif /* ONSETDETECTION_H */