Hi Jonathan,
You say: The sounds are MP3s which are load()ed into Sound objects on
init().
Does this mean you preload the sounds? If so; If you press a key
before the whole sound is loaded in it takes some time to play it,
because it is still loading. You can make sure of this by showing the
application AFTER all the sounds are loaded in, this can be done by
creating a loader que (place items in an array after they are loaded
and check if the total amount of items loaded in is equal to the array
length).
This way you always know that nothing shows up before all the sounds
are loaded.
Hope this helps you,
Sid
On Dec 8, 2008, at 4:31 PM, jonathan howe wrote:
I'm very interested in the solution to this. I notice it on certain
machines
and not others... it does not seem to have anything to do with the
input
part, and in some cases can stutter the display updating. For
example, if
you were to have a timer trigger the sound and print something at the
screen, they would both 'appear' at the same time but if you also
measured
the time difference between the trigger's execution and after the
sound
call, there would be latency.
The superstitious/uneducated part of me supposes that Flash is
establishing
a modal call to the sound card, and some perform cards respond
faster than
others.
-jonathan
On Mon, Dec 8, 2008 at 2:37 PM, allandt bik-elliott
(thefieldcomic.com) <
[EMAIL PROTECTED]> wrote:
did you use updateAfterEvent() to force it to play immediately? if
not, it
might be waiting for the next frame to process the event
On Mon, Dec 8, 2008 at 12:14 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:
Hi List,
I'm dipping my toe into AS3 and thought I'd play around with sound
by
making
a little "piano keyboard" which is played by pressing keys on the
computer
keyboard.
It works - the appropriate sounds play on KeyboardEvent.KEY_DOWN -
however,
I've noticed that there is often a lag between the keyboard event
and the
actual sound playing. The occurrence of the lag seems pretty random.
The sounds are MP3s which are load()ed into Sound objects on
init(). On
KeyboardEvent.KEY_DOWN, the appropriate Sound is play()ed.
I've checked all the MP3s, and they don't have extra silence at the
beginning. I don't think it has to do with the number of MP3s
involved
(14),
because I noticed the lag even when I was testing it out with 2
sounds.
Has anyone dealt with this before, and know what the problem might
be?
You
can see (or rather, hear) the lag for yourself here:
http://snipurl.com/7ndr2-meep
Thanks!
In hope,
CB.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
-jonathan howe
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Sidney de Koning
Flash / AIR Developer @ www.funky-monkey.nl
Technical writer @ www.insideria.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders