Generate audio using JavaScript

You can generate audio on the browser without the src attribute or source elements by using methods defined by the Mozilla Audio Data API

It has limited support. Only Firefox 4+ and Chrome Beta currently support it.

mozSetup(channels, sampleRate)Defines the channels and sample rate for the generated audio stream
mozWriteAudio(buffer)Writes the samples, from an array, for the generated audio
mozCurrentSampleOffset()Gets the current playback position of the audio, denoted in samples

Related Tutorial
Follow Us #