new Synthesizer(audioContext)
A basic synthesizer that can also serve as a parent class for other types of synthesizers.
Parameters:
| Name | Type | Description |
|---|---|---|
audioContext |
Object | An AudioContext. |
Members
inputGain
Gets the input gain value.
inputGain
Sets the input gain to the specified value.
outputGain
Gets the output gain value.
outputGain
Sets the output gain to the specified value.
Methods
noteToFrequency(note) → {number}
Converts the specified note value to a frequency value.
Parameters:
| Name | Type | Description |
|---|---|---|
note |
number | The note value. |
Returns:
The frequency of the note.
- Type
- number
scheduleNote(note)
Schedules the specified note to be played according to its parameters.
Parameters:
| Name | Type | Description |
|---|---|---|
note |
Object | The note to schedule. |
startNote(note)
Starts playing the specified note immediately.
Parameters:
| Name | Type | Description |
|---|---|---|
note |
Object | The note to play. |
stopNote(note)
Stops playing the specified note immediately.
Parameters:
| Name | Type | Description |
|---|---|---|
note |
Object | The note to stop. |
stopScheduledNotes()
Stop all scheduled notes. This is mainly to stop scheduled notes that are currently playing.
velocityToGain(velocity) → {number}
Converts the specified velocity to a gain value by dividing the velocity by the maxmimum velocity (127 by default).
Parameters:
| Name | Type | Description |
|---|---|---|
velocity |
number | The velocity. |
Returns:
A gain value from 0-1.
- Type
- number