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 booleancanBeFormedFrom(Tone[] tones, int length)Indicates whether an array of tones contains all the necessary tones to form this triad.booleancontains(Tone tone)booleanequals(Object o)static TriadgetCorrelatingChord(float[] chromagram, Tone baseTone)Computes the triad with the highest correlation to the given chromagram.floatgetCorrelation(float[] chromagram, Tone chromagramBase)Computes the correlation of this chord (and type) to a chromagram with the given base tone.TonegetRoot()Tone[]getTones()Chord.TypegetType()inthashCode()StringtoString()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:ChordComputes the correlation of this chord (and type) to a chromagram with the given base tone.- Specified by:
getCorrelationin 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:
canBeFormedFromin 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
-
-