Class TextReader

java.lang.Object
org.jjazz.importers.api.TextReader

public class TextReader extends Object
Read chord symbols from a multi-line text.

There are 3 possible formats to specify chords, GRID-BASED, BEAT-BASED or TIME-BASED.

GRID-BASED="|4/4 chord1 chord2 | chord3 | chord4|"
Use % in a bar to repeat the same chords from the previous bar. Bars can start with an optional time signature.
Example:
| C | F7 Eb7 | % | Db7 |
| C |    |3/4 Fm7 | Bb7 |

BEAT-BASED="bar, beat, chord_symbol"
bar and beat are 0-based by default.

Example:
0, 0, C
1, 0, F7
1, 1.5, Eb7
2, 0, D7
. ..

TIME-BASED="pos_in_seconds, chord_symbol"
The time signature and tempo must be set first so that pos_in_seconds can be converted into bar/beat. If not set, the default values are 4/4 and 120bpm.

Example:
timeSignature=3/4
tempoBPM=60
0, C
3, F7
4.5, Eb7
6, D7
. ..

OTHER FORMAT INFORMATION:
// Put comment after //
"title=My song name" : if specified the created song will use this title as name.
"useBase1" : if specified the bar/beat positions start at 1.
Accepted delimiter characters are ',', ';' or space or tab '|' can be replaced by '!' when importing text ("!C7 !D6 ! Gm ! !" is valid).

  • Constructor Details

  • Method Details

    • readSong

      public Song readSong()
      Get the song from the current text or file.

      Construct a Song from the textual elements.

      Returns:
      Can be null if no valid input was found
    • toText

      public static String toText(ChordLeadSheet cls, int nbBarsPerLine, boolean showInitialTimeSignature)
      Get a (possibly multiline) string representing the chord leadsheet e.g. "|4/4 C7 | Dm6 G7 | Ab7M | G7#5|".
      Parameters:
      cls -
      nbBarsPerLine -
      showInitialTimeSignature -
      Returns:
      A string which could be read by a TextReader.