Search completed in 1.13 seconds.
Introducing the Audio API extension - Archive of obsolete content
then the samples are written in the audio stream with the function
mozwriteaudio().
...you can see an example below: // write samples using a js array var samples = [0.242, 0.127, 0.0, -0.058, -0.242, ...]; var numbersampleswritten = audiooutput.
mozwriteaudio(samples); // write samples using a typed array var samples = new float32array([0.242, 0.127, 0.0, -0.058, -0.242, ...]); var numbersampleswritten = audiooutput.
mozwriteaudio(samples); in the following example, we create an audio pulse: <!doctype html> <html> <head> <title>generating audio in real time</title> <script type="text/javascript"> function playtone() { var output = new audio(); output.mozsetup(1, 44100); var samples...
... = new float32array(22050); for (var i = 0; i < samples.length ; i++) { samples[i] = math.sin( i / 20 ); } output.
mozwriteaudio(samples); } </script> </head> <body> <p>this demo plays a one second tone when you click the button below.</p> <button onclick="playtone();">play</button> </body> </html> the mozcurrentsampleoffset() method gives the audible position of the audio stream, meaning the position of the last heard sample.
...And 3 more matches
Creating a Web based tone generator - Archive of obsolete content
the function
mozwriteaudio() is called to write those samples produced in the audio stream.
... if(tail) { written = audio.
mozwriteaudio(tail); currentwriteposition += written; if(written < tail.length) { // not all the data was written, saving the tail...
... written = audio.
mozwriteaudio(sounddata); if(written < sounddata.length) { // not all the data was written, saving the tail.
nsIDOMHTMLAudioElement
last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsidomhtmlmediaelement method overview unsigned long long mozcurrentsampleoffset(); void mozsetup(in pruint32 channels, in pruint32 rate); [implicit_jscontext] unsigned long
mozwriteaudio(in jsval data); methods mozcurrentsampleoffset() non-standard this feature is non-standard and is not on a standards track.
...
mozwriteaudio() writes samples to the audio stream.
... unsigned long
mozwriteaudio( in jsval data ); parameters data the samples to write into the audio stream, specified either as a javascript array or as a numeric typed array.
HTMLAudioElement - Web APIs
mozcurrentsampleoffset() returns the number of samples form the beginning of the stream that have been written so far into the audio stream created by calling
mozwriteaudio().
...
mozwriteaudio() writes a batch of audio frames to the stream at the current offset, returning the number of bytes actually written to the stream.