- From: Chris Rogers <crogers@google.com>
- Date: Tue, 3 Apr 2012 13:19:54 -0700
- To: Chris Lowis <chris.lowis@bbc.co.uk>
- Cc: public-audio@w3.org
- Message-ID: <CA+EzO0nUsgUMu1aAnDa56z-vgYjcc0WtVDxMvcf1Hm3bbBqQPA@mail.gmail.com>
On Tue, Apr 3, 2012 at 8:31 AM, Chris Lowis <chris.lowis@bbc.co.uk> wrote: > Hi, > > In the process of working up some simple synthesis examples, I've come > across some behaviour I don't understand. Perhaps Chris, Raymond or someone > familiar with the Web Audio API can help. > > I'm trying to create a JavaScriptAudioNode that adds two mono signals > together (generated by my javascript node-based sine wave generator). > > When I execute: > > context = new webkitAudioContext > node = context.createJavaScriptNode(**1024, 2, 1) > > I see that 'node' has > > numberOfInputs: 1 > numberOfOutputs: 1 > > (at least in Chrome 18.0.1025.142) > > Is it possible at the moment to create javascript nodes with multiple > inputs and outputs? > > In general what's a good way of working with mono signals? I admit to > being a little unsure of the best way to use the various splitter and > merger nodes. > > Best, > > Chris > Hi Chris, a JavaScriptAudioNode always has one input and one output (the input can be ignored and not connected). There's a distinction between numberOfOutputs (which is always 1) and numberOfChannels (for this single output). For example in the real-world there are stereo 1/4" cables. So although it's a single cable (or bus) it carries two channels and can be plugged into a stereo output jack. Another real-world example is an HDMI cable, which can carry 5.1 channels even though you plug it into a single output connector on your surround-sound receiver. I should point out that there *is* a bug in createJavaScriptNode() in WebKit where it silently ignores the 2nd two arguments (number of input and output channels). So in your example, you're wanting to output 1 channel. But, the implementation continues to generate 2 channel output. But, that's a bug - not how it's supposed to work. Chris
Received on Tuesday, 3 April 2012 20:20:24 UTC