I want to store a small amount of data in a sound file recorded by a microphone but I know nearly nothing about signal processing. I managed to demodulate my data encoded using binary phase shift keying with this schema:

Demodulation of DPSK

(From here: http://courses.cs.washington.edu/courses/cse561/10sp/project_files/FinalReport_FCI_YH.pdf)

To find the beginning of the signal I tried searching for the time where the strength of my carrier frequency in the signal exceeds a certain threshold but this is way too unreliable.

What would be a good way to solve this?

up vote 3 down vote accepted

This problem is typically solved by preceding your actual payload data with a synchronization pattern, or sync word. This is a sequence of symbols that are known to the receiver ahead of time and are used to aid synchronization with the payload data frame. It could be detected in a couple ways:

  1. Sync pattern matched filtering: When looking for the synchronization marker, instead of just integrating over one data bit, you could create a matched filter that represents the entire modulated sync word. This has the advantage that the SNR at the output of the sequence matched filter is higher than you would have otherwise, by a factor of the number of bits in the pattern. This can help if you're trying to detect the frame start in a very low-SNR environment.

    Disadvantages of this approach are that it is more computationally complex (because you're correlating against an entire sequence of bits), and also more sensitive to frequency offset between the transmitter and receiver.

  2. Hard decision pattern matching: Instead of the "soft-decoding" approach of correlating against the entire modulated sync sequence, you could instead just look for the pattern's sequence of symbols at the output of your existing receiver. As an example, you could decide that all of your frames will begin with the sequence 01001100101010 (I make no warranty that this is a good choice). You would then slide through the bits that come out of your BPSK decoder and declare the start of a frame when you see the sync pattern. It may also help to allow some small number of bit errors in the pattern when looking for the sequence.

    Compared to coherent integration across the entire sync sequence, this technique will not perform as well in low-SNR environments. However, it is much simpler and may work just fine for your application.

  • Thanks a lot for your help! I tried your first method which works but, at least how I implemented it, is really slow. With your second method I don't understand: If each of my bits is 1000 samples long, wouldn't I still have 1000 possibilities where to begin demodulating? – AntonS Nov 23 '13 at 11:34
  • 1
    Method #2 assumes that you already have recovered symbol timing, so that you can operate on the stream of symbol decisions to find the sync pattern. There are many methods for timing synchronization; one technique is to apply matched filter for one symbol period, then look for peaks in the matched filter output. You can track that peak location over time to accommodate error in your symbol timing as needed. Method #1 helps you get the symbol timing at the expense of more computation; you might look at whether fast convolution methods like overlap-save or overlap-add would be an option for you. – Jason R Nov 23 '13 at 19:41
  • Ok, since my data is really short (just 3 bytes) I tried method #1 again and could make it fast enough now by using fft cross-correlation. (dsp.stackexchange.com/questions/736/…) This seems to work very well. Thanks! – AntonS Nov 24 '13 at 16:13

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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