Skip to content
Piyush Singhal edited this page Aug 6, 2018 · 2 revisions

Soundcom

Soundcom is an open source Android-based app focussing on near field communication through soundwaves. At the moment it can be used to chat within a range of few meters where a user can receive and broadcast messages. Low-frequency waves have high attenuation in the air but they also have long wavelengths which can be used be used by navies to communicate with submarines. This project helps you understand the general wireless communication procedure and modify it according to use.

Technical Model

This application uses 16-FSK with a symbol duration of 0.25 seconds per symbol to transmit strings of 480 bits(16 bits per character,i.e,30 characters).

image

From the above diagram, we can see that the project can be divided into modules, transmitter, and receiver. Apart from these two, we have chat history module which will be working with both of these. All three modules are connected and controlled by MainActivity.

Workflow Abstract

Simply put, the transmitter collects the user-defined strings and converts them to a binary representation. This binary data is then modulated using FSK and saved as a wav-file, the transmitter interface then allows for the user to play this waveform, thereby transmitting it to the receiver. The transmitted text is then displayed in chat history and stored in JSON file.

The receiver offers an interface for recording the transmitted waveform and saves it to file. This waveform is then synchronized using a matched filter, and the recovered modulated signal is concatenated and saved to file. Then the waveform is demodulated and the resulting binary data is converted back to a string. This string is added to JSON file and displayed in chat history.

Objects Used in Workflow

Transmitter

The transmitter object is a class that deals with the high-level algorithmic process of generating the modulated waveform. This is achieved by first initializing the parameters required for effective modulation, these being sample rate, symbol duration, the number of carriers and source string.

Then the transmitter class initializes the FSK modulator object and requests the FSK modulated waveform from it. This modulated data is then passed to the wavfile object which writes the .wav file to storage. This process may be seen in the block diagram shown in the diagram below.

image

Receiver

The receiver object is a class that deals with the high-level algorithmic process of demodulating the received waveform. This is achieved by first initializing the parameters required for demodulation and synchronization. A thread is then started to record the modulated waveform of known length, once completed the thread writes the recorded waveform to file to be analyzed.

This analysis consists of first concatenating the recording so that so that the number of samples is a power of two. This was done to increase the speed of the synchronization algorithm in the frequency domain. For the FFT algorithms are considerably faster when applying them to data that is of length 2^n. The synchronization mechanism used was the matched filter previously designed, which ensured accurate symbol recovery.

This synchronized waveform was then demodulated using a correlation based FSK demodulation algorithm. Finally, the resultant binary signal as converted back into a UTF-16. This process may be seen in the block diagram shown below.

image

Message to JSON

The messages of message list are converted to JSON format and are written to "storage.json" file. From this file, chat history reads data and displays it.

Message & MessageAdapter

Message class defines the format of the message which contains sent and received text data and details of the user. MessageAdapter is used to manage the message list. It has functions which provide details of the message and also add the new message to the list.

String handler

The string handler was used to convert both the user entered characters into UTF-16 binary arrays and the demodulated binary arrays from UTF-16 to Java-based strings. The conversion from characters to UTF-16 was done by finding the UTF-16 value of each character in the user entered string and the conversion from UTF-16 to characters were done through the use of the Java-based StringBuilder object.

Audio Handler

The audio handler essentially worked as an interface for the wave-file library. It was able to take in modulated data streams and call the wav-file library to write them to storage. In order to do this, the audio handler checked permissions and created files and directories accordingly. Furthermore, the audio handler enabled reading the recorded wav-files from storage through the use of the wav-file library.

Signal Generator

The signal generator object was used to populate ArrayLists for the carriers and synchronization signals. The carrier generation was achieved by iteratively populating the ArrayList with a sinusoidal waveform sampled at 44100Hz.