Fast playing sounds (SOLVED)

I have a “Price is Right” type wheel that plays a sound everytime a section of the wheel passes the selector arrow. I am using a collision trigger to determine when the section passes the selector arrow. My problem is that when the wheel spins fast, the audio plays erratically. I expect the audio to play a fast series of beeps and when the wheel slows down the beeps also should slow down. The beeps do sync up with the wheel sections only when the wheel is spinning very slowly.

I don’t think this is a gated issue since I am stopping the audio when the next wheel section begins playing a sound. What is the fastest rate I can play the audio to indicate the wheel section has passed the selector arrow?

Thank you.

1 Like

Are you seeing this behavior on mobile testing? Mobile will have audio lag.

If on desktop please upload a sample project.

I use FMOD extension for audio now because of other issues with builtin audio.

1 Like

Will pull relevant code from my project and create a sample project for inspection. If I activate the looping property, it does seem to work better but there is a delay on desktop. I haven’t packaged for mobile yet, so thanks for the heads up.

Thanks. Please do. Are you using wav or ogg for the sounds?

Here’s my code.

https://davidoshiro@bitbucket.org/davidoshiro/wheel_audio_test.git

I am using wav files. The weird part is that sometimes when I press the Spin button the sounds play right away. Other times the sounds do not play for a few seconds. I’m wondering if using the collision trigger is too fast for the sound to play.

Thank you for your assistance.

Well, if a collision object on the wheel moves too fast it may move right through the collision object you use when detecting the entries passing by.

The weird thing is that when the sound does play, the speed is not an issue. The thing that is frustrating me is that sometimes the sound plays as soon as I press the Spin button, and sometimes there is a several second delay. The delay doesn’t happen all the time which makes it difficult to troubleshoot.

The problem is you made your collision shapes all 5x5 pixels, so 90% of the time they are skipping over each other between frames. Sometimes it works, if you hit the button at just the right time so they happen to overlap on the frame. With a constant speed, framerate, and distance, if it’s skipping over them when you press the button, it will continue to do so until it changes speed, hence the long silence.

Make your collision shape in ‘entry.go’ larger, so it fills the whole size of the box (or a little bit shorter so they don’t all overlap), and it seems to work fine.

5 Likes

Ahhh! Great idea! Will give it a try! Thanks!

2 Likes

ross.grams Thanks! this seems to have solved my problem. I enlarged the collision trigger size and the audio is playing correctly. Appreciate the help!

1 Like