javascript - Web Audio onaudioprocess works in Firefox, JSFiddle in Chrome, but not Chrome Itself -


i'm working in chrome 39.0.2171.71 (64-bit) on webaudio/webmidi app. have jazz-soft webmidi plugin installed.

i'm having trouble getting onaudioprocess fire @ all. i've stripped things down basic code:

<!doctype html> <html lang="en">     <head></head>     <body>         page loaded.         <script>              var context;              if (window.audiocontext) {                  context = new audiocontext();               } else {                  context = new webkitaudiocontext();               }              console.log('javascript working.');               oscillator = context.createoscillator();              oscillator.start(0);               myscriptnode = context.createscriptprocessor(4096, 1, 1);              myscriptnode.onaudioprocess = function(event) {                   console.log('onaudioprocess works!');              };               oscillator.connect(myscriptnode);          </script>      </body> </html> 

this works in firefox. in fact, of things i've been playing have worked in firefox, not in chrome. however, following 2 examples work me in jsfiddle running in chrome:

http://jsfiddle.net/78ykv/3/ (this example runs seems slow/spotty onaudioprocess callback, , cuts out , needs restarted.)

http://jsfiddle.net/99rxd/ (for example, have add third argument of function(){console.log('error');} getusermedia() make run. gives me uncaught reference error of r undefined when start it, runs , onaudioprocess callback works reliably.)

things i've tried

i've searched exhaustively, , seems there chrome scope issues createscriptprocessor. i've tried scope process global (declaring @ top, declaring without 'var', setting myscriptnode.onaudioprocess = window.audioprocess = function(event)) , nothing has worked. has worked in firefox.

the reason i'm holding on hope because of working jsfiddle examples. seemed main reason code works in jsfiddle , not in browser has waiting dom load. doubt problem, tried putting javascript in (function( /code/)();, adding oninit() function body tag , putting code in function init(){}, etc. no luck.

i have no idea going on. if works in jsfiddle, shouldn't able make work in browser? there way change scope eventhandler doesn't garbage collected (which assuming problem)... or there more basic going wrong? have yet see 1 callback using onaudioprocess work browser, makes me feel perhaps more basic scope/garbage collection problem. jazz-soft plugin?

thanks help!

chrome still has bug script processor needs connected destination.

add "myscriptnode.connect(context.destination);" end, , think you'll find works expected.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -