Utility functions for working with song data, including note data, event data, metadata, etc.
Static methods
staticbuildEventClipboard(events:Array<SongEventData>, ?timeOffset:Int):Array<SongEventData>
Prepare an array of events to be used as the clipboard data.
Offset the provided array of events such that the first event is at 0 milliseconds.
staticbuildNoteClipboard(notes:Array<SongNoteData>, ?timeOffset:Int):Array<SongNoteData>
Prepare an array of notes to be used as the clipboard data.
Offset the provided array of notes such that the first note is at 0 milliseconds.
staticclampSongEventData(events:Array<SongEventData>, startTime:Float, endTime:Float):Array<SongEventData>
Given an array of SongEventData objects, return a new array of SongEventData objects which excludes any events whose timestamps are outside of the given range.
Parameters:
events | The events to modify. |
|---|---|
startTime | The start of the range in milliseconds. |
endTime | The end of the range in milliseconds. |
Returns:
The filtered array of events.
staticclampSongNoteData(notes:Array<SongNoteData>, startTime:Float, endTime:Float):Array<SongNoteData>
Given an array of SongNoteData objects, return a new array of SongNoteData objects which excludes any notes whose timestamps are outside of the given range.
Parameters:
notes | The notes to modify. |
|---|---|
startTime | The start of the range in milliseconds. |
endTime | The end of the range in milliseconds. |
Returns:
The filtered array of notes.
staticflipNotes(notes:Array<SongNoteData>, strumlineSize:Int = 4):Array<SongNoteData>
Create an array of notes whose note data is flipped (player becomes opponent and vice versa) Does not mutate the original array.
staticgetEventsInTimeRange(events:Array<SongEventData>, start:Float, end:Float):Array<SongEventData>
Filter a list of events to only include events that are within the given time range.
staticgetEventsWithKind(events:Array<SongEventData>, kinds:Array<String>):Array<SongEventData>
Filter a list of events to only include events whose kind is one of the given values.
staticgetNotesInDataRange(notes:Array<SongNoteData>, start:Int, end:Int):Array<SongNoteData>
Filter a list of notes to only include notes whose data is within the given range, inclusive.
staticgetNotesInTimeRange(notes:Array<SongNoteData>, start:Float, end:Float):Array<SongNoteData>
Filter a list of notes to only include notes that are within the given time range.
staticgetNotesWithData(notes:Array<SongNoteData>, data:Array<Int>):Array<SongNoteData>
Filter a list of notes to only include notes whose data is one of the given values.
staticoffsetSongEventData(events:Array<SongEventData>, offset:Float):Array<SongEventData>
Given an array of SongEventData objects, return a new array of SongEventData objects whose timestamps are shifted by the given amount. Does not mutate the original array.
Parameters:
events | The events to modify. |
|---|---|
offset | The time difference to apply in milliseconds. |
staticoffsetSongNoteData(notes:Array<SongNoteData>, offset:Float):Array<SongNoteData>
Given an array of SongNoteData objects, return a new array of SongNoteData objects whose timestamps are shifted by the given amount. Does not mutate the original array.
Parameters:
notes | The notes to modify. |
|---|---|
offset | The time difference to apply in milliseconds. |
staticreadItemsFromClipboard():SongClipboardItems
Read an array of note data from the clipboard and deserialize it.
staticsortEvents(events:Array<SongEventData>, desc:Bool = false):Array<SongEventData>
Sort an array of events by strum time.
staticsortNotes(notes:Array<SongNoteData>, desc:Bool = false):Array<SongNoteData>
Sort an array of notes by strum time.
staticsortTimeChanges(timeChanges:Array<SongTimeChange>, desc:Bool = false):Array<SongTimeChange>
Sort an array of notes by strum time.
staticsubtractEvents(events:Array<SongEventData>, subtrahend:Array<SongEventData>):Array<SongEventData>
Return a new array without a certain subset of events from an array of SongEventData objects. Does not mutate the original array.
Parameters:
events | The array of events to be subtracted from. |
|---|---|
subtrahend | The events to remove from the |
staticsubtractNotes(notes:Array<SongNoteData>, subtrahend:Array<SongNoteData>):Array<SongNoteData>
Return a new array without a certain subset of notes from an array of SongNoteData objects. Does not mutate the original array.
Parameters:
notes | The array of notes to be subtracted from. |
|---|---|
subtrahend | The notes to remove from the |
staticwriteItemsToClipboard(data:SongClipboardItems):Void
Serialize note and event data and write it to the clipboard.