Search completed in 1.29 seconds.
5 results for "mozsamplerate":
Introducing the Audio API extension - Archive of obsolete content
Archive › Mozilla › Introducing the Audio API Extension
t describes a non-standard experimental API. This API has been deprecated since Gecko 22, disabled since Gecko 28, and removed from Gecko 31. You should use the Web Audio API instead. Reading audio streams The loadedmetadata event When the metadata of the media element is available, it triggers a loadedmetadata event. This event has the following attributes: mozChannels: Number of channels mozSampleRate: Sample rate per second mozFrameBufferLength: Number of samples collected in all channels This information is needed later to decode the audio data stream. The following example extracts the data from an audio element: <!DOCTYPE html> <html> <head> <title>JavaScript Metadata Example</title> </head> <body> <audio id="audio-element" src="song.ogg" controls="t...
... extracts the data from an audio element: <!DOCTYPE html> <html> <head> <title>JavaScript Metadata Example</title> </head> <body> <audio id="audio-element" src="song.ogg" controls="true" style="width: 512px;"> </audio> <script> function loadedMetadata() { channels = audio.mozChannels; rate = audio.mozSampleRate; frameBufferLength = audio.mozFrameBufferLength; } var audio = document.getElementById('audio-element'); audio.addEventListener('loadedmetadata', loadedMetadata, false); </script> </body> </html> The MozAudioAvailable event As the audio is played, sample data is made available to the audio layer and the audio buffer (size defined in mozFrameBufferLength) gets f...
...lement: <!DOCTYPE html> <html> <head> <title>JavaScript Visualization Example</title> </head> <body> <audio id="audio-element" src="revolve.ogg" controls="true" style="width: 512px;"> </audio> <pre id="raw">hello</pre> <script> function loadedMetadata() { channels = audio.mozChannels; rate = audio.mozSampleRate; frameBufferLength = audio.mozFrameBufferLength; } function audioAvailable(event) { var frameBuffer = event.frameBuffer; var t = event.time; var text = "Samples at: " + t + "\n"; text += frameBuffer[0] + " " + frameBuffer[1]; raw.innerHTML = text; } var raw = document.getElementById('raw'); var audio = document...
...e first audio stream needs to be muted so that only the second audio element is heard. <audio id="a1" src="song.ogg" controls> </audio> <script> var a1 = document.getElementById('a1'), a2 = new Audio(), buffers = []; function loadedMetadata() { // Mute a1 audio. a1.volume = 0; // Setup a2 to be identical to a1, and play through there. ...
Visualizing an audio spectrum - Archive of obsolete content
Archive › Misc top level › Visualizing Audio Spectrum
="width: 512px;"> </audio> <div><canvas id="fft" width="512" height="200"></canvas></div> <script> var canvas = document.getElementById('fft'), ctx = canvas.getContext('2d'), channels, rate, frameBufferLength, fft; function loadedMetadata() { channels = audio.mozChannels; rate = audio.mozSampleRate; frameBufferLength = audio.mozFrameBufferLength; fft = new FFT(frameBufferLength / channels, rate); } function audioAvailable(event) { var fb = event.frameBuffer, t = event.time, /* unused, but it's there */ signal = new Float32Array(fb.length / channels), magnitude; for (var i = 0, fbl = frameBufferLength / 2; i ...
Displaying a graphic with audio samples - Archive of obsolete content
Archive › Web Standards › Displaying the Mozilla logo with the Audio Samples
height="200"></canvas></div> <img id="mozlogo" style="display:none" src="mozilla2.png"></img> <script> var canvas = document.getElementById('fft'), ctx = canvas.getContext('2d'), channels, rate, frameBufferLength, fft; function loadedMetadata() { channels = audio.mozChannels; rate = audio.mozSampleRate; frameBufferLength = audio.mozFrameBufferLength; fft = new FFT(frameBufferLength / channels, rate); } function audioAvailable(event) { var fb = event.frameBuffer, t = event.time, /* unused, but it's there */ signal = new Float32Array(fb.length / channels), magnitude; for (var i = 0, fbl = frameBufferLength...
HTMLMediaElement: loadedmetadata event - Web APIs
Web › API › HTMLMediaElement › loadedmetadata event
d. Bubbles No Cancelable No Interface Event Target Element Default Action None Event handler property GlobalEventHandlers.onloadedmetadata Specification HTML5 media Additional Properties Property Type Description mozChannels Read only int The number of channels. mozSampleRate Read only int The sample rate per second. mozFrameBufferLength Read only int The number of samples collected in all channels. Examples These examples add an event listener for the HTMLMediaElement's loadedmetadata event, then post a message when that event handler has reacted to the event firing. Using addEventListener(): const video = document.querySelector('vide...
HTMLMediaElement - Web APIs
Web › API › HTMLMediaElement
operty can be set to a new value for lower latency, larger amounts of data, etc. The size given must be a number between 512 and 16384. Using any other size results in an exception being thrown. The best time to set a new length is after the loadedmetadata event fires, when the audio info is known, but before the audio has started or MozAudioAvailable events have begun firing. HTMLMediaElement.mozSampleRate Read only Returns a double representing the number of samples per second that will be played. For example, 44100 samples per second is the sample rate used by CD audio. HTMLMediaElement.muted Is a Boolean that determines whether audio is muted. true if the audio is muted and false otherwise. HTMLMediaElement.networkState Read only Returns a unsigned short (enumeration) indicating the c...