W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

Re: how to detect the end of a playing sound ?

From: Nick Thompson <ncthom91@gmail.com>
Date: Wed, 31 Oct 2012 12:50:19 -0400
Message-ID: <CAOXEKCOVtK7sUce8FsDjvibMDiZ_fUm=a3_KgwSxZR+JNYkFCg@mail.gmail.com>
To: Gabriel Cardoso <gabriel.cardoso@inria.fr>
Cc: Jerome Etienne <jerome.etienne@gmail.com>, public-audio@w3.org
Hi all,

I agree with you both, I think that would be a useful feature, but it leads
me to a question. Are there performance implications for creating a buffer
source node, connecting it to context.destination, calling noteOn(0), and
then forgetting about it? As in, would I see improved performance if I
specifically found all samples that were playing, whose buffer has ended,
and turned them off via noteOff or disconnected them from the destination

Aside from that, Jerome, to your question, potentially a better way of
handling your situation would be to load your mp3 buffers, and then create
a new empty AudioBuffer whose length is the sum of your mp3 buffers'
lengths, and just copy each buffer into the new array in sequence. Then you
could push the large buffer into a BufferSourceNode, and even take
advantage of the "loop" parameter. Maybe you'd find that useful?


On Wed, Oct 31, 2012 at 7:54 AM, Gabriel Cardoso

> Hi !
> +1 for that.
> I also think such an event would be comfortable.
> Gabriel
> Le 31 oct. 2012 à 12:39, Jerome Etienne a écrit :
> > Hello,
> >
> > i would like to play multiple sounds (songs in mp3) one after the other..
> Is there a way to detect the end of a playing sound ? an event endOfSound
> or something like that ?
> >
> > Currently i storing the duration of the currently playing sound, do a
> settimeout which is triggered after this time, when it is triggered, i stop
> the current sound and start the new one... rather clumsy. is there a better
> way ?
> >
> > Jerome
Received on Wednesday, 31 October 2012 19:04:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:14 UTC