Loading...
Searching...
No Matches
aubio

# Introduction

aubio is a library to extract annotations from audio signals: it provides a set of functions that take an input audio signal, and output pitch estimates, attack times (onset), beat location estimates, and other annotation tasks.

# Basics

All object structures in aubio share the same function prefixes and suffixes:

- `new_aubio_foo` creates the object `foo`
- `aubio_foo_do` executes the object `foo`
- `del_aubio_foo` destroys the object `foo`

All memory allocation and deallocation take place in the `new_` and `del_` functions. Optionally, more than one `_do` methods are available. Additional parameters can be adjusted and observed using:

- `aubio_foo_get_param`, getter function, gets the value of a parameter
- `aubio_foo_set_param`, setter function, changes the value of a parameter

Unless specified in its documentation, no memory operations take place in the getter functions. However, memory resizing can take place in setter functions.

## Vectors

Two basic structures are being used in aubio: fvec_t and cvec_t. The fvec_t structures are used to store vectors of floating pointer number. cvec_t are used to store complex number, as two vectors of norm and phase elements.

Additionally, the lvec_t structure can be used to store floating point numbers in double precision. They are mostly used to store filter coefficients, to avoid instability.

## Available objects

Here is a list of some of the most common objects for aubio:

// fast Fourier transform (FFT)
aubio_fft_t *fft = new_aubio_fft (winsize);
// phase vocoder
aubio_pvoc_t *pv = new_aubio_pvoc (winsize, stepsize);
// onset detection
aubio_onset_t *onset = new_aubio_onset (method, winsize, stepsize, samplerate);
// pitch detection
aubio_pitch_t *pitch = new_aubio_pitch (method, winsize, stepsize, samplerate);
// beat tracking
aubio_tempo_t *tempo = new_aubio_tempo (method, winsize, stepsize, samplerate);
new_aubio_fft
aubio_fft_t * new_aubio_fft(uint_t size)
create new FFT computation object
aubio_fft_t
struct _aubio_fft_t aubio_fft_t
FFT object.
Definition fft.h:46
aubio_onset_t
struct _aubio_onset_t aubio_onset_t
onset detection object
Definition onset.h:50
new_aubio_onset
aubio_onset_t * new_aubio_onset(const char_t *method, uint_t buf_size, uint_t hop_size, uint_t samplerate)
create onset detection object
aubio_pvoc_t
struct _aubio_pvoc_t aubio_pvoc_t
phasevocoder object
Definition phasevoc.h:42
new_aubio_pvoc
aubio_pvoc_t * new_aubio_pvoc(uint_t win_s, uint_t hop_s)
create phase vocoder object
new_aubio_pitch
aubio_pitch_t * new_aubio_pitch(const char_t *method, uint_t buf_size, uint_t hop_size, uint_t samplerate)
creation of the pitch detection object
new_aubio_tempo
aubio_tempo_t * new_aubio_tempo(const char_t *method, uint_t buf_size, uint_t hop_size, uint_t samplerate)
create tempo detection object
aubio_tempo_t
struct _aubio_tempo_t aubio_tempo_t
tempo detection structure
Definition tempo.h:41

See the list of typedefs for a complete list.

## Example

Here is a simple example that creates an A-Weighting filter and applies it to a vector.

// set window size, and sampling rate
uint_t winsize = 1024, sr = 44100;
// create a vector
fvec_t *this_buffer = new_fvec (winsize);
// create the a-weighting filter
aubio_filter_t *this_filter = new_aubio_filter_a_weighting (sr);
while (running) {
// here some code to put some data in this_buffer
// ...
// apply the filter, in place
aubio_filter_do (this_filter, this_buffer);
// here some code to get some data from this_buffer
// ...
}
// and free the structures
del_aubio_filter (this_filter);
del_fvec (this_buffer);
new_aubio_filter_a_weighting
aubio_filter_t * new_aubio_filter_a_weighting(uint_t samplerate)
create new A-design filter
aubio_filter_t
struct _aubio_filter_t aubio_filter_t
Digital filter.
Definition filter.h:72
del_aubio_filter
void del_aubio_filter(aubio_filter_t *f)
delete a filter object
aubio_filter_do
void aubio_filter_do(aubio_filter_t *f, fvec_t *in)
filter input vector (in-place)
new_fvec
fvec_t * new_fvec(uint_t length)
fvec_t buffer creation function
del_fvec
void del_fvec(fvec_t *s)
fvec_t buffer deletion function
fvec_t
Buffer for real data.
Definition fvec.h:67
uint_t
unsigned int uint_t
unsigned integer
Definition types.h:60

Several examples of C programs are available in the `examples/` and `tests/src` directories of the source tree.

Some examples:

- spectral/test-fft.c
- spectral/test-phasevoc.c
- onset/test-onset.c
- pitch/test-pitch.c
- tempo/test-tempo.c
- test-fvec.c
- test-cvec.c

## Unstable API

Several more functions are available and used within aubio, but not documented here, either because they are not considered useful to the user, or because they may need to be changed in the future. However, they can still be used by defining AUBIO_UNSTABLE to 1 before including the aubio header:

#define AUBIO_UNSTABLE 1
#include <aubio/aubio.h>

Future versions of aubio could break API compatibility with these functions without warning. If you choose to use functions in AUBIO_UNSTABLE, you are on your own.

# Download

Latest versions, further documentation, examples, wiki, and mailing lists can be found at https://aubio.org .