## 2 Materials and Methods
The correlation coefficient with the largest value indicates the key of the analyzed piece. This algorithm is versatile and can be used to determine the key using any set of key-profiles. [PERSON] proposed his key-profiles [38; 39] after observing the results obtained using [PERSON]'s algorithm [37]. Krumhansl-Kessler profiles led to good results primarily for very short fragments of compositions (e.g., the first four notes of a given piece). These key-profiles have some disadvantages, though; for example, the detected key frequently changes when the number of notes of the analyzed fragment of music increases. In addition, according to [PERSON], the Krumhansl-Kessler profiles exhibit a bias towards minor scales because of the different cumulative values obtained for the component tones of the harmonic triads in major and minor keys. According to [PERSON], unifying the cumulative value of the weights for the component tones of the harmonic triad for both tonalities (major/minor), as applied in [PERSON]'s profiles, eliminates this bias. Figure 3: The directed axes of the signatures of fifths corresponding to the fragment of the piece of music presented in Figure 1: (**a**) obtained for the multiplicities of occurrences of individual pitch-classes; (**b**) obtained for the aggregate durations of individual pitch-classes. There are other key-profiles in the literature [9; 33; 40; 41]; however, in our opinion, those created by [PERSON] and [PERSON] deserve particular attention [33]. They were developed utilizing artificial neural networks trained on pieces created by well-known composers such as [PERSON], [PERSON], [PERSON], and [PERSON]. Only the first and last eight bars of each piece were considered. The key detection was based on the analysis of the Euclidean distance between the points representing the analyzed fragments of compositions and the points associated with 12 major and 12 minor keys. The smallest distance indicated the key. A comparison of the major and minor key-profiles proposed by [PERSON] (K-K), [PERSON] (T), and [PERSON] (A-S) is shown in Figure 4. The values presented in the graphs are normalized by the maximum value corresponding to the tonic (0). We have found that the key of a piece of music can be detected in a simpler manner. By calculating the signature of fifths (Definition 1), determining its main directed axis, and then rotating this axis by 30 degrees in the clockwise direction, it is possible to identify a pair of relative keys [35]. In the next step, the actual key is determined via correlation of the vector of weights assigned to individual pitch-classes found in the analyzed fragment of music (the vector K) with the major and minor key-profiles associated with the position of the rotated main directed axis (only two correlation coefficients are calculated). The recognized key will be the one for which the value of the correlation is higher. **Example 2**. : _Finding the key of a music piece based on the signature of fifths._  
Let us consider the signature of fifths shown in the left part of Figure 3. Its main directed axis indicates the G tone. In this situation, the key of the piece of music is either D-major or b-minor, which are associated with the obtained main directed axis rotated by 30 degrees in the clockwise direction. Calculating the two correlation coefficients \(r_{xy}\), where \(x\) denotes the weighted pitch-class representation of the analyzed fragment of music and \(y\) corresponds, individually, to the D-major or b-minor Krumhansl-Kessler key-profiles, the following results are obtained: \(r_{x\text{ D-major}}=0.66\), \(r_{x\text{ b-minor}}=0.44\). The correlation coefficient calculated for the D-major key-profile is larger, hence the detected key is D-major (Figure 5). Figure 4: A comparison of the major and minor key-profiles proposed by [PERSON] (K-K), [PERSON] (T), and [PERSON] (A-S). Proper selection of the analyzed fragment of music is an important element of the key recognition process.