Class SimpleChordSequence

All Implemented Interfaces:
Serializable, Cloneable, Comparable<ChordSequence>, Iterable<CLI_ChordSymbol>, Collection<CLI_ChordSymbol>, NavigableSet<CLI_ChordSymbol>, Set<CLI_ChordSymbol>, SortedSet<CLI_ChordSymbol>

public class SimpleChordSequence extends ChordSequence
A ChordSequence which has only one TimeSignature.

User is responsible to ensure CLI_ChordSymbols are added in the right position order, in the startBar/nbBars range, and are compatible with the TimeSignature.

See Also:
  • Constructor Details

    • SimpleChordSequence

      public SimpleChordSequence(IntRange barRange, TimeSignature ts)
    • SimpleChordSequence

      public SimpleChordSequence(ChordSequence cSeq, TimeSignature ts)
      Construct a SimpleChordSequence from a standard ChordSequence.
      Parameters:
      cSeq - All ChordSymbols are checked to be compatible with the specified TimeSignature.
      ts -
  • Method Details

    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<CLI_ChordSymbol>
      Specified by:
      hashCode in interface Set<CLI_ChordSymbol>
      Overrides:
      hashCode in class ChordSequence
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Collection<CLI_ChordSymbol>
      Specified by:
      equals in interface Set<CLI_ChordSymbol>
      Overrides:
      equals in class ChordSequence
    • getTimeSignature

      public TimeSignature getTimeSignature()
    • getBeatRange

      public FloatRange getBeatRange(float startBarPosInBeats)
      The beat range of this SimpleChordSequence provided it starts at startBarPosInBeats.
      Parameters:
      startBarPosInBeats -
      Returns:
    • getChordDuration

      public float getChordDuration(CLI_ChordSymbol cliCs)
      Return the specified chord duration in natural beats.

      This is the duration until next chord or the end of the chordsequence.

      Parameters:
      cliCs -
      Returns:
    • toPositionInBeats

      public float toPositionInBeats(Position pos, float startBarPosInBeats)
      Convert the specified position into an absolute position in natural beats.
      Parameters:
      pos -
      startBarPosInBeats - The start position of this chord sequence.
      Returns:
      If pos is beyond the end of this ChordSequence, then returned value will also be beyond this ChordSequence.
    • subSequence

      public SimpleChordSequence subSequence(IntRange subRange, boolean addInitChordSymbol)
      Overridden to return a SimpleChordSequence.
      Overrides:
      subSequence in class ChordSequence
      Parameters:
      subRange -
      addInitChordSymbol -
      Returns:
    • getRootProfile

      public String getRootProfile()
      A String which combines the relative root ascending intervals and chord durations, to allow a quick comparison between 2 SimpleChordSequences.

      If 2 root profiles of 2 SimpleChordSequences are equal, it means that the 2 ChordSequences have the same size, same number of ChordSymbols at the same position, and that the root relative root ascending intervals are equals, like for e.g. |Dm|G7|C7M|%| and |E7|Am|Dm|%|.

      Example: |Dm|G7|Ab7M|%| will produce "s4n3f0:a4i5:a4i1"
      "s4" = size is 4 bars
      "n3" = there is 3 chord symbols
      "f0" = first chord symbol position is on beat 0 of the chord sequence
      "a4i5" means advance 4 beats to next chord with a root ascending relative interval of 5 semi-tons.

      Example: if chord sequence is empty, return a string like "s4n0".

      Example: if chord sequence has only 1 chord symbol, return a string like "s4n1f0".

      Returns:
      A String like "s4n3f0:a4i5:a4i1"
      See Also:
    • getRootProfileOneChordPerBar

      public static String getRootProfileOneChordPerBar(TimeSignature ts, int... rootAscendingIntervals)
      Generate a root profile for a chord progression with 1 chord per bar and the specified root ascending intervals.

      Example: if rootAscendingIntervals=[8;4] and ts is 4/4, return "s3n3f0:a4i8:a4i4" (3 chord symbols, one per bar).

      Parameters:
      ts - The TimeSignature to use
      rootAscendingIntervals - Number of values is (number of chords - 1). Can't be empty.
      Returns:
    • getChordTypeSimilarityIndex

      public int getChordTypeSimilarityIndex(SimpleChordSequence cSeq)
      Compute an index which indicates how similar are the chord types of cSeq and this object.

      Parameters:
      cSeq - Must have the same number of chord symbols than this Simple ChordSequence.
      Returns:
      The sum of ChordType.getSimilarityIndex() run on each chord.
      See Also: