aubio  0.4.1
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 (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, 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 /** set tempo detection peak picking threshold
00097 
00098   \param o beat tracking object
00099   \param threshold new threshold
00100 
00101   \return `0` if successful, non-zero otherwise
00102 
00103 */
00104 uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold);
00105 
00106 /** get current tempo
00107 
00108   \param o beat tracking object
00109 
00110   \return the currently observed tempo, or `0` if no consistent value is found
00111 
00112 */
00113 smpl_t aubio_tempo_get_bpm(aubio_tempo_t * o);
00114 
00115 /** get current tempo confidence
00116 
00117   \param o beat tracking object
00118 
00119   \return confidence with which the tempo has been observed, `0` if no
00120   consistent value is found.
00121 
00122 */
00123 smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o);
00124 
00125 /** delete tempo detection object
00126 
00127   \param o beat tracking object
00128 
00129 */
00130 void del_aubio_tempo(aubio_tempo_t * o);
00131 
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135 
00136 #endif /* _AUBIO_TEMPO_H */
 All Data Structures Files Functions Variables Typedefs Defines