Class ChordSymbolFinder

java.lang.Object
org.jjazz.harmony.api.ChordSymbolFinder

public class ChordSymbolFinder extends Object
Find matching chord symbol(s) from individual notes.
  • Field Details

  • Constructor Details

    • ChordSymbolFinder

      public ChordSymbolFinder(int maxNbNotes)
      Create an instance.
      Parameters:
      maxNbNotes - The maximum number of chord notes supported : 3, 4 or 5.
  • Method Details

    • getMaxNbNotes

      public int getMaxNbNotes()
      Returns:
      The maximum number of chord notes supported: 3, 4, or 5.
    • buildStaticData

      public static void buildStaticData()
      This must be called once before using any ChordFinder instance.

      The method may take up to 2 or 3 seconds on very slow computers to complete. If called more than once, does nothing.

    • getChordSymbol

      public ChordSymbol getChordSymbol(List<Note> notes, List<ChordSymbol> chordSymbols, boolean lowerNoteIsBass)
      Select one chord symbol from the provided chord symbols.

      If one of the chord symbols root matches the first pitch, it is returned. Otherwise return the most "common" chord symbol.

      Parameters:
      notes - The original notes which led to the chordSymbols, ordered by ascending pitch.
      chordSymbols - The ChordSymbols to choose from. Can't be empty.
      lowerNoteIsBass - For ex. G-C-E pitches will return C/G.
      Returns:
      See Also:
    • find

      public List<ChordSymbol> find(List<Note> notes)
      Find the chord symbols which match the specified notes.
      Parameters:
      notes -
      Returns:
      Can return max 4 chord symbols (e.g. for dim7 notes like C Eb Gb A)
    • computeIndex

      public static int computeIndex(List<Note> notes)
      Get the index in the positions database for the specified notes list.
      Parameters:
      notes -
      Returns: