Pacman Encoding

The goal of this project was to transmit binary data using a signal that looks like a game of Pacman when viewed on a Spectrogram. This is not a practical transmission algorithm, but it was nonetheless quite fun to implement.

A Spectrogram is a graph that shows frequency on the y axis against time on the x axis. Amplitudes of different frequencies are shown using colors. Below are two signals plotted alongside their Spectrogram; the first is a pure cosine and the second is a cosine with slowly varying frequency and noise added.

This can be used to draw arbitrary images.

Our transmission signal generation method is as follows:

1. Construct a pulse that looks like Pacman when viewed on a Spectrogram. Do the same for a Ghost.
2. Turn each bit of our message into either a Pacman or a Ghost pulse, then concatenate these pulses together.
3. Transmit the signal using a USRP (Universal Software Radio Peripheral).

Reverse Spectrogram

The most complicated step of this pipeline is step #1, constructing pulses that will look like images when viewed on a Spectrogram. Our method for this is as follows:

1. Duplicate image on x axis. This it because the IFFT expects the negative frequencies in the first half of the array, and positive frequencies in the second half of the array. We want our signal to be real, so the graph should be symmetrical.
2. Slice up image horizontally and take the Inverse Fourier Transform of each slice.
3. Append the slices together and normalize.

Below is our sample image, mirrored along the x axis (so that the transmitted signal will be real).

3 slices are plotted here for clarity, although in reality many more are used to get a higher resolution. The same slices above from above image are plotted in the upper figure below. Since the image is of uniform color, the slices show up as modulated low pass filters. For each slice we then take the IFFT. The shape of the IFFTs are sinc functions modulated with a cosine.

Again, the sincs in the above picture are superimposed only for clarity. In reality, we append each sinc one after another to get our time-domain signal. This signal has been carefully constructed to look like our sample image when viewed on a spectrogram. Each straight vertical line in the image below is the peak of a sinc.

Finally, when viewed on a Spectrogram with box width equal to the length of each slice, we get the following image:

Our signal looks like a line of Pacmans and Ghosts, one after another. This signal can be decoded by a convolution with our original Pacman and Ghost pulse. The convolution acts like a matching function, and shows a peak when the base signal lines up well with the pulse.

The resulting peaks can then be used to reconstruct our original signal. Want to view the source code and the full write-up? Check out our GitHub.