be.hogent.tarsos.sampled.pitch
Class TarsosPitchDetection

java.lang.Object
  extended by be.hogent.tarsos.sampled.pitch.TarsosPitchDetection
All Implemented Interfaces:
PitchDetector

public final class TarsosPitchDetection
extends java.lang.Object
implements PitchDetector

Author:
Joren Six

Constructor Summary
TarsosPitchDetection(AudioFile audioFile, PitchDetectionMode pitchDetectionMode)
           
 
Method Summary
 java.util.List<Annotation> executePitchDetection()
          Execute the pitch detection process.
 java.util.List<Annotation> getAnnotations()
           
 java.lang.String getName()
           
static void processFile(java.lang.String fileName, PitchDetectionMode detectionMode, AnnotationHandler detectedPitchHandler)
          Annotate a file with pitch information.
static void processStream(javax.sound.sampled.AudioInputStream ais, AnnotationHandler detectedPitchHandler, PitchDetectionMode detectionMode)
          Annotate an audio stream: useful for real-time pitch tracking.
 double progress()
          Calculate and return an indicator for progress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TarsosPitchDetection

public TarsosPitchDetection(AudioFile audioFile,
                            PitchDetectionMode pitchDetectionMode)
Method Detail

executePitchDetection

public java.util.List<Annotation> executePitchDetection()
Description copied from interface: PitchDetector
Execute the pitch detection process.

Specified by:
executePitchDetection in interface PitchDetector
Returns:
Returns a list of detected pitches, encapsulated in an annotation object.

getName

public java.lang.String getName()
Specified by:
getName in interface PitchDetector
Returns:
the name of the detector possibly with parameters e.g. aubio_YIN

getAnnotations

public java.util.List<Annotation> getAnnotations()
Specified by:
getAnnotations in interface PitchDetector
Returns:
a list of annotated samples

processFile

public static void processFile(java.lang.String fileName,
                               PitchDetectionMode detectionMode,
                               AnnotationHandler detectedPitchHandler)
                        throws javax.sound.sampled.UnsupportedAudioFileException,
                               java.io.IOException
Annotate a file with pitch information.

Parameters:
fileName - the file to annotate.
detectedPitchHandler - handles the pitch information.
detectionMode - Defines the detection mode used.
Throws:
javax.sound.sampled.UnsupportedAudioFileException - Currently only WAVE files with one channel (MONO) are supported.
java.io.IOException - If there is an error reading the file.

processStream

public static void processStream(javax.sound.sampled.AudioInputStream ais,
                                 AnnotationHandler detectedPitchHandler,
                                 PitchDetectionMode detectionMode)
                          throws javax.sound.sampled.UnsupportedAudioFileException,
                                 java.io.IOException
Annotate an audio stream: useful for real-time pitch tracking.

Parameters:
ais - The audio input stream.
detectedPitchHandler - Handles the pitch information.
detectionMode - Defines the detection mode used.
Throws:
javax.sound.sampled.UnsupportedAudioFileException - Currently only WAVE streams with one channel (MONO) are supported.
java.io.IOException - If there is an error reading the stream.

progress

public double progress()
Description copied from interface: PitchDetector
Calculate and return an indicator for progress.

Specified by:
progress in interface PitchDetector
Returns:
A value between 0.0 and 100. Indicating the progress made in percentage. Or -1 if the task has an indeterminate duration.