Package com.tagtraum.audiokern.key
Class Triad
- java.lang.Object
-
- com.tagtraum.audiokern.key.Triad
-
- All Implemented Interfaces:
Chord
public class Triad extends Object implements Chord
Triad.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tagtraum.audiokern.key.Chord
Chord.Type
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBeFormedFrom(Tone[] tones, int length)
Indicates whether an array of tones contains all the necessary tones to form this triad.boolean
contains(Tone tone)
boolean
equals(Object o)
static Triad
getCorrelatingChord(float[] chromagram, Tone baseTone)
Computes the triad with the highest correlation to the given chromagram.float
getCorrelation(float[] chromagram, Tone chromagramBase)
Computes the correlation of this chord (and type) to a chromagram with the given base tone.Tone
getRoot()
Tone[]
getTones()
Chord.Type
getType()
int
hashCode()
String
toString()
static Triad[]
values()
All possible triads.
-
-
-
Method Detail
-
values
public static Triad[] values()
All possible triads.- Returns:
- triads
-
getType
public Chord.Type getType()
-
getCorrelation
public float getCorrelation(float[] chromagram, Tone chromagramBase)
Description copied from interface:Chord
Computes the correlation of this chord (and type) to a chromagram with the given base tone.- Specified by:
getCorrelation
in interfaceChord
- Parameters:
chromagram
- chromagram- Returns:
- correlation coefficient
-
getCorrelatingChord
public static Triad getCorrelatingChord(float[] chromagram, Tone baseTone)
Computes the triad with the highest correlation to the given chromagram.- Parameters:
chromagram
- chromagrambaseTone
- base tone of the chromagram- Returns:
- triad with the highest correlation coefficient
-
canBeFormedFrom
public boolean canBeFormedFrom(Tone[] tones, int length)
Indicates whether an array of tones contains all the necessary tones to form this triad. The array may contain more than necessary tones.- Specified by:
canBeFormedFrom
in interfaceChord
- Parameters:
tones
- toneslength
- number of tones of the given tone array to take into account- Returns:
- true, if this triad can be formed from the given array of tones
-
-