We have discussed how processes like harnessing randomness, or defining precomposition structures, micro- and macrostructures give rise to a composition and we also looked at three examples that show contemporary musicians and how contemporary composers use these tools, but there is more to this. Now, we will introduce this concept of pattern and how patterns and compositions are intrinsically related. So, patterns can operate on all levels of composition. From a microstructural point of view to a macrostructural point of view. So from, say the deep structural organisation of pitch and rhythm to how these combine in a macroscopic sense in the creation of the piece of music. Patterns can involve many different things, and there is a very general concept. It can be just a single song parameter or involve a single song parameter, such as the frequency for instance, fundamental frequency of a sound, or multiple sound attributes so the amplitude, the duration, the pitch, and how this evolve over time. And again, we operate on patterns with most, or all, of the same operations that we have introduced in the previous units, but we can add more operations now in a kind of broader palette of possibilities for composition. So patterns can be cycles, where I have a sequence of elements that I repeat in a loop; it can be just a line, so that I go from one beginning to an end in a particular sequence and that's a pattern; I can do palindrome, where I go forward and backward on a same sequence; I can permute elements randomly in what we call a heap; or I can use stochastic elements to generate, to select elements in different distributions, so we encounter again some of the operations that we already defined in previous units, but now we put them in a larger and broader context. You can see here in this chart that we can have rotations, we can have Markov chains, we can use graphs and networks as elemental structures of a piece, or how we structure the space of pitch, for instance, or rhythm. We can have functions and we can have rules, so we can define actually a grammar that we can then follow in the composition of the piece. In the example that is discussed in the Pierre Boulez video, that's actually a form of grammar that we have defined with some specific rules that are associated with musical meaning. Now, patterns are by definition, objects that have a length, so different lengths correspond to different chunks of the pattern, or they have a period that is repeated, so it kind of defines a longer timeframe of the composition. And again, this plays into this micro vs. macro scale of the compositional process and the actual result of the composition that is the musical piece. Patterns can contain other patterns, so again we have another aspect of scale economy in music, I have patterns that are composed of different patterns, and I can play this game to the microscopic scale of the single pitches and single durations. They can work in parallel because I can add patterns for rhythm and patterns for harmony, and patterns for melody and so on. And the idea is that we combine all of these patterns in a composite that is the foundation of the composition, the design, the framework and the content of the piece. Let's talk now about specific patterns that we can use to compose, and let's start with mathematical patterns, so what I call music from math. Now let's say that beautiful mathematics doesn't necessarily give rise to beautiful music, and vice versa, but sometimes it does. And so we can look at some classical examples of number series of integers for instance, like you know the Pascal's triangle, or the Fibonacci's sequence. The Fibonacci's sequence has been used by innumerable numbers of composers over centuries, it's all related with this golden ratio, it has philosophical implications and so on. So, we find Fibonacci sequences in the structure of Mozart piano sonatas, or Bach chorals, or you know, many different examples. Now, here what is really important, in order to translate a mathematical function or a mathematical sequence into music, is to define a mapping strategy for both pitch duration and so on. So again, we go back to the idea that we use a deterministic function in a way, that we want to translate into some material. Of course, the mapping depends on the data that you have, so you can map pitch durations or other parameters, dynamics, orchestration, macroparameters, like the length relationships between different sections of a single piece, for instance. And this is where this Fibonacci sequence comes in very prominently in the history of music. Mapping pitches can be done on the integer mapping that we have introduced from 0 to 11, so the 12 pitches of the equal tempered scale, or any other scale for that matter. Or we can do it with MIDI numbers, or we can map to a specific scale, these are all possible techniques, and there are probably many others that one can utilize. Now one thing that we need to do when we map from data to pitch for instance, is that our data need to be normalized. So even in a sequence of numbers, if we are mapping to a modulo 12 number system, we need to normalize the data, or do something to the data, so that we can eventually map with the right correspondance. So normalization is something that is, you know, standard mathematical operations that we can do on a series of data, and here on this slide you see a way of mapping, for instance, data points to indices, indices that might be indices of a scale, or indices of a sequence that you predefine and then you map, you use these indices to map your data points to a particular sound or pitch or duration. You also need to map durations, so you can use the same trick as in the previous slide, in the normalization, you can define an indexing sequence that maps to a predefined set of durations. So you can use intrinsic properties of the data to extract some duration properties. And here, I am showing you an example in this formula, where I map the duration to the pitch difference between subsequent notes. So if the notes are closer together, then the duration is shorter; if they are further apart, the duration is larger. All these ideas are demonstrated in the notebook that is associated to this unit, and you will be able to play with this and explore by yourself how you can map specific sequences of integers for instance into musical objects. So another way that we can extract patterns and then use them in a musical context is, rather then using a mathematical formula to generate the data, it's to use the data itself, data that is available, measurements of any process that you can think of. And here, I want to make an aside, because using data to make music is not what people call data sonification. It is not like if I use data from, I don't know, the sun activity over the past twenty years, I am not giving you the sound of the sun. I am giving you a musical abstraction that uses the data to generate parameters of a composition. Data sonification is associated with the utilitarian use of sound to convey information. And so, there are instances where sound can be used as an objective representation of the data, a perceptualization of the data, that is complementary to the visual representation for instance, and sound has been suggested as one way, for instance, of making sense of large data sets that are impossible for a human to grasp just by visualizing them. I will not be talking about this aspect here, there is a lot of literature that you are welcome to research about data sonification and how this can be used in a scientific setting. Here, I want to use data with an aesthetic and an artistic goal, that means I want to use the data as pattern-generating objects that I can then use in a composition, a little bit like we did with random data, in the previous unit. Data needs to be read, and it comes in many different formats. You have examples of this in the notebook associated with this unit, where we use actually existing libraries that are very well known in the data science community, like pandas for instance for Python, that allow us to read data and transform and manipulate them and map them into musical parameters within the context of this course. You can find many different websites, like the one that is indicated here in this slide, where you can get data from, and in the notebook there is at least one example where we read and manipulate data and then create a mapping to a musical composition. We have seen mathematical functions used as generating sequences and patterns for musical compositions, we have seen how we can use data to do the same, but this is not enough to create, to generate a piece of music. Most of music is based on the application of some processes to ideas. So, my pattern as I was saying earlier can be manipulated and extended using processes, and these processes are central to the analysis and composition of music. So, we can talk about combinations of notes horizontally, so in a melodic context, I can start from a motif, or a pattern, and then changing or applying a process to this pattern in order to enrich the musical content. And here, we have various examples that have been present in music for centuries, like the canon or the round or any contrapuntal construction that we can do on a pattern, or a motif. Or, we can combine notes vertically, so form chords and vertical combinations of pitches that lead to chord sequences, or what we call chord progressions, or voice leadings. All of this can actually be described at the micro level as an algorithmic process. Of course, these processes are rules that one follows, and the genius of the composer is to navigate these rules and create something that is original and compelling. But the rules can be analyzed as elements of a general grammar of music composition.