aubio 0.4.5

tempo/tempo.h

Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2006-2013 Paul Brossier <piem@aubio.org>
00003 
00004   This file is part of aubio.
00005 
00006   aubio is free software: you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License as published by
00008   the Free Software Foundation, either version 3 of the License, or
00009   (at your option) any later version.
00010 
00011   aubio is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014   GNU General Public License for more details.
00015 
00016   You should have received a copy of the GNU General Public License
00017   along with aubio.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 /** \file
00022 
00023   Tempo detection object
00024 
00025   This object stores all the memory required for tempo detection algorithm
00026   and returns the estimated beat locations.
00027 
00028   \example tempo/test-tempo.c
00029   \example examples/aubiotrack.c
00030 
00031 */
00032 
00033 #ifndef AUBIO_TEMPO_H
00034 #define AUBIO_TEMPO_H
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 /** tempo detection structure */
00041 typedef struct _aubio_tempo_t aubio_tempo_t;
00042 
00043 /** create tempo detection object
00044 
00045   \param method beat tracking method, unused for now (use "default")
00046   \param buf_size length of FFT
00047   \param hop_size number of frames between two consecutive runs
00048   \param samplerate sampling rate of the signal to analyze
00049 
00050   \return newly created ::aubio_tempo_t if successful, `NULL` otherwise
00051 
00052 */
00053 aubio_tempo_t * new_aubio_tempo (const char_t * method,
00054     uint_t buf_size, uint_t hop_size, uint_t samplerate);
00055 
00056 /** execute tempo detection
00057 
00058   \param o beat tracking object
00059   \param input new samples
00060   \param tempo output beats
00061 
00062 */
00063 void aubio_tempo_do (aubio_tempo_t *o, const fvec_t * input, fvec_t * tempo);
00064 
00065 /** get the time of the latest beat detected, in samples
00066 
00067   \param o tempo detection object as returned by ::new_aubio_tempo
00068 
00069 */
00070 uint_t aubio_tempo_get_last (aubio_tempo_t *o);
00071 
00072 /** get the time of the latest beat detected, in seconds
00073 
00074   \param o tempo detection object as returned by ::new_aubio_tempo
00075 
00076 */
00077 smpl_t aubio_tempo_get_last_s (aubio_tempo_t *o);
00078 
00079 /** get the time of the latest beat detected, in milliseconds
00080 
00081   \param o tempo detection object as returned by ::new_aubio_tempo
00082 
00083 */
00084 smpl_t aubio_tempo_get_last_ms (aubio_tempo_t *o);
00085 
00086 /** set tempo detection silence threshold
00087 
00088   \param o beat tracking object
00089   \param silence new silence threshold, in dB
00090 
00091   \return `0` if successful, non-zero otherwise
00092 
00093 */
00094 uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence);
00095 
00096 /** get tempo detection silence threshold
00097 
00098   \param o tempo detection object as returned by new_aubio_tempo()
00099 
00100   \return current silence threshold
00101 
00102 */
00103 smpl_t aubio_tempo_get_silence(aubio_tempo_t * o);
00104 
00105 /** set tempo detection peak picking threshold
00106 
00107   \param o beat tracking object
00108   \param threshold new threshold
00109 
00110   \return `0` if successful, non-zero otherwise
00111 
00112 */
00113 uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold);
00114 
00115 /** get tempo peak picking threshold
00116 
00117   \param o tempo detection object as returned by new_aubio_tempo()
00118 
00119   \return current tempo detection threshold
00120 
00121 */
00122 smpl_t aubio_tempo_get_threshold(aubio_tempo_t * o);
00123 
00124 /** get current beat period in samples
00125 
00126   \param bt beat tracking object
00127 
00128   Returns the currently observed period, in samples, or 0 if no consistent
00129   value is found.
00130 
00131 */
00132 smpl_t aubio_tempo_get_period (aubio_tempo_t * bt);
00133 
00134 /** get current beat period in seconds
00135 
00136   \param bt beat tracking object
00137 
00138   Returns the currently observed period, in seconds, or 0 if no consistent
00139   value is found.
00140 
00141 */
00142 smpl_t aubio_tempo_get_period_s (aubio_tempo_t * bt);
00143 
00144 /** get current tempo
00145 
00146   \param o beat tracking object
00147 
00148   \return the currently observed tempo, or `0` if no consistent value is found
00149 
00150 */
00151 smpl_t aubio_tempo_get_bpm(aubio_tempo_t * o);
00152 
00153 /** get current tempo confidence
00154 
00155   \param o beat tracking object
00156 
00157   \return confidence with which the tempo has been observed, the higher the
00158   more confidence, `0` if no consistent value is found.
00159 
00160 */
00161 smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o);
00162 
00163 /** set number of tatum per beat
00164 
00165    \param o beat tracking object
00166    \param signature number of tatum per beat (between 1 and 64)
00167 
00168 */
00169 uint_t aubio_tempo_set_tatum_signature(aubio_tempo_t *o, uint_t signature);
00170 
00171 /** check whether a tatum was detected in the current frame
00172 
00173    \param o beat tracking object
00174 
00175    \return 2 if a beat was detected, 1 if a tatum was detected, 0 otherwise
00176 
00177 */
00178 uint_t aubio_tempo_was_tatum(aubio_tempo_t *o);
00179 
00180 /** get position of last_tatum, in samples
00181 
00182    \param o beat tracking object
00183 
00184 */
00185 smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o);
00186 
00187 /** get current delay
00188 
00189   \param o beat tracking object
00190 
00191   \return current delay, in samples
00192 
00193  */
00194 uint_t aubio_tempo_get_delay(aubio_tempo_t * o);
00195 
00196 /** get current delay in seconds
00197 
00198   \param o beat tracking object
00199 
00200   \return current delay, in seconds
00201 
00202  */
00203 smpl_t aubio_tempo_get_delay_s(aubio_tempo_t * o);
00204 
00205 /** get current delay in ms
00206 
00207   \param o beat tracking object
00208 
00209   \return current delay, in milliseconds
00210 
00211  */
00212 smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t * o);
00213 
00214 /** set current delay
00215 
00216   \param o beat tracking object
00217   \param delay delay to set tempo to, in samples
00218 
00219   \return `0` if successful, non-zero otherwise
00220 
00221  */
00222 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, sint_t delay);
00223 
00224 /** set current delay in seconds
00225 
00226   \param o beat tracking object
00227   \param delay delay to set tempo to, in seconds
00228 
00229   \return `0` if successful, non-zero otherwise
00230 
00231  */
00232 uint_t aubio_tempo_set_delay_s(aubio_tempo_t * o, smpl_t delay);
00233 
00234 /** set current delay
00235 
00236   \param o beat tracking object
00237   \param delay delay to set tempo to, in samples
00238 
00239   \return `0` if successful, non-zero otherwise
00240 
00241  */
00242 uint_t aubio_tempo_set_delay_ms(aubio_tempo_t * o, smpl_t delay);
00243 
00244 /** delete tempo detection object
00245 
00246   \param o beat tracking object
00247 
00248 */
00249 void del_aubio_tempo(aubio_tempo_t * o);
00250 
00251 #ifdef __cplusplus
00252 }
00253 #endif
00254 
00255 #endif /* AUBIO_TEMPO_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines