local Wave = require("tofu.generators.wave")
Returns a Wave
object, with period period
, that maps a floating-point value to the range [-amplitude, amplitude]
. form
can be one of the following values: sine
, square
, triangle
, sawtooth
.
Gets the string representation of Wave
object waveform.
Gets the current waveform bound of this Wave
object.
Gets the Wave
object waveform’s period. The default value is 1.0
.
Sets the Wave
object waveform’s period.
Gets the Wave
object waveform’s amplitude. The default value is 1.0
.
Sets the Wave
object waveform’s amplitude.
Evaluates the wave function at time
and returns the value. time
can be any value but it is advisable to keep it in the range [0, period)
to increase accuracy on the long time. The returned value is in the range [-amplitude, amplitude]
.
The object’s meta-method
__call()
is mapped to this method and can be used as an alternative.