📼
Audio Movie Quote
Week 29
You are working for the local police agency and have uncovered some secret audio messages criminals are using to communicate
Having access to their text messages, you figure this first message is the criminals testing the system and will be a famous quote from a movie - you will hence be able to search online for the quote if you are unable to understand every word
Using your OS/media software/websites, you can determine the audio's sample rate is 44,100Hz - i.e. 44,100 samples per second
Listening to and analysing the audio's waveform, an audio expert your station reaches out to suggests the audio seems to be reversed - but not the entire file. They suggest the audio seems to be reversed in blocks, though the exact duration of each block is unknown
You could try creating a program to create a decoded sound file for a blocks corresponding to 1-10 seconds in duration - i.e. 10 output files. You hope one of these you will be able to hear the decoded message, if the audio expert's prediction is correct
As a simple example, suppose we split the audio into blocks of 5 samples (that would represent about 0.0001 seconds of audio - so just an example), we would reverse the blocks independently - i.e the first 5 samples are reversed, then the next 5 samples etc as we can see below (the pipe "|" is used to show where each block ends/begins)
Remember, it is suggested that your program creates about 10 output files - corresponding to blocks of 1 second, 2 seconds etc (think about how many samples that will have to be) - with your program creating files for a range of different block sizes, hopefully one of them will then reveal the message when played
If you uncover the test message, you should paste it below - spaces, punctuation etc will be striped from the answer, so you don't have to worry about that. The words/spellings will have to be correct - so if you can't make out every word, just search online for the exact full quote - good luck!
Hints
Hints will be released at the start of each of the following days - e.g. the start of day 3 is 48 hours after the challenge starts
| Release Day | Hint |
|---|---|
| 2 | Since you don't know the exact duration of each reversed block, you will want to create a loop from 1-10 - the number of samples this corresponds to is then the seconds (i.e. loop variable) multiplied by the sampling rate |
| 3 | You can either use a library to parse the wav, or more simply, just skip the first 44 bytes which correspond to a wav header |
| 4 | Since you have calculated the block size to reverse, you can then keep looping over blocks until you have reached the total file size, hence end of the file |
| 5 | Inside this loop is where you will want to swap the samples - there are various ways to do it, but one simple approach is to have an offset variable from the left and right - this offset starts at 0, hence meaning you swap the first and last sample in this block, then you increment the offset, hence swapping the 2nd and 2nd to last sample...then increment the offset, swapping the 3rd and 3rd to last sample and so on, until you reach the middle, meaning all samples have been swapped |
| 6 | Then write this new data (including the original header) to a file saved as a .wav and open it in any media player - after opening a few different durations, you should fine one that sounds clear |