Modification

Module containing functionality to apply WebAudioAPI note modifications.

Methods

static canModifySequence(modificationType) → {boolean}

Returns whether the corresponding ModificationType can be used to modify a sequence of notes.

Parameters:
Name Type Description
modificationType number

The ModificationType about which to query

Returns:
boolean -

Whether the corresponding modification type can be used to modify a sequence of notes

See:

static getModificationParameters(modificationType) → {Object.<string, Object.<string, Array.<string>>>}

Returns a list of modification-specific parameters for use with the corresponding ModificationType.

Note that the modificationType parameter must be the numeric value associated with a certain ModificationType, not a string-based key.

The object returned from this function will contain 2 keys: 'required' and 'optional'. These keys can be used to access sub-objects with 2 keys: 'singleNote' and 'sequence'. These keys hold arrays containing the string-based names of parameters that are available for manipulation within the given modification.

Parameter values within the "sequence" array indicate parameters that have meaning when used with the playSequence() function. Parameter values within the "singleNote" array indicate parameters that have meaning when used with the playNote() function.

Parameters:
Name Type Description
modificationType number

The ModificationType for which to return a parameter list

Returns:
Object.<string, Object.<string, Array.<string>>> -

List of modification-specific parameter keys and when they are required

See:

static inferModificationParametersFromSequence(modificationType, sequence, index, params) → {Object}

Attempts to infer the required modification parameter values from a given sequence of notes.

Parameters:
Name Type Description
modificationType number

Numeric value corresponding to the desired ModificationType

sequence Array.<(Array|Array.<Array>)>

Array of [note, duration] and/or chords corresponding to the sequence to be played

index number

Index of the current note in the sequence

params Object | null

Object containing the currently known parameter values

Returns:
Object -

Object containing the inferred and known parameter values

See:

static loadModification(modificationType, tempo, key, details) → {ModificationBase}

Loads a concrete ModificationBase instance capable of modifying an individual note and duration.

Parameters:
Name Type Description
modificationType number

Numeric value corresponding to the desired ModificationType

tempo Tempo

Reference to the current global Tempo object

key Key

Reference to the current global Key object

details NoteDetails

Unmodified details about the note to be played

Returns:
ModificationBase -

Newly created note ModificationBase object

See: