Home:ALL Converter>Creating Audio Effects with Web Audio is an output node necessary?

Creating Audio Effects with Web Audio is an output node necessary?

Ask Time:2013-10-20T05:54:56         Author:Aptary

Json Formatter

I'm reading about custom audio effects with web audio: http://www.html5rocks.com/en/tutorials/casestudies/jamwithchrome-audio/

An example they give is this delay loop

enter image description here

var SlapbackDelayNode = function(){
    //create the nodes we’ll use
    this.input = audioContext.createGainNode();
    var output = audioContext.createGainNode(),
        delay = audioContext.createDelayNode(),
        feedback = audioContext.createGainNode(),
        wetLevel = audioContext.createGainNode();

    //set some decent values
    delay.delayTime.value = 0.15; //150 ms delay
    feedback.gain.value = 0.25;
    wetLevel.gain.value = 0.25;

    //set up the routing
    this.input.connect(delay);
    this.input.connect(output);
    delay.connect(feedback);
    delay.connect(wetLevel);
    feedback.connect(delay);
    wetLevel.connect(output);

    this.connect = function(target){
       output.connect(target);
    };
};

My question is this: Is there any compelling reason to have the output gain node? Wondering if it's there for educational reasons, or if it is actually serving a purpose which I've not grasped.

You could directly connect the wetLevel node to the target, and that would save you having to create the output node.

 this.connect = function(target){
      wetLevel.connect(target);
 };

Author:Aptary,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/19471585/creating-audio-effects-with-web-audio-is-an-output-node-necessary
yy