Audio
rickierich

I switched to the basic html5 audio system, and I have noticed that, they cannot loop in the seamless way the wade system does. How did you do that please. Your looping basically without a gap, with MP3s, could you explain what the wade system is doing to manage that.

Or am I missing something in javascript.

1 Comment
Gio

Hi

The easiest thing would be to look in wade's source code (in wade.js there is a function called playAudio).

In short, we have 2 different implementations

The one that you are most likely to use is based on the WebAudio API, but there is another one based on plain HTML5 audio that is used where WebAudio is not supported. These days, WebAudio is supported by over 95% of devices.

In the WebAudio implementation, you create a BufferSource and assign it an audio buffer. You then set the loop property of the source to true, connect the source to the WebAudioContext's destination, and start the source:

var audioContext = new AudioContext();
var audioBuffer = wade.getAudio(file);
var source = audioContext.createBufferSource();
source.buffer = audioBuffer;
source.loop = true;
source.connect(audioContext.destination);
source.start(0);

 

Post a reply
Add Attachment
Submit Reply
Login to Reply