AudioClip.GetData(number offsetSamples)
Gets an array with sample data from the clip.
Parameters:
Name | Type | Description |
---|---|---|
offsetSamples | number | Offset to get samples. Note that it starts from 0. |
Returns:
type | Description |
---|---|
boolean | Boolean stating if succesful. |
number[] | An array with sample data from the clip. |
Usage
---@type AudioClip
local audioclip;
---@type number
local offsetSamples;
local val0, val1 = audioclip.GetData(offsetSamples)
Extra Detail
The samples are floats ranging from -1.0f to 1.0f. The sample count is determined by the length of the float array. Use the offsetSamples parameter to start the read from a specific position in the clip. If the read length from the offset is longer than the clip length, the read will wrap around and read the remaining samples from the start of the clip.