Sources


 
 

The system has been implemented in Matlab. The code has been tested using Matlab R2015a 8.5 and Octave 4.4.1.

Note that there is a bug in the strncmp function in Octave versions between 4.0 and 4.2: this function is used to convert text to bits, so the system may not work properly if using those versions of the program. The problem is fixed in newer versions; also, a patch is available.

DOWNLOAD

Here you can download a ZIP archive with the Matlab source code that has been written to implement the system. Some demo audio files are included, too.

audioURL.zip

ARCHIVE CONTENT

In the downloaded archive there are some folders and files, briefly described below.

MAIN SCRIPT: GENERAL

The main Matlab script to call to use the system is audioURL.m: the program asks the user what to do (initialization, embedding the URL, recovering the URL), requests the needed inputs and then calls the proper functions. The user can also decide to display some plots about the main stages of the process and to do some tests. Lastly, there is a demo both for embedding and recovering the URL.

The original WAVE audio files in which the URLs have to be embedded must be stored in the folder ./audio/original/. The resulting audio files will be stored in the folder ./audio/embedded/ and their names will be the same of the original with an _out appended: if (filename).wav is used, the output will be (filename)_out.wav. Two other files are produced and saved in the same folder: (filename)_psk.wav and (filename)_test.mat. The first one is a WAVE audio file, that is the PSK signal that encodes the embedded URL and can be useful for testing, but it is not needed for the system to work. The other contains the expected signals at the various stages and is useful to test the various steps when recovering the URL.

When recovering the URL, the recorded audio could be obtained in three different way:

  • It could be captured in mono directly from a MIC connected to device in use: in this case, the user has to make sure it is capable of recording the needed frequencies well, without processing (for example, some devices may work well only in the spectrum needed to record human voice and filter out the others or may do some compression).
  • As this is a prototype and tests have to be done, the user can also get it directly from the embedded audio WAV file (filename)_out.wav: a portion of audio, converted to mono, is taken in a random position. In this case the system is in ideal conditions (no noise, no distortions, no frequency shifts)
  • Lastly, the user can also get it from another WAV file that stores the audio captured in mono before with another device (again, this has to be capable of recording the needed frequencies well without processing): a portion of audio is taken in a random position. Here the system is in a real environment. To allow multiple recording files for different conditions, the recorded audio files must be named as (filename)_rec_n.wav, where n is a progressive number (this simplifies the testing); also, they must be in the folder ./audio/recorded/.

MAIN SCRIPT: DEMO

As stated above, there is also a demo. The WAV file that is used as the original audio is DEMO.wav in the folder ./audio/original/; this file is obtained from the one that can be found here licensed under CC0: the only modification to it were changing the bitdepth to 16 bit. As URL, the following is used:

DEMO_url = https://example.com/123abcd/index.html

To show an example of the embedding of an URL, the following files, that can be used for other tests too, are included and recreated each time in the folder ./audio/embedded/:

  • DEMO_out.wav: this WAV file represent the result of embedding the string DEMO_url into DEMO.wav.
  • DEMO_psk.wav: this WAV file represent the PSK signal that is obtained by encoding the string DEMO_url. This should be inaudible.
  • DEMO_test.mat: this MAT file contains the test information for the coding of the string DEMO_url into a PSK signal.

In the folder ./audio/recorded/ there are also some WAV files containing recordings of about 30 seconds of DEMO_out.wav, captured with a smartphone, that can be used to show examples of the recovering of an URL. Note that as this is a demonstration of a real environment, not always DEMO_url can be obtained. Six main situation have been included:

  • DEMO_rec_1.wav: here the capture was made close to the speakers (about 1 meter away), keeping the device still, in an outdoor environment and without loud noises.
  • DEMO_rec_2.wav: here the capture was made close to the speakers (about 1 meter away), moving a bit the device (to accentuate Doppler effect), in an outdoor environment and without loud noises.
  • DEMO_rec_3.wav: here the capture was made not close to the speakers (about 3 meters away), keeping the device still, in an outdoor environment and without loud noises.
  • DEMO_rec_4.wav: here the capture was made close to the speakers (about 1 meter away), keeping the device still, in an indoor environment and without loud noises.
  • DEMO_rec_5.wav: here the capture was made close to the speakers (about 1 meter away), moving a bit the device (to accentuate Doppler effect), in an indoor environment and without loud noises.
  • DEMO_rec_6.wav: here the capture was made not close to the speakers (about 3 meters away), keeping the device still, in an indoor environment and without loud noises.

FUNCTIONS

The function in the file audioURL_init.m initializes all the needed parameters, filters, etc (the ones described in System) and saves them in the file audioURL_parameters_filters.mat in the current working directory. The same file will be imported both by the URL2AUDIO and the AUDIO2URL functions described below, because the parameters, filters, etc must match. Any modification to these must be done in this function: initialization has to be done again by calling the script audioURL.m, so that the .mat file is updated (the demo will not work properly, though).

The function in the file URL2AUDIO.m takes the URL to encode and embeds it in the desired audio file.

The function in the file AUDIO2URL.m gets the recorded audio and recovers the URL.

Lastly, in the folder ./functions/ there are other Matlab functions that are used by the three main ones.

More details on the functions can in found in the relative .m files.

Also, in the subfolder ./functions/01_Varicode/data/ there are the .txt files with the mapping used for converting the text URL to a bit array, using custom Varicode encoding described in the System page. There are also the programs used to generate these files. More information can be found in the file INFO.txt in the same location.