Audio ¶
An Object representing an audio.
properties¶
Data : {buffer}¶
The data represented as a table of 32bit float buffers.
Each buffer represents 1 audio channel.
SampleRate : number¶
The sample rate in hz.
Frames : number¶
The ammount of frames per channel.
Duration : number¶
The duration of the audio in seconds.
Channels : number¶
The ammount of audio channels in the audio.
methods¶
Encode -> buffer ¶
Encodes the audio into a certain audio format.
Clone -> Audio ¶
Clones your audio.
Reverse -> Audio ¶
Reverses the audio data.
Amplify -> Audio ¶
Increases the volume by a set gain.
Normalise -> Audio ¶
Does a peak normalisation targetting the provided decibel level. If no target was provided then it will target 0 dBFS.
FadeIn -> Audio ¶
Adds a linear fade in that lasts for the given duration.
FadeOut -> Audio ¶
Adds a linear fade out at the end of the audio that lasts for the given duration.
Trim -> Audio ¶
Trims down the audio to be between a start and a optional stop time.
Lowpass -> Audio ¶
Applies a lowpass filter over the audio.
Highpass -> Audio ¶
Applies a highpass filter over the audio.
Notch -> Audio ¶
Applies a notch filter over the audio.
Resample -> Audio ¶
Resamples the audio to the provided sample rate; Interpolation filters supported:
- HERMITE - interpolates from 4 points and their gradients.
- LINEAR - linear interpolation between 2 points
- LANCZOS3 - interpolation using 6 points
Append -> Audio ¶
Appends another audio file to the end of this audio file.
Overlay -> Audio ¶
overlays two audio files together.
HardClip -> Audio ¶
Strictly clamps the audio to below the threshold.
SoftClip -> Audio ¶
Clamps the audio to below the threshold while preserving peaks.
Saturate -> Audio ¶
Saturates the audio using a drive parameter. modes supported:
- TANH - warmer and smoother saturations.
- ARCTAN - more aggressive saturations.
Compress -> Audio ¶
Compresses the dynamic range of the audio, making quiet sounds louder and loud sounds quieter.
metamethods¶
__tostring -> string ¶
Converts the audio into a string in the format audio [Channels]ch [SampleRate]Hz [Frames] frames
types¶
AudioFormat¶
AudioResampleFilter¶
AudioSaturationMode¶
AudioCompressConfig¶
type AudioCompressConfig = {
-- Ammount of gain to add before compressing.
Input : number?,
-- Ammount of gain to add after compressing.
Output : number?,
-- Volume level (in decibels) to start compressing.
Threshold : number?,
-- Ammount to compress by as a ratio.
Ratio : number?,
-- How long it takes for the compressor to react.
Attack : number?,
-- How long it takes for the compressor to decompress.
Release : number?,
-- Softens the transition between uncompressed and compressed.
Knee : number?
}