 const byteRate = sampleRate * blockAlign;

                const buffer = new ArrayBuffer(44);
                const view = new DataView(buffer);

                function writeString(offset, string) {
                    for (let i = 0; i < string.length; i++) {
                        view.setUint8(offset + i, string.charCodeAt(i));
                    }
                }

                writeString(0, 'RIFF');
                view.setUint32(4, fileSize, true);
                writeString(8, 'WAVE');
  