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:

1 Answer
1

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:

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.

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.

$\begingroup$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?$\endgroup$
– AntonSNov 23 '13 at 11:34

1

$\begingroup$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.$\endgroup$
– Jason RNov 23 '13 at 19:41

$\begingroup$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!$\endgroup$
– AntonSNov 24 '13 at 16:13