system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does the Speaker Option in phones not cause echo to the other person? Do phones explicitly handle this?

If I turn on speaker option, how does the voice of my called coming out of my speaker not become input to my mic thus causing echo to my caller?
gpt
There *could be* a very good algorithm applied, to recognize time delays and "subtract" the audio coming from the speakerphone so perfectly that the microphone only picks up what's in the room.

But it's not done this way.  The sound delay between the speaker and microphone is easy to compute, but the echos off the walls (of varying distances) is so much more complicated that the phone doesn't have the computing power to do it.

So, the solution that is used today is a simple one: as the volume coming out of the speaker gets louder, the microphone volume gets turned down.  After a short delay (about 0.1 seconds, to let echos settle down), the microphone is unmuted.  This is why speakerphones never work quite as nicely as handsets - if someone on the other end is talking, the microphone is essentially muted and they won't be able to hear you until they're done talking.

The quality of the device depends on how adaptive the speaker-to-microphone muting algorithm is.  Too much muting hurts the flow of conversation, not enough muting can cause bad feedback.  Some devices are programmed to detect faint hints of feedback and auto-calibrate before the feedback becomes audible.

(I am an electronics/firmware/software senior research engineer for medical sensors)