superpoweredSDK/web-audio-javascript-webassembly-SDK-interactive-audio

Exporting Audio to a File

YoniH opened this issue · 2 comments

YoniH commented

In my web application, I need to be able to export audio to a file.
The docs says that AdvancedAudioPlayer "Can be used in a real-time audio processing context, but can not be used for offline processing."
Is there any other way to export processed audio using Superpowered? If not, is there some workaround?

YoniH commented

Actually, that quote from the docs was taken from here, probably an older version of the docs.

Now I see that the latest version of the docs says that offline processing is supported: The AdvancedAudioPlayer can be used in a real-time audio processing context or offline processing.

Actually, I need to be able to export the output of an entire processor that contains more than one player.
Should I be using a standard offline audio context?

Is there some guide or code example for offline processing and exporting to a file?

Glad you found it! You need to set internalBufferSizeSeconds in the constructor to 0.

That argument represents the number of seconds to buffer internally for playback and cached points. The value 0 enables "offline mode", where the player can not be used for real-time playback, but can process audio in an iteration. If not zero, the AdvancedAudioPlayer can only be used for real-time playback.