How can two apps access the microphone simultaneously? If an app tries to access the microphone while the microphone is already being accessed, it fails.

How can I make two or more apps access the microphone at the same moment?
Simply you can't. because microphone just like camera is a hardware part of the phone and it's drivers connects to only one source, there is a way to make this work but it will be difficult, by using an app to transfer the audio came from microphone and stream it to another app.