@benwiggy This was the only way I could reliably start and stop audio feedback.
viewWillDisappear is not called immediately when you navigate away from your file, it looks like the OS keeps 2-3 preview controllers active as you navigate between files.
Here's the workaround that seem to work on Ventura:
https://stackoverflow.com/a/76433758/1182910
Post
Replies
Boosts
Views
Activity
While not ideal, but you can use the MIDI protocol that is supported over the Camera Connection Kit for lightning ports, or with a regular USB-C cable for USB-C ports.
While the MIDI protocol is pretty old it supports sending data in MIDI System Exclusive messages. It should work just fine for any type of devices, not just musical instruments.