I'd like to connect the oscillator output to the canvas draw() function to create an oscilloscope but I cant get the logic right how to properly connect the audiostream. I want to use the oscillator as source and connect it with the analyser, createMediaStreamSource(oscillator) result in a parameter not supported and just connecting like the script is now it is not doing anything.:
// create Oscilloscope ***OSCILLOSCOPE***
var analyser = audioCtx.createAnalyser();
var canvas = document.getElementById('scope');
var canvasCtx = canvas.getContext("2d");
var WIDTH = canvas.width;
var HEIGHT = canvas.height;
// setup scope buffer
analyser.fftSize = 2048;
var bufferLength = analyser.frequencyBinCount;
var dataArray = new Uint8Array(bufferLength);
// connect audiosource
oscillator.connect(analyser);
analyser.connect(audioCtx.destination);
here's a fiddle of the whole idea: https://codepen.io/silconsystem/pen/xMMwgJ
I hope one of youze can put me in the right direction, thanx for your time in advance
Cheers, rob