be.hogent.tarsos.dsp.pitch
Class DynamicWavelet

java.lang.Object
  extended by be.hogent.tarsos.dsp.pitch.DynamicWavelet
All Implemented Interfaces:
PitchDetector

public class DynamicWavelet
extends java.lang.Object
implements PitchDetector

The pitch is the main frequency of the waveform (the 'note' being played or sung). It is expressed as a float in Hz.

Unlike the human ear, pitch detection is difficult to achieve for computers. Many algorithms have been designed and experimented, but there is no 'best' algorithm. They all depend on the context and the tradeoffs acceptable in terms of speed and latency. The context includes the quality and 'cleanness' of the audio : obviously polyphonic sounds (multiple instruments playing different notes at the same time) are extremely difficult to track, percussive or noisy audio has no pitch, most real-life audio have some noisy moments, some instruments have a lot of harmonics, etc...

The dywapitchtrack is based on a custom-tailored algorithm which is of very high quality: both very accurate (precision < 0.05 semitones), very low latency (< 23 ms) and very low error rate. It has been thoroughly tested on human voice.

It can best be described as a dynamic wavelet algorithm (dywa):

The heart of the algorithm is a very powerful wavelet algorithm, described in a paper by Eric Larson and Ross Maddox "Real-Time Time-Domain Pitch Tracking Using Wavelets

Author:
Antoine Schmitt, Joren Six

Constructor Summary
DynamicWavelet(float sampleRate, int bufferSize)
           
 
Method Summary
 float getPitch(float[] audioBuffer)
          Analyzes a buffer with audio information and estimates a pitch in Hz.
 float getProbability()
          Some algorithms can calculate a probability (noisiness, (a)periodicity, salience, voicedness or clarity measure) for the detected pitch.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicWavelet

public DynamicWavelet(float sampleRate,
                      int bufferSize)
Method Detail

getPitch

public float getPitch(float[] audioBuffer)
Description copied from interface: PitchDetector
Analyzes a buffer with audio information and estimates a pitch in Hz. Currently this interface only allows one pitch per buffer.

Specified by:
getPitch in interface PitchDetector
Parameters:
audioBuffer - The buffer with audio information. The information in the buffer is not modified so it can be (re)used for e.g. FFT analysis.
Returns:
An estimation of the pitch in Hz or -1 if no pitch is detected or present in the buffer.

getProbability

public float getProbability()
Description copied from interface: PitchDetector
Some algorithms can calculate a probability (noisiness, (a)periodicity, salience, voicedness or clarity measure) for the detected pitch. This is somewhat similar to the term voiced which is used in speech recognition. This probability should be calculated together with the pitch but is returned using a call to this method. So if you want the probability of a buffer: first call getPitch(buffer) and then getProbability().

Specified by:
getProbability in interface PitchDetector
Returns:
A probability