I want to use the Analyser in the audio of a video texture, so I tried to use the project, at the link below, that has an audio, with an Analyser, and a video playing simultaneously, in which I disabled the Analyser on the audio script and copy it code to the video script but without success.
Someone can help?
Overview | Dashboard | Spatial Audio test | PlayCanvas | 3D HTML5 & WebGL Game Engine
Not used this but just having a quick debug:
track.connect(analyser).connect(gainNode).connect(stereoPanner).connect(panner).connect(context.destination);
analyser
is undefined when this code is executed which is why you are getting the error in the launch tab.
@yaustar
Well, so the context.createAnalyser() function is not working because the source is a video and not a audio, right?
Some clue how to manage this?
I don’t know much about the Audio API, I can only really help with the runtime code errors.
This is still an issue. You’ve created an analyser in the initialise function but its assigned to a local variable and not a property to the script instance.
var analyser = context.createAnalyser();
After fixing this and adding an ‘bar’ entity as a child of the TV, it looks fine now ?
Project: https://playcanvas.com/project/1005908/overview/f-spatial-audio-test
1 Like
@yaustar
Sorry again by my ignorance!
It is working like a charm!
Thanks a lot, it was a great help!