Sound pause

Monkey Forums/Monkey Beginners/Sound pause

Xyle(Posted 2014) [#1]
I am currently porting over my java game I wrote which I was porting to android.

One of the sounds I use is a horse gallop sound. As the character runs faster, the sound plays faster.

In Java I had to load different sound files, each one the same sound just at different speeds, and this worked great.

Using the android SDK, I was able to use a single sound file and modify the bitrate based on player speed.

With Monkey, I did the same thing, but there seems to be a major pause before a sound gets played so it seems to be laggy or skipping.

Worse case, I will go back to using different sound files and speed rates to accomplish the same effect, just hoping I could use the current monkey tools to get the same effect.

If anyone has any insights, that would be great!
Thanks!


AdamRedwoods(Posted 2014) [#2]
android uses the SoundPool class:
http://developer.android.com/reference/android/media/SoundPool.html

do you have examples of the program you are using? some ideas: are you loading your sounds first, then playing after they are loaded? is this for a different target like html5 (which has been known to be buggy)?


Xyle(Posted 2014) [#3]
I am loading the sounds at startup. All the sounds work fine, except for a gallop sound that loops, the faster the character runs, the faster the sound plays by changing the rate of the sound.
I applied the change to mojo.html5.js as described here, http://www.monkey-x.com/Community/posts.php?topic=5829, for html5 targets and the rate changing works. I just dont know if its working like its supposed to.

Worse case, I may go back to using the different sounds for different speeds to make it go smooth for html5.

Ultimately I am going to wait and see how it sounded when I used MonkeyX to port it to android. If everything works good there I will be happy.

Thanks for the help!


Xyle(Posted 2014) [#4]
Well, after finally getting everything setup right and get it ported to Android, it works great, so I would have to agree, HTML5 sound is buggy and funky, lol!

Thanks again for the input!