W3C home > Mailing lists > Public > public-audio@w3.org > April to June 2012

Re: Web Audio API questions and comments

From: Anthony Bowyer-Lowe <anthony@lowbroweye.com>
Date: Thu, 21 Jun 2012 11:21:40 +0100
Message-ID: <CAMCSOPXK6zPXN8Jp8YgEMafQS_tHSWA_CzT-xWeB8s4VPZdomg@mail.gmail.com>
To: Joe Turner <joe@oampo.co.uk>
Cc: Chris Rogers <crogers@google.com>, public-audio@w3.org
>
> I think my last question on this is what is the recommended way of
> creating the equivalent to variables?  So say I wanted to add a dc
> offset of 50 to a signal, am I expected to use a JavaScriptAudioNode
> which outputs 50s, waveshape an oscillator so it outputs 1 and use an
> AudioGainNode to scale it up to 50, or do something else clever which
> I haven't thought of?  I still think a node which just outputs the
> value of an AudioParam would be nicer than either of these two
> solutions.
>

I'd just use a WaveShaperNode here of f(x) = x + 50

I've currently got a (hacky) helper function in my toolbox that creates
WaveShaperNodes from arbitrary JS transforms for this kind of thing, and I
fully expect such a thing to become an essential and integral part of every
non-trivial Web Audio framework.

(Of course, why you'd want to add a DC offset in the first place to an AC
signal is something of mystery to me but exploratory DSP respects no
limits.)


Anthony.
Received on Thursday, 21 June 2012 10:22:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 21 June 2012 10:22:29 GMT