From 1cf7be0cddda4d656280b2a480a335074ee4b25e Mon Sep 17 00:00:00 2001 From: Ross Cadogan Date: Thu, 6 Aug 2026 21:32:07 +0100 Subject: [PATCH] fix(audio): mute the host's voice when SayPi is the one speaking (#602) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With a SayPi voice selected on pi.ai, both voices played at once — ours and Pi's own over the top. Only visible since #597; before that we produced no audio, so the missing mute looked like the whole bug. AudioOutputMachine already owns the decision: on the audio element's loadstart it sees a source belonging to neither the selected voice nor the active provider, and skips it. It never got the chance, because AudioModule had no element bound at all. Measured live on pi.ai: the tracked element is removed, cleanupAudioElement nulls it, and recovery re-arms listenForAudioElementSwap — an observer that only fires for newly ADDED subtrees. pi.ai replaces its player rather than reusing it, so the replacement was already in the document and nothing was ever added afterwards to react to. The observer waited forever, no loadstart reached the machine, and the page ended up with two undecorated