###### Abstract
In recent years, there has been growing interest in using artificial intelligence (AI) to assist the harmonization of melodies in jazz [11; 12]. However, one major challenge in this area is the scarcity of properly annotated datasets [13; 14; 15], in the case of jazz standards, mainly due to copyright issues with the melodies. Additionally, lead sheets, which are commonly used in jazz to notate melodies, are often not properly annotated with tonality and other structural information, e.g., sections. As a result, AI models have difficulty learning to harmonize melodies in a way that accurately captures the essence of the idiom [16]. This highlights the importance of properly annotated datasets in the development of AI models for musical tasks. In the presented work, we employ a dataset of 444 jazz standard songs harmonizations (melody and chords in lead sheet format) to build and examine the presented methods. Deep learning architectures have lately become the norm for automatic music generation. Examples of such applications are [PERSON] [PERSON]'s DeepBach [17], BachBot [18], the BLSTM (bidirectional-LSTM) chord accompaniment system by [PERSON] et al. [19] and Google's Bach Doodle [20; 21]. Although each of these systems operates using different algorithms and techniques, the fundamental principles of music learning and generation underlying them are similar; new harmonic spaces are created by implementing learned representations into probability spaces [22]. While these systems offer promising results, their effectiveness depends on the availability of a large amount of data [23], which is rarely the case in symbolic music applications--certainly so in the case of jazz standards. Furthermore, the mechanisms underlying the harmonization processes are not transparent, not allowing direct explicit control of the output of the model [24], making specific tasks such as blending different harmonic spaces hard to fine tune [23]. On the contrary, the proposed HMM-based approach leads innately to explainable decisions by the model, a fact that has driven gradual improvements, as documented in Section 4.1. HMMs are very effective for generative music tasks [25], especially when, as in our case, the size of the available dataset is limited. Some innovative approaches in melodic harmonization that employ HMMs are those of [PERSON] and [PERSON] [26], [PERSON] and [PERSON] [27] and [PERSON] et al. [28]. In the broader context of music generation, a Markov Model can be used to predict the next notes or chords in a piece of music based on the previous ones by creating a transition matrix. This can be useful for generating music that has some degree of structure and coherence [29] and also can be used to blend different harmonic spaces by combining the chord transition matrices [30]. One limitation of Markov Models, however, is that they are local, meaning that they only consider the immediate surroundings of a given note when making predictions. This can lead to a lack of long-term structure and coherence in the generated music, as the model may not consider the global context of the piece [31]. The problem of locality is a common challenge in music generation using Markov Models [32] and an approach to overcome it is to link the generative process on structure milestones that signify harmonic structural closings or phrase endings, i.e., cadences, using constraints at phrase boundaries [22]. A simple approach for composing melodic harmonizations under this scheme was presented by [PERSON] and [PERSON] [33], where constraints were added at phrase boundaries, ensuring appropriate cadential schemata at structurally important positions. This method is incorporated in the CHAMELON melodic harmonization assistant [7; 34; 35], which is the core system we use in the current work. Another problem concerning the HMMs models is that the chord transition options can be limited [36].