{
  "id": 21993561,
  "title": "How Water-Eject Sounds Work: Building a Speaker Cleaner with the Web Audio API",
  "url": "https://urgent.news/2026/11/26/how-water-eject-sounds-work-building-a-speaker-cleaner-with-the-web",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-26T15:21:14.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/javed_iqbal_94855c94dc440/how-water-eject-sounds-work-building-a-speaker-cleaner-with-the-web-audio-api-8m5"
  },
  "original_language": "en",
  "account": "To clean a phone's speaker, press a button, and listen for a buzzing sweep. Water droplets emerge from the speaker grille – it seems like magic, yet it's just physics and some JavaScript code. Sound waves can push water out of the mesh because speakers are tiny pumps, moving their cones back and forth to push air. Low-frequency tones make the cone move the most, resulting in the strongest air pulses. When water in the mesh is subjected to these pulses, it gets shaken and pushed outwards, using the same principle found in smartwatches' water-eject feature.\n\nThe core of this effect uses the Web Audio API, which consists of an oscillator, a gain node, and a short frequency sweep. The code begins by creating an AudioContext, then generates an oscillator and a gain node. The oscillator is set to a sine wave, and its frequency is gradually increased and decreased within a 2-second timeframe. The gain node's volume is also modulated during this period, starting at 0.9 and staying there. Finally, the oscillator is connected to the gain node, which in turn is connected to the device's audio output. The oscillator then starts and stops after the 2-second timeframe.\n\nBuilding a real cleaner involves repeating this sequence as a timed series of pulses, ramping the volume safely, and displaying progress so the user knows when to stop. A few small details are crucial, such as initiating the AudioContext from a user gesture (mobile browsers block autoplay), keeping the peak gain below clipping, and allowing the user to cancel mid-sequence.\n\nFor a fully functional example, check out Fix My Speaker, which runs the entire sequence in the browser without requiring any installation – it works on both iPhone and Android devices. Additionally, the author wrote about troubleshooting phone speakers that keep cutting out, detailing the causes in order of importance: dust, moisture, and software issues.",
  "summary": "Press a button, hear a buzzing sweep, and droplets of water jump out of your phone's speaker grill. It looks like a trick, but it is just physics plus a few lines of JavaScript. Why sound can push water out A speaker is a small pump: its cone moves back and forth and pushes air. Low frequencies move the cone the furthest, so a low, loud tone creates the strongest air pulses. Water sitting in the…",
  "key_points": [
    "Water droplets emerge from speaker grille when button pressed",
    "Low-frequency tones make speaker cone move most, pushing water out",
    "Web Audio API creates oscillator, gain node, and frequency sweep"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}