@tspro/web-music-score
    Preparing search index...

    Class Note

    Note class.

    Index

    Constructors

    • Create new Note object instance.

      Parameters

      • diatonicId: number

        Diatonic id.

      • accidental: number

        Accidental (-2, -1, 0, 1 or 2).

      Returns Note

    • Create new Note object instance.

      Parameters

      • diatonicClass: number

        Diatonic class [0, 11].

      • accidental: number

        Accidental (-2, -1, 0, 1 or 2).

      • octave: number

        Octave.

      Returns Note

    • Create new Note object instance.

      Parameters

      • noteLetter: string

        Note letter (e.g. "C").

      • accidental: number

        Accidental (-2, -1, 0, 1 or 2).

      • octave: number

        Octave.

      Returns Note

    Properties

    accidental: Accidental

    Accidental.

    diatonicClass: number

    Diatonic class

    octave: number

    Octave.

    Accessors

    • get chromaticClass(): number

      Chromatic class getter.

      Returns number

    • get chromaticId(): number

      Chromatic id getter.

      Returns number

    • get diatonicId(): number

      Diatonic id getter.

      Returns number

    • get midiNumber(): number

      Midi number getter (implemented same as chromatic id).

      Returns number

    Methods

    • Format note to string presentation.

      Parameters

      Returns string

      • String presentation of note.
    • Format note to string presentation without octave number.

      Parameters

      Returns string

      • String presentation of note without octave number.
    • Function to compare two notes using diatonic id and accidental properties of notes.

      Parameters

      Returns -1 | 0 | 1

      • -1, 0 or 1.
    • Test if given two notes are equal.

      Parameters

      • a: undefined | null | Note

        Note a.

      • b: undefined | null | Note

        Note b.

      Returns boolean

      • True/false.
    • Find next lowest possible diatonic id that is above given bottom level.

      Parameters

      • diatonicId: number

        Diatonic id to begin with.

      • bottomDiatonicId: number

        Bottom diatonic id.

      • addOctaveIfEqual: boolean

        If true then add one octave if diatonic id would equal to bottom diatonic id.

      Returns number

      • Diatonic id.
    • Get accidental value from given accidental symbol.

      Parameters

      • accidentalSymbol: string

        Accidental symbol (e.g. "#").

      Returns Accidental

      • Accidental vlaue.
    • Get symbol of given accidental in given symbol set (ascii/unicide).

      Parameters

      Returns undefined | string

      • Accidental symbol or undefined (invalid accidental).
    • Get chromatic class from chromatic id.

      Parameters

      • chromaticId: number

        Chromatic id.

      Returns number

      • Chromatic class.
    • Get chromatic id in given octave (transposes chromatic id to given octave).

      Parameters

      • chromaticId: number

        Original chromatic id.

      • octave: number

        Octave.

      Returns number

      • Transpose chromatic id.
    • Get chromatic note. There are number of alternatives, this function uses simple logic to choose one.

      Parameters

      • chromaticId: number

        Chromatic id.

      Returns Note

      • Note.
    • GEt diatoni class from diatonic id.

      Parameters

      • diatonicId: number

        Diatonicid.

      Returns number

    • Getdiatonic class from note name.

      Parameters

      • noteName: string

        Note name.

      Returns number

    • Get diatonic id in given octave (transposes diatonic id to given octave).

      Parameters

      • diatonicId: number

        Original diatonic id.

      • octave: number

        Octave.

      Returns number

      • Transposed diatonic id.
    • Get note.

      Parameters

      • noteName: string

        Note name (e.g. "C4").

      Returns Note

      • Note.
    • Get note letter from given diatonic id.

      Parameters

      • diatonicId: number

        Diatonic id.

      Returns NoteLetter

      • Note letter.
    • Get octave from chromatic id.

      Parameters

      • chromaticId: number

        Chromatic id.

      Returns number

      • Octave.
    • Get octave from diatonic id.

      Parameters

      • diatonicId: number

        Diatonic id.

      Returns number

      • Octave.
    • Get scientific note name from given note name.

      Parameters

      • noteName: string

        Note name.

      • symbolSet: SymbolSet

        Symbol set (ascii/unicode) for scientific note name.

      Returns string

      • Scientific note name.
    • Test if given string is valid note name.

      Parameters

      • noteName: string

        Note name to validate.

      Returns boolean

      • True/false.
    • Parse note name string to note props.

      Parameters

      • noteName: string

        Note name to parse.

      Returns undefined | Readonly<ParsedNote>

      • Parsed note props or undefined if parsing error.
    • Remove duplicate notes.

      Parameters

      • notes: readonly Note[]

        Array of notes.

      Returns Note[]

      Sorted set of notes.

    • Replace accidental symbols in given string to givn symbol set (ascii/unicode).

      Parameters

      • str: string

        String to replace.

      • symbolSet: SymbolSet

        Symbol set.

      Returns string

      • String with updated accidental symbols.
    • Sort notes by diatonicId in ascending order.

      Parameters

      • notes: readonly Note[]

        Array of notes.

      Returns Note[]

      Sorted array of notes.

    • Validate if given argument is valid accidental.

      Parameters

      • acc: unknown

        Accidental to validate.

      Returns Accidental

      • Valid accidental or thorws.
    • Validate if given argument is chromatic class.

      Parameters

      • chromaticClass: unknown

        Chromatic class to validate.

      Returns number

      • Valid chromatic class, or throws.
    • Validate if given argument is chromatic id.

      Parameters

      • chromaticId: unknown

        Chromatic id to validate.

      Returns number

      • Valid chromatic id, or throws.
    • Validate if given argument is diatonic class.

      Parameters

      • diatonicClass: unknown

        Diatonic class to validate.

      Returns number

      • Valid diatonic class or throws.
    • Validate if given argument is diatonic id.

      Parameters

      • diatonicId: unknown

        Diatonic id to validate.

      Returns number

      • Valid diatonic id or throws.
    • Validate if given argument if note letter.

      Parameters

      • noteLetter: unknown

        Note letter to validate.

      Returns NoteLetter

      • Valid note letter or throws.
    • Validate if given argument is octave.

      Parameters

      • octave: number

        Octave to validate.

      Returns number

      • Valid octave or throws.