Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

I am pretty new to DSP. I need a computer to transmit data to a receiver through audio signals in a loud outdoor environment. (I am writing the software for both sender and receiver so I can design the signal however I want.) I am using cheap speakers and microphones operating at 44.1Khz.

I would like for the sender to emit a signal that can be recognized by the receiver with extremely high accuracy on the time domain. This signal does not need to contain any information, the receiver just needs to be able to figure out exactly when the signal started, ideally down to the exact sample.

My first idea was for the sender to emit a 2kHz wave for 250ms. The receiver would continuously perform FFT to identify that wave, and when present, it would look at the FFT history to figure out the sample at which the wave had started. However this approach feels clunky because of the number of samples needed to satisfy the FFT. I could never achieve 1-sample accuracy without doing an FFT for each sample, and I don't think it would even give me good results.

I have been learning about PSK for unrelated reasons, and I am getting the impression that there are lots of ways to detect properties of waves – without the FFT. So my question is – what methods could I use to identify an instantaneous change in my input signal, in an extremely noisy environment?

share|improve this question
what is the frequency response of your entire system (end-to-end)? –  thang Jan 23 '13 at 17:06
The frequency response graphs for the mic show a pretty flat line from 200Hz to 22kHz, though the line starts wobbling by +/-5dB between 15kHz and 22kHz –  Keith Jan 23 '13 at 17:51
@Keith: If the graphs are provided by the manufacturer, they're probably lies. –  endolith Jan 23 '13 at 19:12
What you want to look at is the frequency response of the speaker -> "room" (or outdoor environment) -> microphone system. The flattest speakers and microphones won't be of any help if the speaker is 100m away from microphone in the middle of a stadium. –  pichenettes Jan 23 '13 at 19:37
Be aware that there are numerous aditional pitfalls beyond the obvious DSP/acoustics issues. I'm thinking mainly of latencies in your audio hardware, I/O buffers, etc. Unless you're working with bare hardware (no OS or drivers) then it will be tough to impossible to get 1 sample accuracy. –  Paul R Jan 24 '13 at 7:06
add comment

1 Answer

up vote 5 down vote accepted

Using a sinusoid is a bad idea. In order to precisely detect the time of arrival, you want a signal with wide bandwidth. Here's a brief description of a good approach:

  • Transmit a known direct-sequence spread spectrum (DSSS) waveform (typically a phase-shift-keyed digital signal, either BPSK or QPSK). You should pick a spreading code that has good autocorrelation properties: its autocorrelation should look close to an impulse. A sequence of random symbols will often work, or you can use something more well-defined like a maximal-length sequence.

  • At the receiver, apply a matched filter to the known transmitted pattern.

  • You will see a spike in magnitude at the output of the filter that corresponds to the time of arrival of the signal of interest. Apply a threshold to the filter output to identify the locations of these spikes.

  • The matched filter will have a delay of $N-1$ samples, where $N$ is the length of the sequence. Subtract this duration from the detected pulse locations to yield an estimate of the pulse arrival time.

    • Optionally, take the samples surrounding the peak and interpolate to get a finer (sub-sample) estimate of the actual peak location. Polynomial, sinc-based, or other methods may be used here.

This is a very simplified description of what you might want to do, but it should get you started. One consideration to keep in mind when designing the length of the sequence: there is a tradeoff between the total integration period (i.e. the sequence length) and the frequency selectivity of the matched filter. If you have appreciable frequency error between your transmitter and receiver, the peaks at the matched filter output will become attenuated. The amount of attenuation depends on the frequency offset's relationship to the matched filter length. This is a common attribute of DSSS systems that must be handled appropriately.

share|improve this answer
Thanks. Didn't finish my thought before. –  Jason R Jan 23 '13 at 18:34
Matched filter is equivalent to cross-correlating with the original signal, right? Will frequency response curve and phase shift of speaker and electronics ruin the match? –  endolith Jan 23 '13 at 18:37
not if you signal sits in a good region of the frequency response curve. –  thang Jan 23 '13 at 19:21
remark that if you use maximum length sequence, the correlation (multiplication by Toeplitz matrix) can be made fast by using the fast Walsh transform (dsp.stackexchange.com/questions/1693/…) –  thang Jan 24 '13 at 3:26
Hi @JasonR, thanks so much for this answer earlier this year. I don't know how to contact you through StackExchange, but I'm recruiting for my DSP-focused startup, and I'd love to chat if you have time in the next week or two. –  Keith Nov 28 '13 at 4:05
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.