Whenever we talk about patterns, manipulation of patterns and uses of contrapuntal techniques to modify a particular pattern, we always go back to the work of Johann Sebastian Bach, who was a master of composition and manipulation - I mean in this particular aspect of contrapuntal manipulation of musical ideas - and in particular there are some influential works that Bach produced. One is the art of the fugue and the other one is the musical offering where he uses all these manipulation techniques in an amazingly masterful way. Now, the examples that I want to talk about in this context are related to the idea of a canon. For those of you who are not familiar with what a canon is, a canon is a piece of music that is based on a single melodic line, that is played or sung by a performer, and then a second performer enters with the same identical melodic line but at a different time. So there is a superposition of two identical lines, with different starting points in time. And the combination of these two identical lines gives rise to harmonic and melodic effects that generate the composition itself. If one is a student in countrapoint that has to go through training in how to write canons and canons of very different kinds, this is not the place for me to go into all these details, but there are some very sophisticated canons that one can write, and one is what is called a crab canon. A crab canon is a canon where there is one melodic line that is sung or played by one performer, and the same melodic line is played but retrograted by the other one. So you have a single melody that one performer plays left to right, and the other one plays right to left at the same time. And there is a famous crab canon in the musical offering of J. S. Bach that you can hear, that you can listen to in the PowerPoint of this unit. You can see actually the whole canon as it is written. As you see, it is written only in one line, and so the first performer, the first voice, plays it normally, left to right, and the second one plays the score backwards. And this is actually how these crab canons were written at the time of J. S. Bach. The second example is another canon from the musical offering of J. S. Bach, it is called the mirror canon. In a mirror canon, we still have a single melodic line, that is the principle line of the canon, but then the response, or the second performer enters at a given point of the performance of the first line, but instead of repeating the same melodic content, it plays the same motif, but inverted. So it's an equilibrium between the original line and the inverted line that start at different times. Both a crab and a mirror canon are demonstrated in the notebook, where you can actually play with the structure of it using very few lines of code, so again it is a demonstration of how these kind of algorithmic processes give rise to very interesting musical structures.