Multi-Device Sound Source Localization: Pinpointing an Intermittent Mystery Beep with TDOA and FFT

    This article walks through how to build a multi-device sound source localization system from devices you already own. A developer tracked down an intermittent beeping noise to within about 40 cm by coordinating five phones, tablets, and computers as a distributed microphone array. You will learn the core techniques behind the approach: time difference of arrival (TDOA) as the physical basis for localization, FFT-based frequency matching to pull a beep out of ambient noise, active cross-device time synchronization using a sync tone, manual spatial calibration of device coordinates, and an iterative workflow where the system itself recommends where to place the next device. It closes with practical pitfalls, such as the order in which synchronization and TDOA must run, and when to stop adding devices.

    1. A Real and Very Common Problem

    Not long after moving into a new home with a storage room full of unopened boxes, I started hearing a short electronic “beep—beep” coming from a corner every now and then. Unlike an alarm clock, it did not sound continuously; it fired once every few minutes, sometimes longer. By the time I went looking for it, the sound had already stopped. With just two ears and a short memory, there was essentially no way to tell which box, or which corner, it came from.

    This problem has a name in engineering: intermittent sound source localization. The difficulty is not whether you can hear the sound. It is that the sound appears at unpredictable times and lasts only briefly, leaving a human judgment window that is far too narrow. One developer, repeatedly bothered by exactly this noise, decided to turn “guessing by ear” into “computing by algorithm.” Using five phones, tablets, and computers scattered around the room, the system narrowed the source down to roughly a 40 cm radius. An AI coding assistant made it possible to build quickly, but the technical reasoning behind the solution is worth studying on its own.

    2. The Core Idea: From Single-Point Listening to Multi-Point Measurement

    Humans locate sound using the tiny time and volume differences between two ears. A device with a single microphone can only tell you that a sound happened; it cannot tell you where. To localize anything, you need to create multiple observation points.

    The key move in this setup is to connect idle devices around the home — phones, tablets, computers — over the network, and have each one open its microphone through a web page and capture audio in sync. The same sound is then recorded by multiple spatially separated microphones, and the time at which each device receives that sound differs slightly. That difference is the physical foundation of localization.

    In engineering terms, this is a textbook distributed sensor network: nodes (the devices) handle acquisition, a central node handles aggregation and computation, and the nodes coordinate over the network. Its main advantage is nearly zero hardware cost — a piece of front-end code running in a browser is enough to turn ordinary devices into a microphone array.

    3. The Physics: Time Difference of Arrival (TDOA)

    One of the classic algorithms for sound source localization is Time Difference of Arrival (TDOA). The principle is straightforward:

    • Sound travels through air at roughly 343 m/s (an approximation at 20°C in dry conditions);
    • If the same sound reaches device A first and device B later, with a time difference of Δt, then the difference in distance from the source to A and B is Δd = c × Δt;
    • Given the coordinates of both devices and this distance difference, the source must lie on a hyperbola with A and B as its foci;
    • Adding a third device yields another hyperbola, and the intersection of the two curves is the source location.

    Illustrative code:

    1. c = 343.0 # speed of sound, in m/s
    2. delta_t = t_b - t_a # time difference of the same sound arriving at two devices (seconds)
    3. delta_d = c * delta_t # difference in distance from the two points to the source (meters)

    Note that this is not a coarse “which one fired first” ordering. It requires millisecond- or even sub-millisecond-accurate timestamps. Sound covers only about 1 cm in roughly 29 microseconds, so clock error between devices must be kept small enough, or the localization result degrades immediately — which brings us to the time synchronization problem below.

    4. Extracting the Target from Noise: Fast Fourier Transform (FFT)

    In the real world, a room never contains only that one beep. Air conditioning, refrigerators, traffic, and speech all contaminate the recording. If the algorithm treats every audio peak as the target, noise will pull it off course.

    This is where the Fast Fourier Transform (FFT) comes in. It decomposes a time-domain waveform into the strength distribution of its frequency components. Electronic notification tones are typically concentrated in a stable, narrow high-frequency band (often a few kilohertz), while ambient noise spreads its energy far more broadly. So once you determine the dominant frequency of the target sound, you can identify it precisely in the spectrum and filter out everything else.

    Illustrative code:

    1. def detect_beep(sample, sample_rate):
    2. windowed = apply_window(sample) # apply a window to reduce spectral leakage
    3. spectrum = fft(windowed) # fast Fourier transform
    4. magnitude = abs(spectrum) # take the magnitude spectrum
    5. freqs = freq_bins(len(magnitude), sample_rate)
    6. peak = index_of_max(magnitude) # find the frequency with the strongest energy
    7. return freqs[peak], magnitude[peak] # return the dominant frequency and its strength

    In practice, you first capture a sample that contains the target sound, lock onto its dominant frequency and energy signature, and then run matched filtering across recordings from all other devices — watching only for energy spikes in that band. This is how each beep can be reliably isolated and stamped with an accurate timestamp.

    5. The Unavoidable Hard Part: Cross-Device Time Synchronization

    TDOA accuracy depends entirely on timestamp accuracy, yet the local clocks of multiple independent devices are almost never naturally in agreement, and network transmission introduces unpredictable delay. This is the most easily overlooked — and most critical — piece of the whole design.

    A practical, low-cost approach is active synchronization: one “host” device plays a short, easily recognizable sync tone, and every other device uses its own reception time of that sound as the origin of its timeline. Even if each device’s local clock is offset, this puts all recordings on a single comparable timeline.

    1. sync_tone = generate_short_tone() # generate a short, spectrally distinctive sync tone
    2. play(sync_tone) # the host device plays it
    3. # each device detects when the sync tone arrives and corrects its own recording timeline
    4. align_timeline(received_at_sync) # compute TDOA only after alignment

    In the developer’s first implementation, automatically estimating the relative positions of the devices was not accurate enough, so the approach shifted to letting the user drag icons on a map to mark each device’s real position. The lesson: in real deployments, human–machine collaboration is often more pragmatic than chasing full automation — hand the computation the machine is good at to the algorithm, and the spatial reasoning it is bad at to a human calibration step.

    6. Spatial Calibration: Making Devices Aware of Their Own Position

    TDOA takes device coordinates as input, so localization accuracy depends heavily on how accurate those coordinates are. Relying on automatic network-based discovery alone rarely produces a reliable spatial layout, and the final result can be off by a large margin.

    The solution has two parts:

    1. Planar coordinate annotation: represent each device as a draggable icon on a map and let the user place them according to the actual room layout, fixing their relative positions by hand;
    2. Height and orientation compensation: if devices are not on the same horizontal plane (say, one on a desk and one on the floor), you need 3D coordinates, otherwise the planar approximation introduces systematic error.

    The more accurate the annotation, the more tightly the hyperbola intersections converge, and the smaller the localization error. This is also why the final result could be squeezed down to roughly 40 cm — not magic in the algorithm, but the combined effect of accurate time differences plus accurate spatial calibration.

    7. Iterative Refinement: Let the System Make Suggestions

    When you only have a limited number of devices, the existing points cannot reduce the error much further. At that point the system can do something in reverse: recommend the best placement for the next device.

    The logic is to look across candidate locations for the direction in which the current geometry is “most uncertain” — the side where the hyperbola intersections are blurriest and the error ellipse most elongated — and suggest placing the next device there. Localization accuracy is closely tied to the geometric configuration formed by the devices, so spreading them out as much as possible (avoiding near-collinear arrangements) noticeably improves the intersection quality. Following the system’s suggestion, the developer checked the boxes and finally found an old carbon monoxide detector tucked inside — a very common source of a “low battery” chirp.

    8. Pitfalls and Recommendations

    If you want to reproduce or adapt a system like this, a few things are worth knowing in advance:

    • Match sample rate to clock precision: higher sample rates and more accurate clocks raise the theoretical achievable precision, but they also cost more resources;
    • Always synchronize time before computing TDOA: skip this step and the results will almost certainly drift;
    • Lock onto the target by spectral signature: instead of detecting every loudness peak, pin down the target frequency band — it is far more robust against interference;
    • Keep a manual calibration entry point: full automation is not always more reliable, and leaving a manual hook for calibration often pays off;
    • Set a threshold for convergence: stop once the accuracy gain from an additional device falls below that threshold, rather than collecting devices indefinitely.

    To grow this prototype into a more complete system, you can add a logging service to record the audio features and timestamps of each localization run, use a message queue to decouple the acquire–detect–compute stages, archive raw recordings in object storage for later review, and add monitoring and alerting to track device online status and localization success rate. These are all common cloud-native categories, and they substantially improve the stability and maintainability of the system.

    9. Closing Thoughts

    The value of this “mystery beep” episode goes well beyond finding an old detector. It demonstrates a complete approach: when human senses fall short, combine distributed sensing, signal processing, and geometric localization to turn a vague problem into a computable, deterministic one. From coordinated multi-device capture, to FFT-based spectral recognition, to TDOA intersection with time synchronization, each step maps to a mature and broadly applicable methodology in the field of sound source localization. The role of an AI coding assistant is that it compressed a solution that would normally take considerable engineering effort into something one person can build and debug quickly.

    So the next time a strange noise is bothering you from a corner, consider this: what you need may not be more sensitive ears, but a phone placed in the right spot.