Sonidos libres (Freesound )
Trigger a sound
lays the clip with an optional certain delay.
The delay parameter is deprecated, please use the newer PlayDelayed function instead which specifies the delay in seconds.
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).
Note: The AudioSource.PlayScheduled API will give you more accurate control over when the audio clip is played.
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).
Note: The AudioSource.PlayScheduled API will give you more accurate control over when the audio clip is played.
@script RequireComponent(AudioSource) function Start() { audio.Play(); // Delay a clip by 1 sec (44100 samples) audio.Play(44100); }
Description
Plays an AudioClip, and scales the AudioSource volume by volumeScale.
@script RequireComponent(AudioSource) // Play impact audio clip at volume 0.7 var impact : AudioClip; function OnCollisionEnter () { audio.PlayOneShot(impact, 0.7); }
See Also: AudioSource.Play.
Description
Plays an AudioClip at a given position in world space.
This function creates an audio source but automatically disposes of it once the clip has finished playing.
@script RequireComponent(AudioSource) public var clip : AudioClip; //make sure you assign an actual clip here in the inspector function Start() { AudioSource.PlayClipAtPoint(clip, new Vector3 (5, 1, 2)); }
No hay comentarios:
Publicar un comentario