## 2 Methodology for Jazz Standard Cross-Harmonization
### Data, Overview of Methods and Problem Formulation  
The presented methods incorporate (a) a simple method for grouping chords and (b) a method that enables the employment of a support space in a constraint-Hidden Markov Model (CHMM) setup [33]. A \"universe\" of \(N\) chords (HMM states) is considered that comprises 12 roots and 64 jazz chord identified--resulting in \(N=768\) possible chords. These chord types are the ones identified in the commercial app Genius Jam Tracks ([[https://geniusjamtracks.com](https://geniusjamtracks.com)]([https://geniusjamtracks.com](https://geniusjamtracks.com)), last accessed: 19 January 2023). These chords are divided into groups (detailed description in Section 2.2). A set of 444 jazz standards from The Real Book were annotated with chords of this app along with their melodies from real books. Melodies are represented only by their pitch and onset time; no information is retained for their duration or MIDI velocity. The starting tonality of each piece is considered to be \"_the tonality_\" of the entire piece, even though several pieces incorporate clearly tonality changes; all chords within a piece are considered as _scale degrees_ of the identified tonality. The decision to consider only one tonality for each piece aims to allow capturing of transposition-related harmonic characteristics within a piece through transitions. For instance, in \"So What\", there is a clear transposition from D minor to E? minor in Section B--and back to D minor in Section C. Considering this piece to have a single tonality with a D minor label leads to a Markov transition model that has positive probabilities for transitions between chords in the Dm and E?m groups. Actually, since all chords in all pieces are considered as scale degrees of the annotated tonality, using \"So What\" as Song B enables transitions between chords in groups of Im and Il?m, whenever and if the melody accommodates such a transition. A melodic segment is described by its relative pitch class profile, i.e., a 12-dimensional vector that describes the pitch class profile of all melody notes relative to the tonality of the piece--hereby termed as the \"_relative pitch class profile_\" (rPCP) of the melody. Considering some problem-specific information, the cHMM model requires the following components from Song A (melody and constraints) and Song B (chord transition):  
1. \(T^{N\times N}\) is the transition probability matrix of Song B. This is built by incrementing the values of an initially zero-valued \(N\times N\) that corresponds to the rows of the all the chords that correspond to the group of the first and all the columns of the chords in the group of the second chord, for every chord transition within Song B. Afterwards, all rows are normalized to sum to 1, hence representing transition probability density functions. 2. \(A^{12\times K}\) is the set of melodic segments per chord to be harmonized in Song A, considering \(K\) chord positions in Song A. The \(A\) matrix incorporates a 12-dimensional column describing the rPCP of the melody notes underlying each of the \(K\) chords in Song A. 3. \(C^{\{0,1\}\times K}\) is a binary array indicating whether a chord position of Song A is constraint (needs to be substituted by a chord within the same group of the chord already in Song A) or not. Problem formulation includes the following pieces of background knowledge information:  
1. Chords are divided in groups according to their type--details in Section 2.2. 2. \(S^{N\times N}\) is the \"_support_\" transition probability matrix of all songs in the database (444). This is built by adding the respective \(T\) matrix of each piece, weighted by the number of chords within each piece--amounting to the proportional probability contributions of each piece in the final \"universal\" probability distribution of chord group transitions. This matrix will be employed if the Viterbi algorithm produces no information at a given time step (details in Section 2.3). 3.