Search code examples
web-audio-api

How to save Audiocontext each audio track into database?


I have a Audiocontext object in which audio's are given dynamically through xmlhttprequest and JS Filereader , is there is any possibility to save the mixed audio as an mp3 ?


Solution

  • I found myself the solution by @john_white 's comment over the question

    var OAC         = new OfflineAudioContext(2,44100*length,44100);
    
            AudioApp.Collections.Tracks.each(function(track) {
                    track.clips.each(function(clip) {
                            var newBufferSource         = OAC.createBufferSource();
                            newBufferSource.buffer      = clip.get('buffer');
                            newBufferSource.connect(OAC.destination);
                            newBufferSource.start(OAC.currentTime + clip.get('trackPos'));
                    });
            });