edia({ audio: true }).then(stream => {
                    const audioContext = new AudioContext({ sampleRate: sampleRate }); // Explicitly set sample rate.
                    const source = audioContext.createMediaStreamSource(stream);
                    processor = audioContext.createScriptProcessor(1024, 1, 1); // bufferSize, numInputChannels, numOutputChannels

                    processor.onaudioprocess = (e) => {
                        const inputData = e.inputBuffer.getChannelData(0); // Raw PCM 