How to minimize delay when playing an audio clip

Chris Sheffield cs_livecode at icloud.com
Mon Aug 17 11:14:07 EDT 2015


Another trick that I’ve used in the past (when using players; I’ve haven’t used imported audio clips much) is to play a very short, silent audio file at some point in a preOpenCard or openCard handler. This kind of gets the audio ball rolling so to speak, then when I need to play my actual audio, there is no delay. Whatever needs to load in the background in order for audio playback has already loaded. A bit of a hack I suppose, but it works. :-)

Chris


--
Chris Sheffield
Read Naturally, Inc.
www.readnaturally.com

> On Aug 15, 2015, at 11:52 AM, Mike Bonner <bonnmike at gmail.com> wrote:
> 
> I have an audio clip that I'm using as a sound effect.  I try to trigger
> the play start FIRST in my game loop, but no matter what methods I try
> (even breaking it out of the game loop itself) there is a pretty hefty lag
> time before it starts playing.  Enough so that its possible to have an
> event happen, and stop the play of the clip before it ever starts.
> 
> I don't think i'm having issues with a bound cpu, I think 'play audioclip
> "myclip" looping' is just that slow.  If I hold the key down, it works
> fine, animation keeps up, and stop is pretty much instantaneous.  Is there
> a way to get this working better?  I'll try with an actual player next, but
> I thought having the clip as part of the stack would provide the best
> results.
> 
> 
> Also, a quick question..  I assume there is no way to modify the tone of a
> clip on the fly?  IE: Simulate doppler shift..
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list