Re: Web Audio API questions and comments

Den 2012-06-19 19:01:44 skrev Joe Turner <joe@oampo.co.uk>:

> Hey Chris,
> Thanks for the reply,
>
> On Tue, Jun 19, 2012 at 5:34 PM, Chris Wilson <cwilso@google.com> wrote:
>> Hey Joe - I can respond to a couple of these.
>>
>> On Tue, Jun 19, 2012 at 7:39 AM, Joe Turner <joe@oampo.co.uk> wrote:
>>>
>>> - Operator nodes, AudioParam nodes
>>>
>>> Can we have separate nodes for the basic mathematical operators (add,
>>> subtract, divide, multiply and modulo), and a way of having the output
>>> of an AudioParam as a signal?  This would allow all the flexibility
>>> needed for scaling, offsetting and combining signals in order to
>>> control parameters.  I know a bit of trickery can make stuff like this
>>> possible at the moment, and it's trivial to implement in JavaScript,
>>> but it seems like core functionality to me.
>>
>>
>> Actually, you should be able to do all of these operations by either
>> connecting nodes together (add and subtract - might need a waveshaper to
>> flip phase for subtract), using gainNodes (multiply and divide) - not  
>> sure
>> about how you'd use modulo.
>>
>
> Yeah - it just seems a little ugly having to use waveshapers for
> subtraction, and a scaled non-oscillating oscillator to add a dc
> offset to a signal.  Operator nodes and some way of outputting
> parameters seems like a cleaner way to do this to me.

For general operators, I think you'd want to be able to do simple  
mathematical expressions, such as:

  y = 2 - 3 / (2 + x)

It seems to me that JavaScript is the most logical choice here, since it  
gives you freedom of expression, especially if you can come up with a  
small framework to easily create "operator nodes" with one-liners (which I  
believe should be possible).

/Marcus


-- 
Marcus Geelnard
Core Graphics Developer
Opera Software ASA

Received on Wednesday, 20 June 2012 08:33:57 UTC