Shepard tone: sequence with indefinite pitch increase

A Shepard tone is an auditory illusion wherein a sounds seem to keep getting higher and higher (or lower and lower) pitch for ever. There are many examples on Youtube, and the Wikipedia article (linked above) contains list of usage in films and video games.

A week ago, with Cambridge Coding Academy, we gave a short programming challenge to our alumni students: to create a Shepard tone in Sonic Pi.

Here’s the small, heavily documented solution we gave them afterwards:
The repository includes the source code as well as two samples with different speeds.

Feel free to use this code as you please, it is just a short demo of what can be done with Sonic-Pi and not a composition by any mean.