Connect AudioAnalyserNode

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.

Hi @Konstantin_Timoshenk.
We are right now finalising new Audio API, that will make it way easier to deal with nodes, just bear with us, and in upcoming week/or few you’ll get few tutorials to do exactly what you are trying to do.

Check out today’s new release!

In particular see: http://developer.playcanvas.com/en/api/pc.SoundSlot.html#setExternalNodes

1 Like