Members
context
The AudioContext used. Created in init.
- Source:
dataOnlyMode
This mode runs the engine without drawing to a canvas or playing audio.
This is useful to use the engine to generate image data.
- Source:
lookAheadTime
Time in second we should look ahead during update to add audio events to the context.
- Source:
sounds
Array of sounds used, of the Sound class type.
Add a sound from data using the addSound method.
- Source:
Methods
addSound(soundData)
Add a Sound instance to the sounds array from data.
Parameters:
Name | Type | Description |
---|---|---|
soundData |
* |
- Source:
init()
Initialize the audio context. Called automatically by the Engine.
- Source:
playInfiniteSound(soundIndex, note, volume, speed)
Play a sound infinitely. Only one instance of a sound at each index can be played at a time.
Parameters:
Name | Type | Description |
---|---|---|
soundIndex |
* | |
note |
* | |
volume |
* | |
speed |
* |
- Source:
playSound(soundIndex, note, duration, volume, speed)
Play a sound
Parameters:
Name | Type | Default | Description |
---|---|---|---|
soundIndex |
* | ||
note |
* | ||
duration |
* | 32 | |
volume |
* | 1 | |
speed |
* | 0 |
- Source:
stopAllInfiniteSounds()
Stop all infinitely playing sounds
- Source:
stopInfiniteSound(soundIndex)
Stop a sound that is being played infinitely
Parameters:
Name | Type | Description |
---|---|---|
soundIndex |
* |
- Source:
update()
Update audio events. Called automatically by the Engine in the update loop.
- Source:
(static) frequencyForNote(note)
Get the frequency in hertz for a note number.
Parameters:
Name | Type | Description |
---|---|---|
note |
* |
- Source:
(static) fullDurationForSpeedValue(speed)
Get the total length of a sound in seconds for a given speed number
Parameters:
Name | Type | Description |
---|---|---|
speed |
* |
- Source:
(static) indexAtTic(tic, useLoop, loopStart, loopEnd)
Get the current tic index, taking into account looping.
Parameters:
Name | Type | Description |
---|---|---|
tic |
* | |
useLoop |
* | |
loopStart |
* | |
loopEnd |
* |
- Source:
(static) linearToAdjustedVolume(volume)
Adjust a linear volume value to account for human hearing.
Parameters:
Name | Type | Description |
---|---|---|
volume |
* |
- Source:
(static) oscTypeForWaveValue(waveValue)
Get the wave type for a wave index
Parameters:
Name | Type | Description |
---|---|---|
waveValue |
* |
- Source:
(static) ticDurationForSpeedValue(speed)
Get the duration in seconds for a tic at a given speed number.
Parameters:
Name | Type | Description |
---|---|---|
speed |
* |
- Source:
(static) valueForVolume(volume)
Get a 0 - 1 volume value for a 0 - 15 value used by the Sound class.
Parameters:
Name | Type | Description |
---|---|---|
volume |
* |
- Source: