• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Delay in pressing key to playing sound

Z

zigzagger

Guest
Hi everyone! I'm making a music based game in which pressing a key generates a short sound. The game requires pressing of the key in rapid succession, so there must not be much delay in generating the sound.

Unfortunately, the delay from pressing the key to generating the sound is noticeable enough to affect rhythm. Below is my code in the Step.

if keyboard_check_pressed(ord('A')){
audio_play_sound(snd_battle_key_a, 10, false);
}

Does anyone know how to decrease or eliminate the delay? thanks
 
W

whale_cancer

Guest
Does your sound itself have a delay at the beginning? You might need to edit your sound. That;s the only problem I can see.
 
Z

zigzagger

Guest
Hey I made sure that it does not have a delay in the beginning.
What a quick reply!
 
W

whale_cancer

Guest
Hmmm, I don't know then. If you send me the sound I can take a look (no point in me testing the code with a different sound than you are using).

Edit: Oh, and roughly how long would you say the delay is?
 
Z

zigzagger

Guest
Sure I just sent you a link for the sound. I'm not sure about the delay, maybe 200 milliseconds?
 
W

whale_cancer

Guest
Sure I just sent you a link for the sound. I'm not sure about the delay, maybe 200 milliseconds?
I didn't hear any delay when making a blank project and using your code and sound. When editing in audacity, I see there are 28 milliseconds of silence at the beginning. If you are hearing the 28 milliseconds, you have a better ear than I. If it is longer than that, your problem is elsewhere.

EDIT: I checked for the keypress in the anykey keyboard event. I assume you put yours somewhere similar like step.
 
Z

zigzagger

Guest
yes mine is the step event. thanks for your input! i'll see if I can figure it out
 
Top