My sister Isabel Williamson is far better qualified than me to explain what a canon is. Basically, it's a generalisation of singing/playing a 'round'. In a round, a second player waits a time interval before playing the same melody as the first player. So the resulting sound is a melody superimposed with itself, but shifted in time. Canons, on the other hand, have been composed so that they sound good when played on top of each other shifted in time, or pitch, or backwards in time, or even backwards in pitch. Composers got quite creative with this, especially Bach. Read more about canons here or in the book Gödel, Escher, Bach: an Eternal Golden Braid (by Douglas Hofstadter).
Incidentally, I enjoyed the philosophical discussions in this book (mainly when the focus was on around Gödel) but I found the many long 'interludes' about the Hare and the Tortoise a bit too whimsical, and I skipped a lot of them to get through to the end. I will do another article about Gödel's Incompleteness Theorems, soon, and my main reference will be Gödel's Proof (by Nagel and Newman) which is much more concise and technically detailed than the GEB book.
While I was ill earlier this year, I found out that my favourite easy-to-use online graphing calculator, Desmos, has introduced a SOUND feature, and I was incredibly excited. So of course, while I was in bed I wrote a 'Frère Jacques' function, with automatic transposition into major and minor keys. You can then play the Frère Jacque function forwards and backwards, superposed with itself and translated - i.e., all the most common variations in a canon. The plan was to also do Bach's famous Crab Canon. But the method of transcription is... quite tedious.
Please show me if you implement a different tune, especially if it's a real Bach canon!
Play the automatic Frère Jacques Canon for yourself!