Closed domeniko-gentner closed 5 years ago
Finally found it out myself. Here is the code if anyone runs into a similar issue:
if (snd== null)
{
snd= new buzz.sound(conf_station,{
formats: ['aac'],
preload: true,
autoplay: true,
loop: false,
crossOrigin: true,
webAudioApi: true,
volume: conf_volume
});
audioContext = buzz.audioCtx;
audioAnalyser = audioContext.createAnalyser();
audioAnalyser.fttSize = 40;
bufferLength = audioAnalyser.frequencyBinCount;
var dataArray = new Uint8Array(bufferLength);
audioAnalyser.getByteFrequencyData(dataArray);
snd.load().bind('canplaythrough', function(e){
this.source.connect(audioAnalyser);
snd.play();
})
}
// different function:
var array = new Uint8Array(audioAnalyser.frequencyBinCount);
audioAnalyser.getByteFrequencyData(array);
I am looking to create a media analyser with your library and require access to the audio context. Is there some way to get it? I couldn't find anything in the docs and the source is not easy to read for me. Thanks for the help.
Example: