new NoteClip()

NoteClip abstraction. A collection of Note objects. Instantiated by WX.NoteClip.

Methods

static
delete(id) → (Note or null)

Deletes and returns a note from clip. Returns null when not found.

Parameter

Name Type Optional Description

id

String

 

Note ID.

Returns

(Note or null) 

static
empty()

Flush out noteclip content.

static
findNoteIdAtPosition(pitch, tick) → (String or null)

Find a note that contains a point specified by pitch and tick. Then returns note ID. Returns null when not found. Note that this impl might produce an undesirable result since it simply catches the first note detected in the iteration. There is no perfect solution over this problem, so I chose to make it robust instead.

Parameters

Name Type Optional Description

pitch

Number

 

MIDI pitch

tick

Number

 

Position in tick.

Returns

(String or null) 

static
findNotesIdInArea(minPitch, maxPitch, startTick, endTick) → (Array or null)

Find notes in a area specified by pitch and tick. Then returns an array of notes. Returns null when nothing in target area. Note that this method only care for start time of note. If a note starts before than the area, it will not be included in the selection.

Parameters

Name Type Optional Description

minPitch

Number

 

Lower bound pitch.

maxPitch

Number

 

Upper bound pitch.

startTick

Number

 

Start time in tick.

endTick

Number

 

End time in tick.

Returns

(Array or null) 

static
get(id) → Object

Returns note from clip with id.

Parameter

Name Type Optional Description

id

String

 

Note ID.

Returns

Object 

static
getAllId() → Array

Retunrs an array with all the ID of notes.

Returns

Array 

static
getSize() → Number

Returns clip size.

Returns

Number 

static
hasId(id) → Boolean

Probes clip with note id.

Parameter

Name Type Optional Description

id

String

 

Note id.

Returns

Boolean True if clip contains the note.

static
iterate(callback)

Iterates all the notes with callback function.

Parameter

Name Type Optional Description

callback

callback_noteclip_iterate

 

Process for iteration.

static
push(note) → String

Pushes a new note into clip. Returns ID of the new note.

Parameter

Name Type Optional Description

note

Note

 

Returns

String Note ID.

static
scanNotesInTimeSpan(start, end) → (Array or null)

Returns an array of notes within a timespan. Returns null when not found. Note that this method actually returns Note objects, not IDs.

Parameters

Name Type Optional Description

start

Number

 

Start time in tick.

end

Number

 

End time in tick.

Returns

(Array or null) 

static
set(id, note)

Set a note with a specific ID. If the same ID found, update properties of the note. Otherwise, create a new note with a specified ID. Usually this method is used in the collaborative context.

Parameters

Name Type Optional Description

id

String

 

Note ID.

note

Note

 

Note object.