Record from mic and play sound on speaker

Hello,

I am building an app that converts speech to text and vice versa. Therefore, I need my container to enable and disable the microphone and the speaker. Is it possible to do so? I am using pyaudio library.

Thanks in advance.