Hi!
How can i connect AudioAnalyserNode at SoundSource?
@dave , you’re consulted me about this problem already, but i don’t remember how solve it.
I do it like this:
initialize: function () {
this.context = app.systems.audiosource.manager.context;
this.audio = this.entity.audiosource;
this.anal = this.context.createAnalyser();
if(this.isPlay){
this.audio.activate = true;
this.audio.play(this.audio.currentSource);
this.connectAnal();
}
},
connectAnal: function() {
this.channel = this.audio.channel;
if(this.channel && this.channel.source){
this.channel.source.disconnect();
this.channel.source.connect(this.anal);
this.anal.connect(this.channel.gain);
this.channel.gain.connect(this.context.destination);
this.anal.fftSize = 2048;
var bufferLength = this.anal.frequencyBinCount;
this.data = new Float32Array(bufferLength);
console.log("analyser connected");
}
},
But this.data
is filled with -100 always.