Sound.init
Revision as of 22:48, 1 April 2020 by 71.226.33.30 (talk) (Created page with "<c>Sound.init</c> synthesizes a sound from various parameters, including look-up tables that represent one cycle of the waveform and the volume envelope. === Usage Notes...")
Sound.init
synthesizes a sound from various parameters, including look-up tables
that represent one cycle of the waveform and the volume envelope.
Usage Notes
Call this on a new Sound object, or to reset a previous one. duration (number, default 1): length of the sound, in seconds freq (number, default 440): number of repeats of the waveform per second envelope (list): volume (0 to 1) over the duration of the sound waveform (list): wave value (-1 to 1) over one cycle
Example
pew = new Sound
pew.init 0.3, [8000,100], [1,0]
pew.play
Example 2:
hitSnd = new Sound
hitSnd.init 1, 100, [1,0], Sound.noiseWave
hitSnd.play