aubio: pitch/pitch.h File Reference

aubio 0.4.9

Loading...
Searching...
No Matches
Typedefs | Functions
pitch.h File Reference

Pitch detection object. More...

Go to the source code of this file.

## Typedefs
typedef struct _aubio_pitch_t | aubio_pitch_t

## Functions
void | aubio_pitch_do (aubio_pitch_t *o, const fvec_t *in, fvec_t *out)
| execute pitch detection on an input signal frame
uint_t | aubio_pitch_set_tolerance (aubio_pitch_t *o, smpl_t tol)
| change yin or yinfft tolerance threshold
smpl_t | aubio_pitch_get_tolerance (aubio_pitch_t *o)
| get yin or yinfft tolerance threshold
void | del_aubio_pitch (aubio_pitch_t *o)
| deletion of the pitch detection object
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
uint_t | aubio_pitch_set_unit (aubio_pitch_t *o, const char_t *mode)
| set the output unit of the pitch detection object
uint_t | aubio_pitch_set_silence (aubio_pitch_t *o, smpl_t silence)
| set the silence threshold of the pitch detection object
smpl_t | aubio_pitch_get_silence (aubio_pitch_t *o)
| set the silence threshold of the pitch detection object
smpl_t | aubio_pitch_get_confidence (aubio_pitch_t *o)
| get the current confidence

## Detailed Description

Pitch detection object.

This file creates the objects required for the computation of the selected pitch detection algorithm and output the results, in midi note or Hz.

# Pitch detection methods

A list of the pitch detection methods currently available follows.

`default` : use the default method

Currently, the default method is set to `yinfft` .

`schmitt` : Schmitt trigger

This pitch extraction method implements a Schmitt trigger to estimate the period of a signal.

This file was derived from the tuneit project, written by Mario Lang to detect the fundamental frequency of a sound.

See http://delysid.org/tuneit.html

`fcomb` : a fast harmonic comb filter

This pitch extraction method implements a fast harmonic comb filter to determine the fundamental frequency of a harmonic sound.

This file was derived from the tuneit project, written by Mario Lang to detect the fundamental frequency of a sound.

See http://delysid.org/tuneit.html

`mcomb` : multiple-comb filter

This fundamental frequency estimation algorithm implements spectral flattening, multi-comb filtering and peak histogramming.

This method was designed by Juan P. Bello and described in:

Juan-Pablo Bello. ``Towards the Automated Analysis of Simple Polyphonic Music''. PhD thesis, Centre for Digital Music, Queen Mary University of London, London, UK, 2003.

`yin` : YIN algorithm

This algorithm was developed by A. de Cheveigne and H. Kawahara and published in:

De Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930.

see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html

`yinfast` : Yinfast algorithm

This algorithm is equivalent to the YIN algorithm, but computed in the spectral domain for efficiency. See also python/demos/demo_yin_compare.py.

`yinfft` : Yinfft algorithm

This algorithm was derived from the YIN algorithm. In this implementation, a Fourier transform is used to compute a tapered square difference function, which allows spectral weighting. Because the difference function is tapered, the selection of the period is simplified.

Paul Brossier, Automatic annotation of musical audio for interactive systems, Chapter 3, Pitch Analysis, PhD thesis, Centre for Digital music, Queen Mary University of London, London, UK, 2006.

Definition in file pitch.h.

## Typedef Documentation

## ◆ aubio_pitch_t

typedef struct _aubio_pitch_t aubio_pitch_t

Definition at line 106 of file pitch.h.

## Function Documentation

## ◆ aubio_pitch_do()

void aubio_pitch_do | ( | aubio_pitch_t * | o,
|  | const fvec_t * | in,
|  | fvec_t * | out )

execute pitch detection on an input signal frame

Parameters

  o | pitch detection object as returned by new_aubio_pitch()
  in | input signal of size [hop_size]
  out | output pitch candidates of size [1]

Examples
  examples/aubiopitch.c, and pitch/test-pitch.c.

## ◆ aubio_pitch_get_confidence()

smpl_t aubio_pitch_get_confidence | ( | aubio_pitch_t * | o | ) |

get the current confidence

Parameters

  o | pitch detection object as returned by new_aubio_pitch()

Returns
  the current confidence of the pitch algorithm

## ◆ aubio_pitch_get_silence()

smpl_t aubio_pitch_get_silence | ( | aubio_pitch_t * | o | ) |

set the silence threshold of the pitch detection object

Parameters

  o | pitch detection object as returned by new_aubio_pitch()

Returns
  level threshold under which pitch should be ignored, in dB

## ◆ aubio_pitch_get_tolerance()

smpl_t aubio_pitch_get_tolerance | ( | aubio_pitch_t * | o | ) |

get yin or yinfft tolerance threshold

Parameters

  o | pitch detection object as returned by new_aubio_pitch()

Returns
  tolerance (default is 0.15 for yin and 0.85 for yinfft)

## ◆ aubio_pitch_set_silence()

uint_t aubio_pitch_set_silence | ( | aubio_pitch_t * | o,
|  | smpl_t | silence )

set the silence threshold of the pitch detection object

Parameters

  o | pitch detection object as returned by new_aubio_pitch()
  silence | level threshold under which pitch should be ignored, in dB

Returns
  0 if successfull, non-zero otherwise

Examples
  examples/aubiopitch.c, and pitch/test-pitch.c.

## ◆ aubio_pitch_set_tolerance()

uint_t aubio_pitch_set_tolerance | ( | aubio_pitch_t * | o,
|  | smpl_t | tol )

change yin or yinfft tolerance threshold

Parameters

  o | pitch detection object as returned by new_aubio_pitch()
  tol | tolerance default is 0.15 for yin and 0.85 for yinfft

Examples
  examples/aubiopitch.c, and pitch/test-pitch.c.

## ◆ aubio_pitch_set_unit()

uint_t aubio_pitch_set_unit | ( | aubio_pitch_t * | o,
|  | const char_t * | mode )

set the output unit of the pitch detection object

Parameters

  o | pitch detection object as returned by new_aubio_pitch()
  mode | set pitch units for output

mode can be one of "Hz", "midi", "cent", or "bin". Defaults to "Hz".

Returns
  0 if successfull, non-zero otherwise

Examples
  examples/aubiopitch.c, and pitch/test-pitch.c.

## ◆ del_aubio_pitch()

void del_aubio_pitch | ( | aubio_pitch_t * | o | ) |

deletion of the pitch detection object

Parameters

  o | pitch detection object as returned by new_aubio_pitch()

Examples
  examples/aubiopitch.c, and pitch/test-pitch.c.

## ◆ 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

Parameters

  method | set pitch detection algorithm
  buf_size | size of the input buffer to analyse
  hop_size | step size between two consecutive analysis instant
  samplerate | sampling rate of the signal

Returns
  newly created aubio_pitch_t

Examples
  examples/aubiopitch.c, and pitch/test-pitch.c.