Waveform
Summary
Functions to generate a variety of waveforms
Class Methods
Waveform:Sine(time, frequency)
Returns the value of a sine wave at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:Cosine(time, frequency)
Returns the value of a cosine wave at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:Triangle(time, frequency)
Returns the value of a triangle wave at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:Sawtooth(time, frequency)
Returns the value of a sawtooth wave at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:Square(time, frequency)
Returns the value of a square wave at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:Pulse(time, frequency, pulseWidth)
Returns the value of a pulse wave with a specified pulse width at the given time, frequency
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave | |
pulseWidth | number | The width of the pulse |
Example
Waveform:Exponent(time, frequency)
Returns the value of an exponential wave at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:Power(time, frequency, power)
Returns the value of a power wave at the given time, frequency, and power
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave | |
power | number | The power exponent of the wave |
Example
Waveform:Parabolic(time, frequency)
Returns the value of a parabolic wave at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:ExponentialSawtooth(time, frequency, exponent)
Returns the value of an exponential sawtooth wave with the specified exponent at the given time, frequency
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave | |
exponent | number | The exponent of the wave |
Example
Waveform:PerlinNoise(time, frequency)
Returns the value of a perlin noise function at the given time
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to sample the waveform at | |
frequency | number | The frequency of the wave |
Example
Waveform:WhiteNoise()
Returns the value of a white noise function
Returns: number (The value of the wave sampled at the given time)
Example
Waveform:BrownNoise(previous)
Returns the value of a brown noise function
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
previous | number | The previous calculated value to feed back into the function |
Example
Waveform:BlueNoise(previous)
Returns the value of a blue noise function
Returns: number (The value of the wave sampled at the given time)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
previous | number | The previous calculated value to feed back into the function |
Example
Waveform:Sine(time, frequency, duration, sampleRate, amplitude)
Returns a sine wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Cosine(time, frequency, duration, sampleRate, amplitude)
Returns a cosine wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Triangle(time, frequency, duration, sampleRate, amplitude)
Returns a triangle wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Sawtooth(time, frequency, duration, sampleRate, amplitude)
Returns a sawtooth wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Square(time, frequency, duration, sampleRate, amplitude)
Returns a square wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Exponent(time, frequency, duration, sampleRate, amplitude)
Returns an exponential wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Parabolic(time, frequency, duration, sampleRate, amplitude)
Returns a parabolic wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Pulse(time, frequency, pulseWidth, duration, sampleRate, amplitude)
Returns a pulse wave with the given frequency, pulse width, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
pulseWidth | number | The width of the pulse | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:Power(time, frequency, power, duration, sampleRate, amplitude)
Returns a power wave with the given frequency, power, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
power | number | The power exponent of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:ExponentialSawtoothWave(time, frequency, exponent, duration, sampleRate, amplitude)
Returns an exponential sawtooth wave with the given frequency, exponent, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
exponent | number | The exponent of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:PerlinNoise(time, frequency, duration, sampleRate, amplitude)
Returns a perlin noise wave with the given frequency, duration, and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time | number | The time to start sampling the waveform at | |
frequency | number | The frequency of the wave | |
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:WhiteNoise(duration, sampleRate, amplitude)
Returns a white noise wave with the given duration and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:BrownNoise(duration, sampleRate, amplitude)
Returns a brown noise wave with the given duration and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Waveform:BlueNoise(duration, sampleRate, amplitude)
Returns a blue noise wave with the given duration and sample rate
Returns: number[] (An array of float values)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
duration | number | The duration of samples to generate | |
sampleRate | number | The sample rate of the generated waveform | |
amplitude | number | 1 | The amplitude of the generated waveform |
Example
Last updated