Package com.tagtraum.audiokern.key
Interface Key
-
public interface Key
Key.- Author:
- Hendrik Schreiber
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description float
getCorrelation(KeyProfile profile, float[] chromagram, Tone chromagramBase)
Calculates the Pearson correlation coefficient between this key and the given chromagram using the provided profile.Key
getDiagonal()
If major, this returns thegetTonicParallel()
of thegetDominant()
.Key
getDominant()
Dominant.SeventhChord
getDominantSeventh()
String
getKeyCode()
Key code.Color
getKeyCodeColor()
Key code color.int
getKeyCodeNumeral()
Key code numeral.default Mode
getMode()
Mode.String
getOpenKeyCode()
Open key code, followed by either d (German dur, Latin durus, Engl.int
getOpenKeyCodeNumeral()
Position on the circle of fifths, clockwise, starting with C major = 1 for major keys and A minor = 1 for minor keys.Key
getSubdominant()
Subdominant.String
getTKey()
Id3 representation of this key.Tone[]
getTones()
Tones in this key.Tone
getTonic()
Tonic of this key.String
getTonicName()
Tonic name, guaranteed to be the "typical" name (as in Circle of fifths) for the key.Key
getTonicParallel()
Tonic parallel, i.e.Triad
getTriad()
Triad for this key.int
getWallClockCodeNumeral()
Wall clock position in the circle of fifths (C Major at 12 o'clock).String
getWallClockKeyCode()
Wall clock key code.Key
inc(int fifths)
Increase key by the given number of fifths.Key
incBySemitones(int semitones)
Return the key that would result in shifting all tones in this key by' the given number of semitones.boolean
isCompatible(Key key)
Indicates whether the given key is compatible to this key in the sense that one is either the sub/dominant or tonic parallel of the other.boolean
isMajor()
Is this a major key?boolean
isMinor()
Is this a minor key?int
negativeDistance(Key nextKey)
Negative distance in semitones from this key to the given, next key.int
ordinal()
int
positiveDistance(Key nextKey)
Positive distance in semitones from this key to the given, next key.
-
-
-
Method Detail
-
isMajor
boolean isMajor()
Is this a major key?- Returns:
true
, if the key is a major key
-
isMinor
boolean isMinor()
Is this a minor key?- Returns:
true
, if the key is a minor key
-
getMode
default Mode getMode()
Mode.- Returns:
- mode
-
inc
Key inc(int fifths)
Increase key by the given number of fifths. This allows to travel easily around the circle of fifths.getDominant()
is the same asinc(1)
.getSubdominant()
is the same asinc(-1)
.- Parameters:
fifths
- number of fifths- Returns:
- key
-
incBySemitones
Key incBySemitones(int semitones)
Return the key that would result in shifting all tones in this key by' the given number of semitones. Such a shift may result, when the audio is played back at a higher or lower speed.- Parameters:
semitones
- number of semitones- Returns:
- shifted key
- See Also:
Tempo.incBySemitones(int)
-
getTonicParallel
Key getTonicParallel()
Tonic parallel, i.e. major to minor or vice versa.- Returns:
- tonic parallel
-
getDiagonal
Key getDiagonal()
If major, this returns thegetTonicParallel()
of thegetDominant()
. If minor, this returns thegetTonicParallel()
of thegetSubdominant()
. On the circle of fifths this is an harmonic diagonal transition.- Returns:
- diagonal key
-
getWallClockCodeNumeral
int getWallClockCodeNumeral()
Wall clock position in the circle of fifths (C Major at 12 o'clock).- Returns:
- key code numeral (1-12)
- See Also:
getWallClockKeyCode()
-
getKeyCodeNumeral
int getKeyCodeNumeral()
Key code numeral.- Returns:
- key code numeral (1-12)
-
getOpenKeyCodeNumeral
int getOpenKeyCodeNumeral()
Position on the circle of fifths, clockwise, starting with C major = 1 for major keys and A minor = 1 for minor keys.- Returns:
- open key code numeral (1-12)
- See Also:
getOpenKeyCode()
-
getKeyCode
String getKeyCode()
Key code.- Returns:
- key code 1-12[A|B]
-
getWallClockKeyCode
String getWallClockKeyCode()
Wall clock key code.- Returns:
- key code 1-12[M|m]
-
getOpenKeyCode
String getOpenKeyCode()
Open key code, followed by either d (German dur, Latin durus, Engl. major) or m (German moll, Latin mollis, Engl. minor).- Returns:
- open key code 1-12[d|m]
- See Also:
getOpenKeyCodeNumeral()
-
getKeyCodeColor
Color getKeyCodeColor()
Key code color.- Returns:
- key code color
-
getTKey
String getTKey()
Id3 representation of this key.- Returns:
- id3 representation of this key
-
ordinal
int ordinal()
- Returns:
- ordinal
-
getTones
Tone[] getTones()
Tones in this key.- Returns:
- tones in this key
-
isCompatible
boolean isCompatible(Key key)
Indicates whether the given key is compatible to this key in the sense that one is either the sub/dominant or tonic parallel of the other.- Returns:
- true or false
- See Also:
getDominant()
,getSubdominant()
,getTonicParallel()
-
positiveDistance
int positiveDistance(Key nextKey)
Positive distance in semitones from this key to the given, next key.- Parameters:
nextKey
- next key- Returns:
- distance in semitones
- See Also:
Tone.positiveDistance(Tone)
-
negativeDistance
int negativeDistance(Key nextKey)
Negative distance in semitones from this key to the given, next key.- Parameters:
nextKey
- next key- Returns:
- distance in semitones
- See Also:
Tone.negativeDistance(Tone)
-
getTriad
Triad getTriad()
Triad for this key.- Returns:
- triad
-
getTonic
Tone getTonic()
Tonic of this key.- Returns:
- tonic
- See Also:
getTonicName()
,getDominant()
,getSubdominant()
-
getTonicName
String getTonicName()
Tonic name, guaranteed to be the "typical" name (as in Circle of fifths) for the key.- Returns:
- tonic name
- See Also:
getTonic()
-
getDominantSeventh
SeventhChord getDominantSeventh()
- Returns:
- dominant seventh
-
getCorrelation
float getCorrelation(KeyProfile profile, float[] chromagram, Tone chromagramBase)
Calculates the Pearson correlation coefficient between this key and the given chromagram using the provided profile.- Parameters:
profile
- key profilechromagram
- chromagramchromagramBase
- tone/pitch of the first chromagram bin- Returns:
- correlation coefficient
-
-