Package com.tagtraum.audiokern.key
Enum MinorKey
- java.lang.Object
-
- java.lang.Enum<MinorKey>
-
- com.tagtraum.audiokern.key.MinorKey
-
- All Implemented Interfaces:
Key
,Serializable
,Comparable<MinorKey>
,org.json.simple.JSONAware
public enum MinorKey extends Enum<MinorKey> implements Key, Serializable, org.json.simple.JSONAware
Minor keys.- Author:
- Hendrik Schreiber
-
-
Enum Constant Summary
Enum Constants Enum Constant Description A_FLAT_MINOR
Ab minor.A_MINOR
A minor.B_FLAT_MINOR
Bb minor.B_MINOR
B minor.C_MINOR
C minor.D_FLAT_MINOR
Db minor.D_MINOR
D minor.E_FLAT_MINOR
Eb minor.E_MINOR
E minor.F_MINOR
F minor.F_SHARP_MINOR
F# minor.G_MINOR
G minor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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 theKey.getTonicParallel()
of theKey.getDominant()
.Key
getDominant()
Dominant.SeventhChord
getDominantSeventh()
String
getKeyCode()
Key code.Color
getKeyCodeColor()
Key code color.int
getKeyCodeNumeral()
Key code numeral.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
positiveDistance(Key nextKey)
Positive distance in semitones from this key to the given, next key.String
toJSONString()
String
toString()
static MinorKey
valueOf(String name)
Returns the enum constant of this type with the specified name.static MinorKey[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
A_MINOR
public static final MinorKey A_MINOR
A minor.
-
E_MINOR
public static final MinorKey E_MINOR
E minor.
-
B_MINOR
public static final MinorKey B_MINOR
B minor.
-
F_SHARP_MINOR
public static final MinorKey F_SHARP_MINOR
F# minor.
-
D_FLAT_MINOR
public static final MinorKey D_FLAT_MINOR
Db minor.
-
A_FLAT_MINOR
public static final MinorKey A_FLAT_MINOR
Ab minor.
-
E_FLAT_MINOR
public static final MinorKey E_FLAT_MINOR
Eb minor.
-
B_FLAT_MINOR
public static final MinorKey B_FLAT_MINOR
Bb minor.
-
F_MINOR
public static final MinorKey F_MINOR
F minor.
-
C_MINOR
public static final MinorKey C_MINOR
C minor.
-
G_MINOR
public static final MinorKey G_MINOR
G minor.
-
D_MINOR
public static final MinorKey D_MINOR
D minor.
-
-
Method Detail
-
values
public static MinorKey[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MinorKey c : MinorKey.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MinorKey valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getTonic
public Tone getTonic()
Description copied from interface:Key
Tonic of this key.- Specified by:
getTonic
in interfaceKey
- Returns:
- tonic
- See Also:
Key.getTonicName()
,Key.getDominant()
,Key.getSubdominant()
-
getTonicName
public String getTonicName()
Description copied from interface:Key
Tonic name, guaranteed to be the "typical" name (as in Circle of fifths) for the key.- Specified by:
getTonicName
in interfaceKey
- Returns:
- tonic name
- See Also:
Key.getTonic()
-
getDominantSeventh
public SeventhChord getDominantSeventh()
- Specified by:
getDominantSeventh
in interfaceKey
- Returns:
- dominant seventh
-
isCompatible
public boolean isCompatible(Key key)
Description copied from interface: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.- Specified by:
isCompatible
in interfaceKey
- Returns:
- true or false
- See Also:
Key.getDominant()
,Key.getSubdominant()
,Key.getTonicParallel()
-
positiveDistance
public int positiveDistance(Key nextKey)
Description copied from interface:Key
Positive distance in semitones from this key to the given, next key.- Specified by:
positiveDistance
in interfaceKey
- Parameters:
nextKey
- next key- Returns:
- distance in semitones
- See Also:
Tone.positiveDistance(Tone)
-
negativeDistance
public int negativeDistance(Key nextKey)
Description copied from interface:Key
Negative distance in semitones from this key to the given, next key.- Specified by:
negativeDistance
in interfaceKey
- Parameters:
nextKey
- next key- Returns:
- distance in semitones
- See Also:
Tone.negativeDistance(Tone)
-
isMajor
public boolean isMajor()
Description copied from interface:Key
Is this a major key?
-
isMinor
public boolean isMinor()
Description copied from interface:Key
Is this a minor key?
-
getSubdominant
public Key getSubdominant()
Description copied from interface:Key
Subdominant.- Specified by:
getSubdominant
in interfaceKey
- Returns:
- subdominant
- See Also:
Key.inc(int)
-
getDominant
public Key getDominant()
Description copied from interface:Key
Dominant.- Specified by:
getDominant
in interfaceKey
- Returns:
- dominant
- See Also:
Key.inc(int)
-
inc
public Key inc(int fifths)
Description copied from interface:Key
Increase key by the given number of fifths. This allows to travel easily around the circle of fifths.Key.getDominant()
is the same asinc(1)
.Key.getSubdominant()
is the same asinc(-1)
.
-
incBySemitones
public Key incBySemitones(int semitones)
Description copied from interface:Key
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.- Specified by:
incBySemitones
in interfaceKey
- Parameters:
semitones
- number of semitones- Returns:
- shifted key
- See Also:
Tempo.incBySemitones(int)
-
getTonicParallel
public Key getTonicParallel()
Description copied from interface:Key
Tonic parallel, i.e. major to minor or vice versa.- Specified by:
getTonicParallel
in interfaceKey
- Returns:
- tonic parallel
-
getDiagonal
public Key getDiagonal()
Description copied from interface:Key
If major, this returns theKey.getTonicParallel()
of theKey.getDominant()
. If minor, this returns theKey.getTonicParallel()
of theKey.getSubdominant()
. On the circle of fifths this is an harmonic diagonal transition.- Specified by:
getDiagonal
in interfaceKey
- Returns:
- diagonal key
-
getWallClockCodeNumeral
public int getWallClockCodeNumeral()
Description copied from interface:Key
Wall clock position in the circle of fifths (C Major at 12 o'clock).- Specified by:
getWallClockCodeNumeral
in interfaceKey
- Returns:
- key code numeral (1-12)
- See Also:
Key.getWallClockKeyCode()
-
getCorrelation
public float getCorrelation(KeyProfile profile, float[] chromagram, Tone chromagramBase)
Description copied from interface:Key
Calculates the Pearson correlation coefficient between this key and the given chromagram using the provided profile.- Specified by:
getCorrelation
in interfaceKey
- Parameters:
profile
- key profilechromagram
- chromagramchromagramBase
- tone/pitch of the first chromagram bin- Returns:
- correlation coefficient
-
getKeyCodeNumeral
public int getKeyCodeNumeral()
Description copied from interface:Key
Key code numeral.- Specified by:
getKeyCodeNumeral
in interfaceKey
- Returns:
- key code numeral (1-12)
-
getOpenKeyCodeNumeral
public int getOpenKeyCodeNumeral()
Description copied from interface:Key
Position on the circle of fifths, clockwise, starting with C major = 1 for major keys and A minor = 1 for minor keys.- Specified by:
getOpenKeyCodeNumeral
in interfaceKey
- Returns:
- open key code numeral (1-12)
- See Also:
Key.getOpenKeyCode()
-
getKeyCode
public String getKeyCode()
Description copied from interface:Key
Key code.- Specified by:
getKeyCode
in interfaceKey
- Returns:
- key code 1-12[A|B]
-
getWallClockKeyCode
public String getWallClockKeyCode()
Description copied from interface:Key
Wall clock key code.- Specified by:
getWallClockKeyCode
in interfaceKey
- Returns:
- key code 1-12[M|m]
-
getOpenKeyCode
public String getOpenKeyCode()
Description copied from interface:Key
Open key code, followed by either d (German dur, Latin durus, Engl. major) or m (German moll, Latin mollis, Engl. minor).- Specified by:
getOpenKeyCode
in interfaceKey
- Returns:
- open key code 1-12[d|m]
- See Also:
Key.getOpenKeyCodeNumeral()
-
getKeyCodeColor
public Color getKeyCodeColor()
Description copied from interface:Key
Key code color.- Specified by:
getKeyCodeColor
in interfaceKey
- Returns:
- key code color
-
getTKey
public String getTKey()
Description copied from interface:Key
Id3 representation of this key.
-
toJSONString
public String toJSONString()
- Specified by:
toJSONString
in interfaceorg.json.simple.JSONAware
-
-