chordsheetjs
    Preparing search index...

    Class ChordProFormatter

    Formats a song into a ChordPro chord sheet

    Hierarchy (View Summary)

    Index

    Constructors

    • Instantiate

      Parameters

      • Optionalconfiguration: {
            decapo?: boolean;
            delegates?: { abc?: {}; grid?: {}; ly?: {}; tab?: {} };
            evaluate?: boolean;
            expandChorusDirective?: boolean;
            instrument?: { description?: string; type?: string } | null;
            key?:
                | {
                    accidental?: Accidental
                    | null;
                    canBeFlat?: {};
                    canBeSharp?: {};
                    changeGrade?: {};
                    clone?: {};
                    distanceTo?: {};
                    effectiveGrade?: number;
                    equals?: {};
                    explicitAccidental?: boolean;
                    grade?: number | null;
                    is?: {};
                    isChordSolfege?: {};
                    isChordSymbol?: {};
                    isMinor?: {};
                    isNumeral?: {};
                    isNumeric?: {};
                    makeMinor?: {};
                    minor?: boolean;
                    minorSign?: "" | "m";
                    modifier?: Accidental | null;
                    normalize?: {};
                    normalizeEnharmonics?: {};
                    note?: string;
                    number?: number | null;
                    originalKeyString?: string | null;
                    preferredAccidental?: Accidental | null;
                    preferredModifier?: Accidental | null;
                    referenceKeyGrade?: number | null;
                    referenceKeyMode?: string | null;
                    relativeMajor?: { grade?: number | null | undefined; number?: number | null | undefined; accidental?: Accidental | null | undefined; type?: ChordType | undefined; readonly unicodeAccidental?: string | ... 1 more ... | undefined; ... 44 more ...; normalizeEnharmonics?: {} | undefined; };
                    relativeMinor?: { grade?: number | null | undefined; number?: number | null | undefined; accidental?: Accidental | null | undefined; type?: ChordType | undefined; readonly unicodeAccidental?: string | ... 1 more ... | undefined; ... 44 more ...; normalizeEnharmonics?: {} | undefined; };
                    setGrade?: {};
                    toChordSolfege?: {};
                    toChordSolfegeString?: {};
                    toChordSymbol?: {};
                    toChordSymbolString?: {};
                    toMajor?: {};
                    toNumeral?: {};
                    toNumeralString?: {};
                    toNumeric?: {};
                    toNumericString?: {};
                    toString?: {};
                    transpose?: {};
                    transposeDown?: {};
                    transposeUp?: {};
                    type?: ChordType;
                    unicodeAccidental?: string | null;
                    unicodeModifier?: string | null;
                    useAccidental?: {};
                    useModifier?: {};
                }
                | null;
            metadata?: {
                order?: (
                    | string
                    | {
                        customSort?: {};
                        match?: | string
                        | (string | undefined)[]
                        | {
                            "[match]"?: {};
                            "[matchAll]"?: {};
                            "[replace]"?: {};
                            "[search]"?: {};
                            "[split]"?: {};
                            compile?: {};
                            dotAll?: boolean;
                            exec?: {};
                            flags?: string;
                            global?: boolean;
                            ignoreCase?: boolean;
                            lastIndex?: number;
                            multiline?: boolean;
                            source?: string;
                            sticky?: boolean;
                            test?: {};
                            unicode?: boolean;
                        }
                        | {};
                        sortMethod?: "custom"
                        | "preserve"
                        | "alphabetical";
                        visible?: boolean;
                    }
                    | undefined
                )[];
                separator?: string;
            };
            normalizeChords?: boolean;
            user?: { fullname?: string; name?: string }
            | null;
            useUnicodeModifiers?: boolean;
        } = ...

        options

        • Optionaldecapo?: boolean
        • Optionaldelegates?: { abc?: {}; grid?: {}; ly?: {}; tab?: {} }
        • Optionalevaluate?: boolean

          Whether or not to evaluate meta expressions. For more info about meta expressions, see: https://bit.ly/2SC9c2u

        • OptionalexpandChorusDirective?: boolean

          Whether or not to expand {chorus} directives by rendering the last defined chorus inline after the directive.

        • Optionalinstrument?: { description?: string; type?: string } | null
        • Optionalkey?:
              | {
                  accidental?: Accidental
                  | null;
                  canBeFlat?: {};
                  canBeSharp?: {};
                  changeGrade?: {};
                  clone?: {};
                  distanceTo?: {};
                  effectiveGrade?: number;
                  equals?: {};
                  explicitAccidental?: boolean;
                  grade?: number | null;
                  is?: {};
                  isChordSolfege?: {};
                  isChordSymbol?: {};
                  isMinor?: {};
                  isNumeral?: {};
                  isNumeric?: {};
                  makeMinor?: {};
                  minor?: boolean;
                  minorSign?: "" | "m";
                  modifier?: Accidental | null;
                  normalize?: {};
                  normalizeEnharmonics?: {};
                  note?: string;
                  number?: number | null;
                  originalKeyString?: string | null;
                  preferredAccidental?: Accidental | null;
                  preferredModifier?: Accidental | null;
                  referenceKeyGrade?: number | null;
                  referenceKeyMode?: string | null;
                  relativeMajor?: { grade?: number | null | undefined; number?: number | null | undefined; accidental?: Accidental | null | undefined; type?: ChordType | undefined; readonly unicodeAccidental?: string | ... 1 more ... | undefined; ... 44 more ...; normalizeEnharmonics?: {} | undefined; };
                  relativeMinor?: { grade?: number | null | undefined; number?: number | null | undefined; accidental?: Accidental | null | undefined; type?: ChordType | undefined; readonly unicodeAccidental?: string | ... 1 more ... | undefined; ... 44 more ...; normalizeEnharmonics?: {} | undefined; };
                  setGrade?: {};
                  toChordSolfege?: {};
                  toChordSolfegeString?: {};
                  toChordSymbol?: {};
                  toChordSymbolString?: {};
                  toMajor?: {};
                  toNumeral?: {};
                  toNumeralString?: {};
                  toNumeric?: {};
                  toNumericString?: {};
                  toString?: {};
                  transpose?: {};
                  transposeDown?: {};
                  transposeUp?: {};
                  type?: ChordType;
                  unicodeAccidental?: string | null;
                  unicodeModifier?: string | null;
                  useAccidental?: {};
                  useModifier?: {};
              }
              | null

          The key to use for rendering. The chord sheet will be transposed from the song's original key (as indicated by the {key} directive) to the specified key. Note that transposing will only work if the original song key is set.

        • Optionalmetadata?: {
              order?: (
                  | string
                  | {
                      customSort?: {};
                      match?: | string
                      | (string | undefined)[]
                      | {
                          "[match]"?: {};
                          "[matchAll]"?: {};
                          "[replace]"?: {};
                          "[search]"?: {};
                          "[split]"?: {};
                          compile?: {};
                          dotAll?: boolean;
                          exec?: {};
                          flags?: string;
                          global?: boolean;
                          ignoreCase?: boolean;
                          lastIndex?: number;
                          multiline?: boolean;
                          source?: string;
                          sticky?: boolean;
                          test?: {};
                          unicode?: boolean;
                      }
                      | {};
                      sortMethod?: "custom"
                      | "preserve"
                      | "alphabetical";
                      visible?: boolean;
                  }
                  | undefined
              )[];
              separator?: string;
          }
          • Optionalorder?: (
                | string
                | {
                    customSort?: {};
                    match?: | string
                    | (string | undefined)[]
                    | {
                        "[match]"?: {};
                        "[matchAll]"?: {};
                        "[replace]"?: {};
                        "[search]"?: {};
                        "[split]"?: {};
                        compile?: {};
                        dotAll?: boolean;
                        exec?: {};
                        flags?: string;
                        global?: boolean;
                        ignoreCase?: boolean;
                        lastIndex?: number;
                        multiline?: boolean;
                        source?: string;
                        sticky?: boolean;
                        test?: {};
                        unicode?: boolean;
                    }
                    | {};
                    sortMethod?: "custom"
                    | "preserve"
                    | "alphabetical";
                    visible?: boolean;
                }
                | undefined
            )[]
          • Optionalseparator?: string

            The separator to be used when rendering a metadata value that has multiple values. See: https://bit.ly/2SC9c2u

        • OptionalnormalizeChords?: boolean

          Whether or not to automatically normalize chords

        • Optionaluser?: { fullname?: string; name?: string } | null
        • OptionaluseUnicodeModifiers?: boolean

          Whether or not to use unicode flat and sharp symbols.

      Returns ChordProFormatter

    Methods

    • Configure the formatter with new options

      Parameters

      • config: {
            decapo?: boolean;
            delegates?: { abc?: {}; grid?: {}; ly?: {}; tab?: {} };
            evaluate?: boolean;
            expandChorusDirective?: boolean;
            instrument?: { description?: string; type?: string } | null;
            key?:
                | {
                    accidental?: Accidental
                    | null;
                    canBeFlat?: {};
                    canBeSharp?: {};
                    changeGrade?: {};
                    clone?: {};
                    distanceTo?: {};
                    effectiveGrade?: number;
                    equals?: {};
                    explicitAccidental?: boolean;
                    grade?: number | null;
                    is?: {};
                    isChordSolfege?: {};
                    isChordSymbol?: {};
                    isMinor?: {};
                    isNumeral?: {};
                    isNumeric?: {};
                    makeMinor?: {};
                    minor?: boolean;
                    minorSign?: "" | "m";
                    modifier?: Accidental | null;
                    normalize?: {};
                    normalizeEnharmonics?: {};
                    note?: string;
                    number?: number | null;
                    originalKeyString?: string | null;
                    preferredAccidental?: Accidental | null;
                    preferredModifier?: Accidental | null;
                    referenceKeyGrade?: number | null;
                    referenceKeyMode?: string | null;
                    relativeMajor?: { grade?: number | null | undefined; number?: number | null | undefined; accidental?: Accidental | null | undefined; type?: ChordType | undefined; readonly unicodeAccidental?: string | ... 1 more ... | undefined; ... 44 more ...; normalizeEnharmonics?: {} | undefined; };
                    relativeMinor?: { grade?: number | null | undefined; number?: number | null | undefined; accidental?: Accidental | null | undefined; type?: ChordType | undefined; readonly unicodeAccidental?: string | ... 1 more ... | undefined; ... 44 more ...; normalizeEnharmonics?: {} | undefined; };
                    setGrade?: {};
                    toChordSolfege?: {};
                    toChordSolfegeString?: {};
                    toChordSymbol?: {};
                    toChordSymbolString?: {};
                    toMajor?: {};
                    toNumeral?: {};
                    toNumeralString?: {};
                    toNumeric?: {};
                    toNumericString?: {};
                    toString?: {};
                    transpose?: {};
                    transposeDown?: {};
                    transposeUp?: {};
                    type?: ChordType;
                    unicodeAccidental?: string | null;
                    unicodeModifier?: string | null;
                    useAccidental?: {};
                    useModifier?: {};
                }
                | null;
            metadata?: {
                order?: (
                    | string
                    | {
                        customSort?: {};
                        match?: | string
                        | (string | undefined)[]
                        | {
                            "[match]"?: {};
                            "[matchAll]"?: {};
                            "[replace]"?: {};
                            "[search]"?: {};
                            "[split]"?: {};
                            compile?: {};
                            dotAll?: boolean;
                            exec?: {};
                            flags?: string;
                            global?: boolean;
                            ignoreCase?: boolean;
                            lastIndex?: number;
                            multiline?: boolean;
                            source?: string;
                            sticky?: boolean;
                            test?: {};
                            unicode?: boolean;
                        }
                        | {};
                        sortMethod?: "custom"
                        | "preserve"
                        | "alphabetical";
                        visible?: boolean;
                    }
                    | undefined
                )[];
                separator?: string;
            };
            normalizeChords?: boolean;
            user?: { fullname?: string; name?: string }
            | null;
            useUnicodeModifiers?: boolean;
        }

        New configuration options

      Returns this

      The formatter instance for chaining

    • Get the default configuration for this formatter type Should be implemented by subclasses to return the appropriate default configuration

      Returns BaseFormatterConfiguration