sound.Generate
Description
Creates a sound from a function.
Arguments
4 function callback
A function which will be called to generate every sample on the sound.
Function callback arguments are:
- number sampleIndex - The current sample number.
Function callback return values are:
- number sampleValue - The return value must be between
-1.0
and1.0
.
Other values will wrap back to the -1 to 1 range and basically clip.
There are 65535 possible quantifiable values between -1 and 1.
Example
Plays a 2000 Hz sine wave at maximum volume.