When sound source localization (DOA, Direction of Arrival) gives inaccurate angles that jump around, most people immediately start tuning algorithm parameters. In most cases the problem is not the algorithm at all — it is that the phase between microphones is not aligned. The working basis of any DOA algorithm is the time difference between microphones, and that time difference is the signal being measured. If the phase is not aligned, the signal itself is wrong, and no amount of parameter tuning will help. Aomway has seen this pattern repeatedly in audio and sensor projects, so this article breaks down the physics.
This article explains the whole idea clearly: what DOA actually measures, why the synchronization requirement is as strict as a few samples, and how platforms such as Rockchip (RK) guarantee alignment from the hardware topology up.
In the earlier article “Hardware Calibration for Algorithm Admission — Don’t Be Afraid”, phase consistency was one item in the admission test, but that piece was an operations manual that only covered how to test it. This article picks up the part left unexplored: why this test matters so much.
Key Takeaways
- DOA does not measure distance — it measures the time difference (TDOA) between microphone channels.
- For a 35 mm two-mic linear array, the maximum time difference is only about 0.103 ms — roughly 5 samples at 48 kHz.
- One sample of misalignment can shift the DOA angle by about 18° at the front; two samples shift it by about 36°.
- The fix is usually hardware, not software: all mics on the same DAI, one trigger, one clock source, correct channel order.
- Always verify phase consistency with a 1 kHz tone before blaming the algorithm — the check Aomway recommends first.
What DOA Measures: The Time Difference Between Microphones
A sound source arriving from a given direction reaches each microphone in the array at a different distance. That distance difference converts into a time difference, and the DOA algorithm works by calculating the time difference (TDOA) between microphone channels to infer the direction of the source.
Take a two-microphone linear array with a 35 mm spacing as an example:
Sound source
●
/ θ
/
mic1 ●─── 35mm ───● mic2
The sound wave reaches the nearer mic first and the farther mic later; the time difference depends on the angle θ
- Source directly ahead (90°): both microphones are the same distance from the source, so the time difference is 0.
- Source to the side (0°): the path difference is at its maximum, equal to the array spacing of 35 mm. With a speed of sound of 343 m/s, the time difference is 35 mm ÷ 343 m/s ≈ 0.103 ms.
DOA measures this time difference and back-calculates the angle. A multi-microphone circular array works the same way, only the geometry of the path difference is more complex. The principle is unchanged: time difference → angle.
Just How Small Is That Time Difference?
For a 35 mm linear array, the maximum time difference is only 0.103 ms. At a 48 kHz sampling rate, one sample is 1/48000 ≈ 0.021 ms. So:
Max time difference 0.103ms ÷ 0.021ms per sample ≈ 5 samples
In other words, every angle between 0° and 90° shows up in the data as a difference of only 0 to 5 samples.
Note, however, that the delay is not linear with angle; the model is τ = (d/c)·cos θ (with θ measured from endfire). So the angle error represented by one sample is not constant:
- Broadside (90°): best resolution, 1 sample ≈ 18°.
- Endfire (0°): worst resolution — in theory the angle error per sample tends to infinity, so angles in this region are nearly impossible to estimate.
- Averaging 90° over 5 samples gives a useful order-of-magnitude intuition: 1 sample ≈ 20°.
So “about 20° per sample” is the best case near broadside, and the sides are worse. But the conclusion does not change: if the alignment error between microphone channels is even one sample, the DOA will be off by about 18° at the front; two samples put it off by 36°. That is why synchronization must be achieved at the sample level.
What Happens When Phase Is Not Aligned
If there is an uncontrolled offset between microphone channels — for example, recording with two separate sound cards, or a scheduling jitter that makes the start-of-recording times inconsistent — a random term is added to the time difference between microphones:
Measured "time difference" = true TDOA + random synchronization error
This random error differs on every recording, with the following results:
- The DOA angle jumps around: the same person standing in the same position saying the same sentence yields an angle that keeps changing.
- Beamforming points the wrong way: beamforming (BF) relies on the phase relationship between microphones to reinforce signals through summation. When the phase is not aligned, the direction that should be reinforced is not reinforced enough, while directions that should not be reinforced get summed instead — both noise reduction and pickup quality suffer.
- Circular arrays are even more sensitive: with a smaller array radius (for example a 27 mm circular array), the time differences are smaller, so the relative impact of synchronization error is larger.
How to Guarantee Sample Alignment Between Microphones
In real platforms such as Rockchip (RK) solutions, sample alignment between microphones is guaranteed by several layers:
1. All microphones share the same DAI. A common multi-DAI grouping is: microphone recording on one DAI (for example PDM or I2S), and the reference playback on another DAI. DOA only computes microphone channels, and since the microphones all sit in the same DAI, they naturally share the same DMA and clock, so their samples are aligned. This is the most common topology and the most DOA-friendly one.
2. A single trigger starts them together. When ALSA opens the recording stream it sends one trigger, and every channel on the same DAI begins capturing at once, so the start-of-recording times are aligned. You will not see mic1 start while mic2 lags by a buffer.
3. They share one clock source (MCLK). All microphones hang off the same codec and use the same I2S/PDM interface, and the sample rate is locked to the same MCLK, so it will not drift over time.
4. Channel order is correct. The physical order of channels in the PCM data must match the array layout (mic1 first, mic2 second). Wire it backwards and the DOA angle comes out reversed. This is the point of the channel-order check in the calibration article.
5. Recording and playback use the same sample rate. If the microphone and the reference playback are on the same DAI, they share a clock source; a sample-rate mismatch triggers a clock switch that indirectly affects the stability of the microphone channel data.
How to Check Whether the Phase Is Aligned
See the “Phase Consistency” section of the earlier article “Hardware Calibration for Algorithm Admission — Don’t Be Afraid” for the exact procedure: use a 1 kHz sine at 1 m, record multiple channels at 90° and 0° attitudes, then in Audacity zoom into the waveforms of the two microphone channels, align the zero crossings and measure the time difference. Compare it against the theoretical value (0 at 90°, about 5 samples at 0°) and repeat several times to see whether it is stable.
The one-line criterion:
- Matches the theoretical value and is stable across repeated tests → phase synchronization is fine; if the DOA is still inaccurate, look elsewhere (array size, algorithm parameters).
- Does not match, or is unstable → fix synchronization first before tuning the algorithm, otherwise you are wasting your time.
Summary
The signal DOA measures is the time difference between microphones, and that difference is only a few samples wide. Phase synchronization is the foundation of DOA — if the foundation is not aligned, every parameter above it is a castle in the air.
The keys to alignment: all microphones on the same DAI (the most common and most DOA-friendly topology), one trigger starting them together, a shared clock source, and correct channel order. The way to check it is the phase consistency test from the calibration article, compared against the theoretical delay.
The next time DOA is inaccurate, do not touch the algorithm first — record a clip and look at whether the phase between microphone channels is aligned in Audacity.
If you have any questions about this topic, feel free to contact us at [email protected]
FAQ
Q: My DOA angles jump by 30–40 degrees. Is that always a phase problem?
Not always, but it is the first thing to rule out. One sample of misalignment alone is worth about 18°, so channel phase is the most common cause. If the phase test is clean and stable, then check array dimensions and algorithm parameters.
Q: Why does a circular array suffer more than a linear array?
Because the spacing is smaller, the true time differences are smaller, so a fixed synchronization error represents a larger fraction of the signal being measured.
Q: Can I fix misalignment in software after recording?
If the offset is a constant and known, it can sometimes be compensated. But jitter that changes on every recording cannot be removed after the fact — the fix must be at the hardware topology and driver level.
Q: What single check should I do first?
Record a 1 kHz tone at 1 m at 90° and 0°, measure the inter-channel delay in Audacity, and compare it with the theoretical value. Repeat for stability. This one test tells you whether the foundation is sound.
Q: Does Aomway build microphone arrays and audio front ends for this kind of work?
Aomway supplies FPV and UAV hardware, and our team works with customers on audio and sensor front ends for robotics and UAV platforms. If you need a multi-microphone array or a component that keeps channels sample-aligned, contact Aomway at [email protected] and we will help you choose the right part.
Have questions about this article? Feel free to contact us at [email protected] — we’re happy to help!