Extract binary data stream from audio signal

3k views Asked by At

I have binary data in a stream of audio, and I want to decode it. Here is an example screenshot from Audacity:

screenshot of data

There seems to be a new bit of data every millisecond. This also means the data is encoded at 1000 Hz with a baud rate of 1000.

I also can tell that each packet has 20 bits (meaning it takes 20 milliseconds to transfer) plus 3 milliseconds of just a high signal. This means that the packet is resent every 23 milliseconds.


So the question is, how would I convert this to a binary file? Going through and doing so by hand is out of the question - unless, that is, you're willing to do it :)

1

There are 1 answers

0
Marcus Müller On BEST ANSWER

That's a typical case of the digital modulation known as on-off keying (OOK).

It's rather easy to decode OOK: apply a low-pass filter with a cutoff frequency that is just below 1/symbol periodicity, decimate it's output so that you only get 1 value per symbol duration, and then use an experimentally found threshold to decide what's 0 and what's 1.

You might need to find the exact symbol duration and symbol starts first, if you want to be really exact. That's a classical synchronization problem -- in your case, it seems like the sender makes sure to have a sharp edge at every symbol transition, so high-pass filter your signal, and you will get a clock signal, which you can use to adjust a resampler that would then adjust the sampling rate of the signal going into your decoder (as described above).

There's a nice framework to do that; GNU Radio comes with all the building blocks you need to make that happen, it has an active community, there's a GUI to help you develop your signal processing application, if you don't use graphical visualizations in your signal processing chain, the resulting application is really portable, it's highly optimized, and comes with a lot of examples.