|
Plays the clip.
Delay allows a source to be played later at a specific sample-accurate point in time. Note that the delay must be set according to the reference output rate of 44.1 Khz, meaning that Play(44100) will delay the playing by exactly 1 sec. Note: To obtain sample accuracy with an AudioClip with a different samplerate (than 44.1 khz) you have to do the math yourselves. Delaying an audiosource with an attached AudioClip with samplerate of, say, 32 khz, with 16k samples(.5 sec) is done by Play(22050). ((44100/32000) * 16000 = 22050).
@script RequireComponent(AudioSource)
function Start() {
audio.Play();
// Delay a clip by 1 sec (44100 samples)
audio.Play(44100);
}
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class example : MonoBehaviour {
void Start() {
audio.Play();
audio.Play(44100);
}
}
import UnityEngine
import System.Collections
[RequireComponent(AudioSource)]
class example(MonoBehaviour):
def Start():
audio.Play()
audio.Play(44100)