Hi,
a colleague of mine noticed the same problem with attached sounds in as3.
He had to start music loops simultaneously and it turn out impossible by
actionscript alone, because of a random lag.
The only solution he found was to launch the sounds in the same keyframe
in the timeline.
Perhaps a timeline-based solution of your problem is possible: for
example using the keys to controls movieClips with different labels
(each label having one sound), and using updateAfterEvent as advised
previsously. Or, one clip per sound.
If it solves your problem, you can still control the volume of an
IDE-specfied sound by using the soundChannel property of movieClips.
Olivier
jonathan howe a écrit :
That part was actually confusticate's and I do believe that he was implying
that the sounds had load() called prior to the KeyboardEvent, and the
latency happens on the 100th keystroke as well as the first.
By way of comparison, I had the same problem in sounds attached from the
library.
I wonder if it would make a difference if new Sound objects (in AS2) or
SoundChannels (in AS3) were or weren't instantiated every time.
On Mon, Dec 8, 2008 at 4:49 PM, Sidney de Koning <[EMAIL PROTECTED]>wrote:
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
--
Olivier Besson (gludion) - (33 1) 44 64 78 99
http://wwww.gludion.com
http://blog.gludion.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders