- Home /
How can i make my audio loop faster/slower?
Hey guys i have a footstep sound that i continually loop when when pressing W. The problem though is that it takes about 2 seconds before it starts playing again and sounds really weird and ugly. Do you know how i can set like the time between loops so that my footsteps starts instantly after it fnished? thanks!
how about shortening the sound sample?
you could try this too
You can make your own timer that calls AudioSource.PlayOneShot after a certain time, and that should avoid any problems with the clip cutting off. Example:
AudioClip footstep;
float repeatTime = 1.2f;
float timer = 0f;
void Update(){
if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.W)){
timer += Time.deltaTime;
if (timer >= repeatTime){
audio.PlayOneShot(footstep);
timer = 0;
}
}
}
Or you could use an animation event in your animation clip to let the sound play at the key frame when the foot touches the ground.
Your answer
Follow this Question
Related Questions
Random footstep sounds not looping 1 Answer
Audio loops too early 2 Answers
Stop sound on input.getkeyup 1 Answer
AoTTG - Modding with Visual Basics + .NetReflector SFX Mod 0 Answers
Random footsteps 5 Answers