AudioClip
info
AudioClip inherits from Object
A container for audio data. An AudioClip stores the audio file either compressed as ogg vorbis or uncompressed. AudioClips are referenced and used by AudioSources to play sounds. Check out Unity Audio Clip
Members
Properties
Name | Description |
---|---|
AudioClip .ambisonic | Returns true if this audio clip is ambisonic (read-only). |
AudioClip .channels | The number of channels in the audio clip. (Read Only) |
AudioClip .frequency | The sample frequency of the clip in Hertz. (Read Only) |
AudioClip .length | The length of the audio clip in seconds. (Read Only) |
AudioClip .loadInBackground | Corresponding to the "Load In Background" flag in the inspector, when this flag is set, the loading will happen delayed without blocking the main thread. |
AudioClip .loadState | Returns the current load state of the audio data associated with an AudioClip. |
AudioClip .loadType | The load type of the clip (read-only). |
AudioClip .preloadAudioData | Preloads audio data of the clip when the clip asset is loaded. When this flag is off, scripts have to call AudioClip.LoadAudioData() to load the data before the clip can be played. Properties like length, channels and format are available before the audio data has been loaded. |
AudioClip .samples | The length of the audio clip in samples. (Read Only) |
Methods
Name | Description |
---|---|
AudioClip .GetData(offsetSamples) | Gets an array with sample data from the clip. |
AudioClip .LoadAudioData() | Loads the audio data of a clip. Clips that have "Preload Audio Data" set will load the audio data automatically. |
AudioClip .SetData(data[], offsetSamples) | Set sample data in a clip. |
AudioClip .UnloadAudioData() | Unloads the audio data associated with the clip. This works only for AudioClips that are based on actual sound file assets. |
Static Methods
Name | Description |
---|---|
AudioClip .Create(name, lengthSamples, channels, frequency) | Creates a user AudioClip with a name and with the given length in samples, channels and frequency. |
Inherited Members
Inherited Properties
Name | Description |
---|---|
AudioClip .hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
AudioClip .name | The name of the object. |
Inherited Methods
Name | Description |
---|---|
AudioClip .GetInstanceID() | Returns the instance id of the object. |