# An Analysis of Rhythmic Patterns with Unsupervised Learning
## 3 Analyses
### Experiment 2: Robustness of the Model to Timing and Tempo Variations  
The compositional structures in the model encode individual rhythmic patterns in a relative representation. Such relative encoding makes the learned patterns independent of the underlying tempo and minimizes the amount of parts per layer. During inference, activations of these structures map them into absolute temporal space by scaling, where the scaling factor is encoded in the activations. To demonstrate the model's ability to learn patterns regardless of the underlying tempo and its ability to encode tempo changes in the scaling factor of each activation, we learned a model on a Sirtaki song (Song available on Youtube: [[https://youtu.be/CbmbSjeUrxc](https://youtu.be/CbmbSjeUrxc)]([https://youtu.be/CbmbSjeUrxc](https://youtu.be/CbmbSjeUrxc)), alternative version available here: [[https://www.youtube.com/watch?v=dzlcxN0](https://www.youtube.com/watch?v=dzlcxN0) lxSo]([https://www.youtube.com/watch?v=dzlcxN0](https://www.youtube.com/watch?v=dzlcxN0) lxSo)), which is well known for its rhythmic and tempo changes. Figure 14: A tango part representing the regular “1-2-3-4” beats that match the meter and a syncopated off-beat (third onset from the left). Figure 13: The most prototypical part found in the cha cha trained model on layer \(\mathcal{L}_{3}\). The “four-and-one” pattern is partially explained. However, two other eight-note events are also included. Due to the relative encoding of patterns, the entire hierarchy contains few parts on its five layers--\(\{2,3,7,8,8\}\). We show that by observing the scaling factor of part activations, we can infer tempo changes in the analyzed song. More specifically, we focus on the segment (60-150 s) during which the rhythm remains similar, but the tempo increases drastically. The segment starts with a tempo of about 90 beats per minute and gradually increases up to 210 beats per minute. In Figure 15 we show how the scale of activations of a \(\mathcal{L}_{6}\) part, representing ten straight beats, changes. The scaling factor starts at 0.7 and decreases down to about 0.3. The ratio between the initial and the final scale corresponds to the ratio between the initial and final tempo. To show the model's ability to robustly extract rhythmic patterns in different time signatures from a single music piece, we looked at live music recordings on Youtube. In this context, an interesting live recording was produced by the Croatian singer [PERSON] in a song \"Djevojka sa sela\" (Song available on Youtube [[https://youtu.be/heJQAckM-el](https://youtu.be/heJQAckM-el)]([https://youtu.be/heJQAckM-el](https://youtu.be/heJQAckM-el))). The live version performed at her concert in 2009 was accompanied by trumpeters who played a 7/8 meter in verse, whereas the rock band played a 4/4 meter in the refrain. By training the model on this song, we produced a 5 layer hierarchy, containing \(\{3,11,11,10,9\}\) parts on layers \(\{\mathcal{L}_{1}\ldots\mathcal{L}_{5}\}\), respectively. We first observed the three parts forming the first layer. The part structures are depicted in Figure 16.  
As is evident in Figure 16, two parts \(P_{1}^{1}\) and \(P_{3}^{1}\) activate across the entire song, while one part activates only on the segments played in 7/8 meter. On layer \(\mathcal{L}_{2}\), we can find five parts which cover 5-6 rhythmic events, explaining the 7/8 segments--as the 7/8 meter can be broken into \(3/8+2/8\) + 2/8 structure, these parts successfully find the downbeats of all three submeters. The remaining six parts are the compositions of \(\mathcal{L}_{1}\) parts, which cover both meters. Unfortunately, these parts also compose the majority of \(\mathcal{L}_{3}\) parts and further. This is a consequence of the statistical nature of the model's learning. Namely, the parts covering both meters cover a greater portion of the events when compared to the parts covering only the 7/8 meter segments.