Page 1 of 1

Sound latency

Posted: Sun Aug 31, 2014 1:07 am
by bd525
I'm considering moving a Director project to LiveCode. The project involves short sound files in quick succession and thus requires low latency between sounds. I've done some initial testing (MacBook Pro, OS 10.9.4) and results are almost always unsatisfactory: more than .1 second delay between sound files. At one point, though, latency was excellent: almost no delay between sounds. I don't remember doing anything differently at the time. Is this variability just by chance, or did I possibly take the right step(s) by serendipity? Is there a way to ensure good results? I've done a lot of searching on preloading and queueing, but those don't seem to be defined functions. And sounds don't stay loaded. Performance doesn't improve on repeated triggering of the same sound file.

I note some forum posts about improving latency on the iOS side, and that is indeed where I need my new project to go. Must I learn to deploy to an iOS app and implement these schemes to get an idea of how good performance will be? Perhaps a reader has some experience. Is it reasonable to expect latency well below .1 second?

Thanks!

Re: Sound latency

Posted: Sun Aug 31, 2014 5:57 am
by jacque
If you're headed to iOS, you want to use sound channels. You can queue two sounds so that the moment the first one is done the next one plays. When that happens, you queue up the third one, and keep going like that until they're all played. See all the mobile sound commands in the dictionary, particularly mobilePlaySoundOnChannel. That's what you'd use to preload and queue sounds.

Unfortunately this isn't available on desktop so you'll need to test it on a device. Or you can test in the emulator without joining the iOS developer program, but I'm not sure if playback will be as accurate there as it is on a device.

Re: Sound latency

Posted: Sun Aug 31, 2014 10:59 pm
by bd525
Thanks, Jacque, that's helpful. I'll start figuring out how to do that testing.

Bruce

Re: Sound latency

Posted: Fri Jan 13, 2017 11:04 am
by rinzwind
Late reply... Even there you have latency. Its bad that theres still no way to have robust instant sound playback. The app just pauses a fraction of a second while the sound is loaded, even when the same sound has already played dozens of times.