If this helps, I’ve turned the code from live_starter_api.py, in the Gemini 2.0 cookbook, into a Python module that can be imported as the AudioLoop class. It now supports async input/output methods to make it easier to call from GUI apps, such as from Panel or TKinter.
The updated code is here, in audio_loop.py:
FYI:
I have also submitted a PR into the Gemini 2.0 cookbook, if it might get approved:
PR: added the AudioLoop module #375