javascript - Web Audio API AudioParam.value not logging -
i trying figure out how read current value of audioparam. when audioparam being modified audionode through audionode.connect(audioparam), doesn't seem effect audioparam.value.
here example: have oscillator (source) connected gainnode (gain). have oscillator (mod) routed gainnode (modamp). modamp connected gain.gain. have meter gain.gain, changing textbox display gain.gain.value when play oscillator, gain audibly moving , down, meter stays constant original setting. how can real-time reading of audioparam?
http://jsfiddle.net/eliotw/3o0d0ovs/4/ (please note have run script every time want run oscillator)
//create audio context window.audiocontext = window.audiocontext || window.webkitaudiocontext; var context = new window.audiocontext(); //create source , gain, connect them var source = context.createoscillator(); var gain = context.creategain(); source.connect(gain); //create modulator , gain , connect them var mod = context.createoscillator(); var modamp = context.creategain(); mod.connect(modamp); //connect modulator gain node audio param modamp.connect(gain.gain); //connect audio context gain.connect(context.destination); //source values source.frequency.value = 220; gain.gain.value = 0.5; //mod values mod.frequency.value = 6; modamp.gain.value = 0.5; source.start(0); mod.start(0); setinterval(function() { console.log(gain.gain.value); }, 600 );
you can't, really. way connect script processor node or analyzer node , @ output bits. latter (using getfloattimedomaindata) how i'd it.
Comments
Post a Comment