prime contact:

In Carl Sagan's book Contact, and also in the movie, Ellen Arroway finds a signal from space that consists in a sequence of ascending prime numbers, just the first hundreds (I don't know if Sagan specified the exact length of the sequence.)

In his series Cosmos he also mentions such a signal. At Chapter 12, around 43:10, we can hear it. I estimate the pulses are separated about 0.2 s.

I have written a simple script that generates a signal like this. Just for fun. And also to set it as my new phone ringtone.

It requires a GNU/Linux terminal with sox and ffmpeg installed. Notice how you can edit all the parameters in the script: the frequency and length of the beeps, the prime sequence, etc.

#! /bin/bash
#script to generate a Contact signal consisting in prime numbers
sox -n -r 44100 silence.wav synth 0.2 sin 000  #silence between primes 0.2s
sox -n -r 44100 space.wav synth 0.10 sin 000 #space between beeps 0.1s
sox -n -r 44100 signal.wav synth 0.10 sin 1200 #beeps 0.1s 1200Hz
sox $( \
for i in {2,3,5,7,11,13,17,19} #prime sequence
do
for ((j=1; j<= $i; j++)) 
do
echo -n "signal.wav "
echo -n "space.wav "
done
echo -n "silence.wav "
done 
echo -n "temp.wav")
sox temp.wav contact.wav reverb  #add some reverb
ffmpeg -loglevel -8 -i contact.wav -acodec libvorbis contact.ogg #wav -> ogg
rm silence.wav
rm space.wav
rm signal.wav
rm temp.wav
rm contact.wav
Link to the source file here. You need to give it execution permissions with:

chmod +x contact.sh
And then execute it as

./contact.sh
For these parameters, the generated file is:



contact.ogg