Documentation

Unity Engine

Download Unity

Unity Engine

samples

The length of the audio clip in samples. (Read Only)
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.AudioModule
public int samples { get; }

Remarks

Until the audio data is loaded (see AudioClip.loadState), this reports the length of the imported clip.
WebGL: The browser decodes audio data asynchronously. Once the clip is loaded, this reports the length of the decoded audio, which can differ slightly from the imported length, for example because of encoder padding or because the browser resamples the audio to the sample rate of its audio output.