Interface 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
      • getSubdominant

        Key getSubdominant()
        Subdominant.
        Returns:
        subdominant
        See Also:
        inc(int)
      • getDominant

        Key getDominant()
        Dominant.
        Returns:
        dominant
        See Also:
        inc(int)
      • 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 as inc(1). getSubdominant() is the same as inc(-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
      • 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
      • 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 profile
        chromagram - chromagram
        chromagramBase - tone/pitch of the first chromagram bin
        Returns:
        correlation coefficient