Re: Web Audio API spec: readonly & LFO

Ashley,

1) You're confusing the AudioParam member with the AudioParam's *value*.
 You can, in fact, change gainNode.gain.value - what you can't do is set
gainNode.gain to some other AudioParam (or to null).  The indirection of
AudioParam is very valuable, but it does seem counterintuitive to see
"readonly" there.  It doesn't mean the value of the gain node's gain cannot
be changed, though.  The *values* of the parameters you mention are not
readonly - that's not a workaround, it's the way the API is designed.

Not sure why writing to a .value in this case would throw in iOS - do you
have a code sample I could look at?

2) As Matt said, to implement an LFO with a specific range, use a gain node
to scale the -1...1 range.  Check out the synth sample I did (
http://webaudiodemos.appspot.com/midi-synth/index.html), and how it sets up
the LFO: the "modOsc", around line 423 in
https://github.com/cwilso/midi-synth/blob/master/js/synth.js, is the LFO,
and you can see how it gets connected through gain nodes to various
parameters.

-Chris


On Thu, Feb 28, 2013 at 9:56 AM, Matt Diamond <mdiamond@jhu.edu> wrote:

> I can't speak to point #1, but I'll just say that in terms of creating an
> LFO, I assume the usual method is Oscillator --> GainNode --> AudioParam,
> which provides you with control over the amplitude of the LFO.
>
> Matt Diamond
>

Received on Thursday, 28 February 2013 18:09:18 UTC