recording and relaying audio from a microphone to speakers

I am faced with the problem that I cannot record audio from the microphone and at the same time output it to the speakers (listening to the microphone). I constantly hear strange noises and this is not due to the fact that the sound from the speakers is transmitted to the microphone (I have already checked).

maybe someone had such a task, tell me how or with what help it turned out to be implemented.

Just curious - How did you check this?

I put the phone in one room and the earphone in another.

I also made a volume sensor to check that the recording is accurately coming from the phone’s microphone.

Interesting, can you let me know what packages you’re using or code snippets if its custom? I have faced a similar issue but that wasn’t in flutter, and the problem ended up being that the device driver was doing something weird when both mic and speaker were active ( idr how exactly it was going wrong) which I was able to verify by recording on one device and streaming through another device instead

I have tried recording once to file and replaying, it was fine.

Definitely try a different device too for recording.

Also when you need help you should give some details(preferably code) about how are you doing the recording, there are many ways to do this.