Web Audio API spec: readonly & LFO

Hi all, this is my first mail here, hope I got the right address for this.

I've been implementing an audio engine with the Web Audio API and have
found two issues:

1) 'readonly' is used in several places in a way that makes the attribute
useless.  For example GainNode specs its gain as readonly. If you can't
change it, nor can you pass an initial value in createGain(), then surely
the node is useless. So is it supposed to always be stuck on a gain of 1?
Luckily in Chrome and iOS I can write to it (via the "value" member),
seemingly contrary the spec. But with BiquadFilterNode the frequency,
detune, Q and gain values are all defined readonly, and I can write to them
in Chrome, but writing to them on iOS throws a "TypeError: attempted to
assign to readonly property". So it seems I can only get a filter with
default parameters on iOS. The spec even discusses changing the frequency
over time, so I assume these are supposed to be writable. But there already
seems to be confusion in implementations, and it's hard to argue that iOS
is broken if the spec says they're readonly. Shouldn't this be changed?

2) There doesn't seem to be an easy way to make an LFO. Connecting an
oscillator to an AudioParam would be a good route, but it seems normalised
to a [-1, 1] scale, whereas I might want something oscillating in the
[1000, 2000] range for a frequency parameter. createWaveTable() also
appears to deliberately normalise the wave to [-1, 1], and writing an LFO
wave via setValueCurveAtTime() doesn't easily support sample-rate ramping
(for example if you wanted to linearly ramp the LFO frequency from 5 Hz to
0.25 Hz over 3 seconds, like linearRampToValueAtTime() can). What's the
recommended way to implement an LFO or was it determined out of the scope
of the spec? (IMO it should definitely be a part of the spec - 'minValue'
and 'maxValue' parameters on OscillatorNode seems a sensible way to do it.)

Everything else is looking pretty good with the spec though so kudos for
coming up with a great API.

Ashley Gullen
Scirra.com

Received on Thursday, 28 February 2013 16:03:34 UTC