W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2012

Re: audio delay node max delay time

From: Chris Rogers <crogers@google.com>
Date: Thu, 16 Feb 2012 11:41:25 -0800
Message-ID: <CA+EzO0=A7b+=VRpmv=bCXWrM9361QnEpM4-ZHLhQp2JM0gDXwA@mail.gmail.com>
To: Michael Schöffler <michael.schoeffler@audiolabs-erlangen.de>
Cc: Yotam Mann <yotammann@gmail.com>, public-audio@w3.org
On Thu, Feb 16, 2012 at 9:10 AM, Michael Schöffler <
michael.schoeffler@audiolabs-erlangen.de> wrote:

> > So the AudioContext createDelayNode() method could take an optional max
> delay time which is greater than 1 second.
> > Although this value could be somewhat greater than 1 second, we may want
> to consider some reasonable (but large)
> > upper limit, since it does consume memory.****
>
> ** **
>
> Figuring out a good upper limit seems not easy to me. If I get it right,
> for one second 48000samples x 4byte(float) = ~187KiB of memory is needed
> for storing the delayed samples. If we set the limit to 100 seconds, a
> delay node will need about 18MiB for storing the delayed samples. That’s
> too much for mobile phones, but not that much on workstations. (In general)
> I think the limit should be device-dependent. Using a device-dependent
> limit means that the developer/script needs to know about it.  Therefore an
> additional function or return value is needed.
>

You might be right about that, so perhaps the upper-limit is not that
important and we should just fail differently according to device...

I think it's possible to allocate some quite large ArrayBuffers right now,
and I suppose there no hard-coded limit there...

So then we have:

var delay = createDelayNode(maxDelayTime);

(where maxDelayTime has no upper bound - for some large values might fail
on mobile device and succeed on desktop)



> ****
>
> ** **
>
> But do we really need a delay node? A JavaScriptNode can also do the job.
> Maybe some additional operations on AudioBuffer would be handy for
> processing the delay (e.g. inplace copy).
>

Sometimes you want a simple delay that "just works".  A JavaScriptAudioNode
has a latency of its own, so adds an additional delay to the actual desired
delay, so this is not very ideal, especially when you want the delay time
to be exact, and when you want to mix/blend the delayed signal with the
low-latency processing chain.

Although the DelayNode itself performs a simple operation (and commonly
needed one).  If you want to build more complex delay effects, like
BPM-synchronized delays, ping-pong delays, multi-tap delays with
spatialization on each tap, feedback delays with distortion and low-pass
filters in the feedback loop etc.  Then it's quite easy to do and quite a
rich possibility of effects can be achieved.



> ****
>
> ** **
>
> (I hope my memory calculation is correct and I have no error in reasoning
> there)****
>
> ** **
>
> Regards,****
>
> Michael****
>
> ** **
>
> ** **
>
Received on Thursday, 16 February 2012 19:41:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 16 February 2012 19:41:59 GMT