AudioClip
Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.
Up and coming
Sound in memory as samples: crop it, resample it, draw its waveform and save it for upload.
AudioService's LoadAsync and CreateClip give one, at the file's own sample rate, channels and bit depth. Samples run from -1 to 1 with 1-based indexes, channel 1 by default. SaveAsync writes .wav directly and .ogg and .mp3 through ffmpeg, whose exit code is always checked.
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| SampleRate | number | Samples per second, kept from the file. | |
| Channels | number | ||
| SampleCount | number | read-only | |
| TimeLength | number | read-only | Length in seconds. |
Methods
| Name | Arguments | Returns | Description |
|---|---|---|---|
| GetSample | (index: number, channel: number?) | number | One sample from -1 to 1, by 1-based index; channel 1 by default. |
| SetSample | (index: number, value: number, channel: number?) | () | |
| ReadSamplesBuffer | (channel: number, first: number, count: number) | buffer | Reads count samples of the channel from first into a buffer of 32-bit floats. |
| WriteSamplesBuffer | (channel: number, first: number, samples: buffer) | () | |
| GetValueAtTime | (time: number, channel: number?) | number | The value at a time in seconds, linear between samples. |
| Crop | (first: number, last: number) | AudioClip | |
| CropTime | (startTime: number, endTime: number) | AudioClip | |
| Resample | (sampleRate: number) | AudioClip | |
| GetPeaks | (buckets: number, channel: number?) | buffer | The min and max of each bucket as 32-bit floats, for drawing a waveform. |
| EncodeWav | (bits: number?) | buffer | The clip as WAV bytes, at 16 or 32 bits. |
| SaveAsync yields | (path: string) | (boolean, string?) | Writes .wav directly, and .ogg and .mp3 through ffmpeg. |
From ShotInstance 33
ClassNameNameParentAncestryChangedAttributeChangedChangedChildAddedChildRemovedDestroyingAddTagClearAllChildrenCloneDestroyFindFirstAncestorFindFirstAncestorOfClassFindFirstAncestorWhichIsAFindFirstChildFindFirstChildOfClassFindFirstChildWhichIsAGetAttributeGetAttributeChangedSignalGetAttributesGetChildrenGetDescendantsGetFullNameGetPropertyChangedSignalGetTagsHasTagIsAIsAncestorOfIsDescendantOfRemoveTagSetAttribute
