So I am having a problem where I am trying to create a web-audio source node from a tag. The Code Looks Like this:
OBJECT.musicContext= new webkitAudioContext();
OBJECT.audio = new Audio();
OBJECT.audio.src = self.file;
OBJECT.source = OBJECT.musicContext.createMediaElementSource(OBJECT.audio);
var analyser= OBJECT.musicContext.createAnalyser();
analyser.fftSize=1024;
OBJECT.analyser=analyser
OBJECT.gain = self.musicContext.createGain();
OBJECT.gain.gain.value = .01
OBJECT.source.connect(OBJECT.gain)
OBJECT.gain.connect(OBJECT.analyser)
OBJECT.analyser.connect(OBJECT.musicContext.destination)
OBJECT.play = function(){OBJECT.source.play();}
OBJECT.stop = function(){OBJECT.source.stop();}
The problem is with the last two lines. I can't seem to get the audio to play through the webkit audio context...
If I do
OBJECT.play = function(){OBJECT.audio.play();}
the sound will start playing, but not through the audio node (which makes sense)
I have also tried
OBJECT.play = function(){OBJECT.source.noteOn(0);}
OBJECT.stop = function(){OBJECT.source.noteOff(0);}
to no avail...
Any help or suggestions are greatly Appreciated, and thanks in advance for your time!
Isaac
EDIT: when console.logging OBJECT.source is claims that there are zero inputs and 1 output. Is this correct for a source node?