public final class Annotation extends java.lang.Object implements java.lang.Comparable<Annotation>
Constructor and Description |
---|
Annotation(double timeStamp,
double pitchInHz,
PitchDetectionMode annotationSource)
Create a new annotation with the given data.
|
Annotation(double timeStamp,
double pitchInHz,
PitchDetectionMode annotationSource,
double salience)
Create a new annotation with the given data.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Annotation o) |
boolean |
equals(java.lang.Object o) |
double |
getPitch(PitchUnit unit)
Return the pitch in the requested unit.
|
double |
getProbability()
The probability for the annotation.
|
PitchDetectionMode |
getSource() |
double |
getStart()
Returns the starting time in seconds.
|
int |
hashCode() |
static Annotation |
parse(java.lang.String line)
Parses an annotation as written by the toString() method.
|
static double |
percentAnnotated(java.util.List<Annotation> annotations,
double audioLenght)
Calculates a maximum possible number of annotations and compares it with
the actual number of annotations.
|
java.lang.String |
toString() |
public Annotation(double timeStamp, double pitchInHz, PitchDetectionMode annotationSource, double salience)
timeStamp
- The starting time (in seconds).pitchInHz
- The pitch in Hz.annotationSource
- The source of the annotation.salience
- A probability between zero and one (inclusive) defining the
saliance of the pitch.public Annotation(double timeStamp, double pitchInHz, PitchDetectionMode annotationSource)
timeStamp
- The starting time (in seconds).pitchInHz
- The pitch in Hz.annotationSource
- The source of the annotation.public double getStart()
public PitchDetectionMode getSource()
public double getProbability()
public double getPitch(PitchUnit unit)
unit
- The unit requested.public int compareTo(Annotation o)
compareTo
in interface java.lang.Comparable<Annotation>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static Annotation parse(java.lang.String line)
line
- The line to parse.public static double percentAnnotated(java.util.List<Annotation> annotations, double audioLenght)
annotations
- A list of annotations for an audio file.audioLenght
- The length of the annotated audio.