j_d
j_d

Reputation: 3082

Web Audio API filter not working in Safari

I am in the process of developing an HTML5 canvas interactive piece that uses Createjs and the Web Audio API. I've managed to get audio working in Chrome/Firefox/Safari despite the deprecation of webkitAudioContext by Chrome and FF but not Safari. However, filters for some reason are not working in Safari, but sound still plays. Filters DO work in Chrome/FF.

I have my filters set up like this:

var sound = new Audio();
sound.src = './sounds/sound.mp3';
sound.autoplay = false;
sound.loop = true;
soundSource = context.createMediaElementSource(sound);
var soundFilter = context.createBiquadFilter();
soundFilter.type = "lowpass";
soundFilter.frequency.value = 500;
soundSource.connect(soundFilter);
soundFilter.connect(context.destination);

Am I unknowingly using a deprecated term or something? Live project can be found here. Cheers.

UPDATE: This has been recognised as a genuine bug by the WebKit team, and will be patched. Full details here

Upvotes: 3

Views: 606

Answers (1)

aldel
aldel

Reputation: 6748

Apparently Safari doesn't implement createMediaElementSource correctly. So instead of redirecting the sound through your Web Audio nodes, it still just plays the sound directly to the audio device.

Is there any particular reason why you can't use a BufferSourceNode? It makes you jump through extra hoops to get the sound file and decode it, but it should work.

Upvotes: 4

Related Questions