Search results

Types

Classes
Interfaces
Enums
Functions
Type aliases
Constants

Members

Properties
Methods
Getters
Setters
Enum members
Show privates

Other

In this module only

Class Measure

Defined in Measure.ts

· maxDuration - =0 Max duration of the measure(determined by time signature)

Constructor

constructor(maxDuration = 64)

Properties

_data: Arrayexternal Array<NormalizedMeasureDatainterface NormalizedMeasureDatanotation/NormalizedMeasureData>[src]

Methods

get maxDuration(): number[src]

Returns the maximum sum of durations for the measure as a number, where each unit is 1/64 bit.

Returns

undefined
get data(): Arrayexternal Array<NormalizedMeasureDatainterface NormalizedMeasureDatanotation/NormalizedMeasureData>[src]

Returns the data of the measure - an array of objects where each object has a set of notes and the duration for those notes.

Returns

undefined
get length(): number[src]

Returns the number of sixteenth notes in the measure.

Returns

undefined
static measureDataToString(
notesMember: NormalizedMeasureDatainterface NormalizedMeasureDatanotation/NormalizedMeasureData
): string
[src]
static parseMeasureNoteMemberString(str: string): MeasureDatainterface MeasureDatanotation/MeasureData[src]
static stringToMeasure(
__namedParameters: {str: string, maxDuration: number}
): Measureclass Measurenotation/Measure
[src]
clone(): Measureclass Measurenotation/Measure[src]

Returns a deep clone of the measure.

Returns

undefined
durationLeft(position: number = number): number[src]

Returns the duration left for notes in the measure.

· position - =this.data.length

Returns

undefined
addNote(
__namedParameters: {note: Notetype NoteNote, duration: string},
position: number
): boolean
[src]

Adds a note to the measure at some position.

· data - undefined
· position - The position in the data to add the note to.

Returns

undefined
addNotes(
__namedParameters: MeasureDatainterface MeasureDatanotation/MeasureData,
position: number
): boolean
[src]

Adds notes to the note set at the position.

· notes - An array of raw notes.
· duration - undefined
· position - The position in the data to add the notes to.

Returns

undefined
addChord(
__namedParameters: MeasureDatainterface MeasureDatanotation/MeasureData,
position: number
): boolean
[src]

Adds notes to the measure plus a name that represents the chord and is saved in the data at the position as name

· notes - undefined
· name - undefined
· duration - undefined
· position - undefined

Example

measure.addChord({ notes: ['C3', 'E3', 'G3'], name: 'C Major', duration: '4n' }, 0) // Adds a C major chord at the start of the measure.

deleteNote(note: string, position: number): boolean[src]

Delete note at the position.

· note - raw note.
· position - The position in the data to delete the note at.

Returns

undefined
deleteNotes(
notes: Arrayexternal Array<string>,
position: number
): boolean
[src]

Deletes notes from the noteset at the position.

· notes - An array of raw notes.
· position - The position in the data to delete the notes at.

Returns

undefined
deleteMember(position: number): boolean[src]

Delete member from the measure's data - removes all the notes from it and initializes a new data member with the measure's duration.

· position - Position of the member to delete.
isFull(duration: string): boolean[src]

Returns true if the duration has space, else false.

· duration - undefined

Returns

undefined
transpose(interval: number): Measureclass Measurenotation/Measure[src]

Returns a new measure where all the notes are transposed by the interval.

· interval - Interval to transpose by.

Returns

undefined
clear(): boolean[src]

Removes all the data from the measure.

Returns

undefined
private initNext(position: number, duration = "4n"): void[src]

Creates a slot for the next notes that will be added in the measure if there is space. Should not be called as it's called automatically when needed.

· position - Position to initialize the next notes to.
· duration - duration to create for the notes
private canInsertToMeasure(
position: number,
duration: string
): boolean
[src]

Checks whether a new data member can be added at a certain position in the measure.

· position - The position to check for.
· duration - duration of new notes

Returns

undefined