How a sound can push water out of a speaker
A speaker is a light cone or membrane moved back and forth by a magnet. At low frequencies it has to travel much further to make sound, so a 165 Hz tone makes the membrane pump air in and out of the small chamber behind the grille. Water droplets sitting in the grille mesh get shoved outward with each stroke and, with the phone facing down, gravity carries them away instead of back in.
This is the same idea Apple uses for the Water Lock feature on Apple Watch, which plays a series of tones to clear its speaker after swimming. 165 Hz is a widely used choice because it is low enough to produce big movement but still high enough that a tiny phone speaker can reproduce it. The Sweep mode glides between 60 and 300 Hz so it also hits whatever frequency your particular speaker moves most at, and Pulse mode switches the tone on and off to give the water a series of sharp jolts.
Fix my speaker: what else to try
If the sound is still muffled after a few runs, let the phone dry naturally for a few hours with the speaker facing down in a warm, airy place. Don’t use a hair dryer on high heat, don’t push cotton buds or pins into the grille, and skip the bag of rice: Apple and others advise against it, because rice dust can end up in the ports.
For dust and pocket lint, use a soft, dry toothbrush to brush across the grille, or a little sticky putty pressed gently onto it and lifted away. If the speaker crackles, buzzes at every volume or makes no sound at all, the problem is probably not water. Restart the phone, check that it isn’t stuck in headphone or Bluetooth mode, and run the phone speaker test to see which frequencies are missing.
This tool cannot repair a damaged speaker, and it is not a repair guarantee. Salt water, sugary drinks and long submersion can corrode parts inside; if the phone was fully submerged, back it up and get it checked even if the sound comes back.