Sound latency

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
bd525
Posts: 21
Joined: Sun Aug 31, 2014 12:43 am

Sound latency

Post by bd525 » Sun Aug 31, 2014 1:07 am

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!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5026
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Sound latency

Post by jacque » Sun Aug 31, 2014 5:57 am

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bd525
Posts: 21
Joined: Sun Aug 31, 2014 12:43 am

Re: Sound latency

Post by bd525 » Sun Aug 31, 2014 10:59 pm

Thanks, Jacque, that's helpful. I'll start figuring out how to do that testing.

Bruce

rinzwind
Posts: 131
Joined: Tue May 01, 2012 10:44 am

Re: Sound latency

Post by rinzwind » Fri Jan 13, 2017 11:04 am

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.

Post Reply

Return to “Rich Media”