From MiniScript Wiki
Revision as of 00:38, 30 April 2020 by SpatialPlays (talk | contribs) (Added arguments table and "See also" sections)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sound.init synthesizes a sound from various parameters, including look-up tables that represent one cycle of the waveform and the volume envelope.


Parameter Name Type Default Value Meaning
duration number 1 length of the sound in seconds
frequency number 440 number of repeats of the waveform per second
envelope [number] [1] volume (0 to 1) over the duration of the sound
waveform [number] [-1, 1] wave value over an audio cycle

Usage Notes

Call this on a new Sound object, or to reset a previous one.


pew = new Sound
pew.init 0.3, [8000,100], [1,0]

Example 2:

hitSnd = new Sound
hitSnd.init 1, 100, [1,0], Sound.noiseWave

See also: Sound.duration; Sound.freq; Sound.envelope; Sound.waveform