This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** @param sampleRate {number} */ | |
| /** @param channelBuffers {Float32Array[]} */ | |
| function audioBufferToWav(sampleRate, channelBuffers) { | |
| const totalSamples = channelBuffers[0].length * channelBuffers.length; | |
| const buffer = new ArrayBuffer(44 + totalSamples * 2); | |
| const view = new DataView(buffer); | |
| const writeString = (view, offset, string) => { | |
| for (let i = 0; i < string.length; i++) { |