Note that there are some explanatory texts on larger screens.

plurals
  1. POCross Browser Audio - Writing to sample arrays to a new buffer
    text
    copied!<p>First of all a little background. I have been working for quite some time now with the experimental audio apis available on the web. During that time i have touched upon both Mozilla's Audio Data API and the Web Audio API for processing and manipulating audio in the following fashion:-</p> <ul> <li>Collecting raw audio data (an array of samples) from an audio file / creating a simple array of audio sample which can be used to represent the individual samples contained within a buffer.</li> <li>Processing the buffer in question, performing FFT analysis and creating a new buffer (simple array of samples) with the processed audio, for example a filtered collection of samples.</li> <li>Writing the resulting buffer to a new audio object.</li> </ul> <p>I have recently begun thinking about a move to the SoundManager2 API which makes use of flash to provide fallbacks for browsers which do not support some of the html5 features required to work with audio in the browser, however, it seems that I get stuck at the final stage.</p> <p>I can get access to the raw audio data for manipulation but SoundManager2 does not seem to allow for writing a buffer to a new audio object like you would in the Moz Audio Api example shown below.</p> <pre><code>// Create input audio object var audio = new Audio(); audio.src = 'my_audio_file.ogg'; var channels; var rate; // Get input data audio.addEventListener('loadedmetadata', function() { var channels = this.mozChannels; var rate = this.mozSampleRate; }, false); // Create output audio object with input settings var output = new Audio(); output.mozSetup(channels, rate); // Do something as the buffer is played audio.addEventListener('MozAudioAvailable', function(event) { // Process audio and write to output object // event.frameBuffer is an array of raw audio samples output.mozWriteAudio(event.frameBuffer); }, false); </code></pre> <p>Can anyone tell me if there is a library similar to SoundManager2 which can do this writing of audio data as well as reading. Or am i simply missing something in Soundmanager and i can actually carry out this type of processing. Any suggestions would be greatly appreciated.</p> <p>Thanks</p> <p>Andrew</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload