          return btoa(binary);
            }

            function convertFloat32ToInt16(float32Array) {
                const int16Array = new Int16Array(float32Array.length);
                for (let i = 0; i < float32Array.length; i++) {
                    int16Array[i] = Math.max(-32768, Math.min(32767, float32Array[i] * 32768)); // Scale and clamp
                }
                return int16Array;
            }

            function playNextChunk() {
                if (!isAudioPlaying && audioQueue