# Pitch Spelling Jazz Lead Sheets and Solo Transcriptions

Augustin Bouquillard, Florent Jacquemard

► To cite this version:

Augustin Bouquillard, Florent Jacquemard. Pitch Spelling Jazz Lead Sheets and Solo Transcriptions. CMMR 2025 - 17th International Symposium on Computer Music Multidisciplinary Research, Nov 2025, London, United Kingdom. hal-05230392

HAL Id: hal-05230392

https://hal.science/hal-05230392v1

Submitted on 29 Aug 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Pitch Spelling Jazz Lead Sheets and Solo Transcriptions

Augustin Bouquillard¹ and Florent Jacquemard²

¹ École Polytechnique, Palaiseau, France

augustin.bouquillard@polytechnique.edu

² INRIA, CNAM/Cedric, Paris, France florent.jacquemard@inria.fr

**Abstract.** We present an algorithm for pitch spelling tailored for written jazz music. Receiving some input in a MIDI-like format, including information about note heights (expressed in semitones from a reference lowest note) and boundaries of bars (measures), it estimates appropriate note names, one global key signature, and one local scale for each bar. These related pieces of information are jointly assessed in two optimization steps. In a first "modal" step, one likely scale is guessed for each bar, by minimising the number of accidentals that shall be printed in the engraved score, in a best-path search. Then, in a second "tonal" step, these local scales are used for estimating the key signature that would give the best note spelling on the whole piece.

We report successful experiments on a set of lead sheets from the Real Book as well as transcriptions of Jazz solo recordings and basslines.

Our procedure is originally designed for an application to music transcription, in particular the construction of digital collections of written jazz soli from audio recordings, in the context of musical analysis, teaching and cultural heritage preservation. Moreover, we have defined for its purpose new distances between various common jazz scales which might be of some interest in musicological studies.

**Keywords:** Music information retrieval · Music transcription · Common music notation · Pitch spelling.

## 1 Introduction

The preservation of outstanding jazz soli in sheet music has been a motivating goal of Automated Music Transcription (AMT) since the problem was first introduced. *Pitch Spelling* (PS) is an important subtask of AMT, whose purpose is to choose appropriate note names to denote, in Common Western Music Notation (CMN), pitch values initially expressed in an absolute number of semitones or equivalently, as key numbers on the piano keyboard (*MIDI key*). For a given note pitch, several possible notations exist in CMN, like for instance G♯ and A♭, and the choice of a particular note name is crucial for several reasons. Firstly, for the purpose of readability, by reducing the number of accidental symbols printed on the score: one global Key Signature (KS) is fixed for the whole piece (or a part of it), specifying 0 to 7 sharps or flats which are only printed at the
very beginning of each line and apply by default to all bars of the line. Secondly, the presence of printed accidentals, not in the global KS, is a cue of the tonal function of the notes, and an indication of local modulations. The scope of an accidental is always one bar, which is not only a typical level of granularity for such tonal changes but also close to the harmonic rhythm, with generally one or two chords indicated per bar. Modulations are indeed tightly linked to harmonic context. Specific PS issues arise when transcribing jazz music, as correlation between accidentals and modulation is greatly reduced in improvised soli. Frequent modal incursions, chromatic movements and melodic lines rich in foreign notes as well as a varying degree of freedom from the underlying chord progression make the spelling task more difficult.

*State of the Art.* Several PS algorithms have been proposed in the literature. Many of them have been designed according to musicological criteria, such as the analysis of voice-leading, interval relationships and local keys [20,6,16], or a principle of parsimony (minimisation of the number of accidentals) [5,4], or to some relevant intermediate data structures, such as the Euler lattice [13] or weighted oriented graphs [23], in order to reduce PS to optimisation problems. Some other approaches to PS are based on training statistical models such as HMM [21] or RNN [10], with datasets of music scores. The last cited system, PKspell [10], has obtained state-of-the-art results on an iconic benchmark called Musedata, proposed by D. Meredith [16], made of 216 works by Baroque and Classical composers. In the former work [4], we proposed an algorithm for the purpose of PS and KS estimation in a strict tonal framework, which has obtained better results than PKspell [10] on the classical piano dataset ASAP [11] used for the training of the latter system (98.2% correct PS and 95.58% for KS estimation in [4], vs 96.50% for PS and 90.30% for KS estimation in [10]). To our knowledge, the applicability of the different approaches to jazz music, for example by trying to take into account the use of jazz modes, has not been studied so far.

*Contributions.* In this paper, we present a PS algorithm aimed at processing jazz music, in particular transcriptions of improvised soli, and its evaluation on three jazz datasets of various kinds. Its principle is to guess, from the pitches, the accidentals that shall effectively be written in the engraved score according to the notational conventions, jointly with global key signature information as well as local tonality or rather local scale determination, since jazz musicians do not tend to stay inside a strict tonal framework. The somewhat naive starting idea is to first minimise the number of accidentals printed on the whole score, which leads to several possible key signatures. Then we determine the best spelling options by deriving for each bar the most plausible local scale. Depending on the user-specified version of the algorithm, the latter is either chosen only among tonalities, or not only tonalities but also from the seven diatonic modes as well as the minor and major Blues scales. Best-path search procedures are used at bar level to calculate the solution of minimal cost at each step.

Our algorithm brings significant improvements to the former work [4]. Beyond extensive architectural and under-the-hood changes, the transition from a
strictly tonal framework to handling jazz data required a substantial increase in
the number of supported scales - from 30 to 165. To accommodate this expan-
sion, we propose a generalisation of the Weber distance (a measure originally
conceived for fully tonal contexts) extending it to encompass 11 modes across
165 distinct scales. This extension not only supports the broader melodic and
harmonic vocabulary found in jazz but also constitutes a standalone contribution
with potential relevance in studies oriented towards computational musicology.

## 2 Names and Scales

We first describe the problem studied, recalling basic notions and we then intro-
duce a new distance between scales which is one key component of our method.

### 2.1 Problem Input

Let us assume given in input a sequence of notes $v_1, \dots, v_p$, called a *part*. It shall
typically represent one staff in music notation, possibly including several voices
and chords. Every note $v_i$ in the input sequence is defined by:

(in$_{pi}$) a MIDI pitch value in 0..128,

(in$_{sim}$) a boolean flag expressing whether $v_i$ and the next note $v_{i+1}$ are played simultaneously

(in$_{bar}$) a boolean flag expressing whether $v_i$ belongs to the same bar as $v_{i+1}$.

By convention, the two flags are set to *false* for the last note $v_p$. The MIDI *pitch*
of a note $v$ corresponds to the distance in semitones from a reference lowest note.
Its value modulo 12, called *pitch class*, is denoted by $pc(v)$. We do not assume
the *onset* time nor duration of input notes to be given, however, we assume that
they are enumerated by increasing onset. Moreover, we require information on
the bar boundaries and note simultaneity. We call two notes *simultaneous* when
they occur on the same onset, because they are involved in the same chord, or
notes in different voices and starting simultaneously. However, a *grace-note* $v$, be
it single or involved in an ornament (appoggiatura, gruppetto, mordent, trill etc)
is not considered simultaneous with the next note $v'$, but preceding it, although
in a score, $v$ and $v'$ have theoretically the same onset.

The above assumptions requires the time values to be quantised, i.e., express-
able in a music score, in fractions of beats or bars. Our procedure is therefore
especially relevant as a backend task in a music transcription framework.

### 2.2 Problem Output

Given input notes in the above form, we are expecting the following outcome:

(out$_{ks}$) one estimated global *key signature*,

(out$_{spell}$) a *spelling* for each note,

(out$_{loc}$) one estimated *local scale* for each bar.
The spelling of a note is made of: a name in A..G, a symbol of accidental, amongst ♭, ♯, ♩, #, *, and an octave number in -2..9. Every note name is associated a unique pitch class: 0 for C up to 11 for B, and the accidental symbol acts as a pitch class modifier: -2 for ♩ up to 2 for # (the ♭ may be omitted). With the convention that the MIDI pitch 0 has spelling C-1, every note spelling can be associated a unique MIDI pitch value.

The opposite is not true: there exists several (2 or 3) alternative valid spellings for every MIDI value, summarised in Figure 1 for the 12 pitch classes. For instance, B♯-2, C♭-1 and D♭-1 are alternative spellings for the MIDI pitch 0. A key signature (KS) is denoted by an integer *k* between<fnref n="3" /> -7 and 7, which indicates that by default, |*k*| note names shall be altered by a #, when *k* is positive, or by a ♩, when *k* is negative. The names of the notes altered are defined according to the order of fifths: F♯, C♯, G♯, D♯, A♯, E♯, B♯ for *k* > 0, and B♭, E♭, A♭, D♭, G♭, C♭, F♭, for *k* < 0.

A mode is a sequence of intervals. In this work, we consider the following 9 heptatonic modes: ionian (or major mode), dorian, phrygian, lydian, mixolydian, aeolian (or natural minor), melodic minor, harmonic minor and locrian, as well as the major and minor blues modes. We call *scale* the pairing of a KS and a mode, functionally identical to the usual definition of a mode anchored to a tonic. In a tonal context, "scale" and "key" are synonymous concepts. Some scales can induce accidentals outside the KS, that we call here *characteristic accidentals*. It is for example the case of the leading tone at the seventh degree of harmonic minor scales. Intuitively, these accidentals, when printed, enable to recognise the scale at sight.

<table><caption>**Fig. 1.**
Enharmonic spellings for each pitch class.</caption><thead><tr><th>pc</th><th></th><th></th></tr></thead><tbody><tr><td>0</td><td>Db</td><td>C B♯</td></tr><tr><td>1</td><td>D♭</td><td>C♯ B♯</td></tr><tr><td>2</td><td>E♭</td><td>D C♯</td></tr><tr><td>3</td><td>F♭</td><td>E♭ D♯</td></tr><tr><td>4</td><td>F♭</td><td>E D♯</td></tr><tr><td>5</td><td>G♭</td><td>F E♯</td></tr><tr><td>6</td><td>G♭</td><td>F♯ E♯</td></tr><tr><td>7</td><td>A♭</td><td>G F♯</td></tr><tr><td>8</td><td>A♭</td><td>G♯</td></tr><tr><td>9</td><td>B♭</td><td>A G♯</td></tr><tr><td>10</td><td>C♭</td><td>B♭ A♯</td></tr><tr><td>11</td><td>C♭</td><td>B A♯</td></tr></tbody></table>

## 2.3 Distance between Scales

Gottfried Weber defines in [22] a measure of distance between major and harmonic minor scales, which has been used for MIR tasks related to key estimation [9]. The Weber distance between two keys is the length of a shortest path between them in a 2D grid. Each node in the grid represents a specific key *K* with 4 neighbors that are considered close to *K*, either because they differ from *K* by only one note (dominant key, subdominant key, relative key) or because they have the same tonic (homonym keys: same tonic but different mode).

We propose in this work an extension of Weber's distance to the seven modern diatonic modes (ionian, dorian, etc), melodic and harmonic minor modes, and two blues modes, used for the estimation of local scales in the step described in Section 3.2 of the PS algorithm. We use a 3D structure represented in Figure 2. The modes are grouped by pairs, following the relationship between a major (*i.e.*, ionian) scale and its minor (*i.e.*, aeolian = natural minor) relative. It means in

<footnote n="3">³ We do not consider KS ≥ 8 or ≤ -8 as they are very rarely found.</footnote>
<figure><img src="image_2.png" /><figcaption>Fig. 2. Weber distance generalised to common jazz modes.</figcaption></figure>

particular that a descending minor third always separates the first note of the "major-like" scale from the first note of its "minor-like" counterpart; for example, F lydian has D dorian as its "modal relative". From every pair of "relative" modes we derive a new 2D grid similar to the original grid of [22]. All of the grids are aligned such that scales with a given nature of third (major or minor) and containing exactly the same notes are always placed on the same line; for example, the F lydian scale from the lydian-dorian grid, with a major third, is behind C ionian from the ionian-aeolian grid which is itself behind G mixolydian from the mixolydian-phrygian grid.

We add to this 3D structure the two other minor modes (melodic and harmonic), in the same places as their aeolian counterparts (with identical tonics), and finally the major and minor blues scales. The latter constitute a supplementary 2D grid placed between the lydian-dorian and ionian-aeolian grids, since the lydian distinctive augmented fourth is also present in the minor blues mode and the dorian mode is almost entirely contained in the major as well as in the minor blues mode.

We assign a cost of 1 to any move in a straight line from one 2D grid to an immediate neighbouring 2D grid, and to any horizontal or vertical move within a single 2D grid. Finally, the *distance* between two scales is the minimum number of moves in the 3D grid to go from one to the other.

## 3 Pitch Spelling Algorithm

We present a method addressing the problem presented in Section 2, based on counting the accidentals that would be printed in a score following notational conventions recalled in 3.1 and using our extended distance (Section 2.3) between scales to refine its results. The possible choices are exhaustively explored through dynamic programming techniques.
Our approach, guided by common principles of musical notation and writing, works in two steps: the first step (Section 3.2) evaluates one likely scale for each bar, using the characteristic accidentals in different spellings. The second step (Section 3.3) uses the estimated local scales in order to refine the selection of KS and spellings. The local scales are essentially a byproduct of our algorithm, used in an intermediate state to estimate the best spellings.

## 3.1 Conventional Spelling and Shortest Path

For readability reasons, some accidentals are not printed in engraved scores. Following a principle of parsimony, the notational conventions [12] are roughly as follows: accidentals already in the key signature are omitted by default, and other accidentals need not be repeated in the same bar. There is an additional restriction to this rule, which we will treat as an option in the following:

(opt\_oct) An accidental applies only to the pitch at which it is written: each additional octave for the same pitch class requires a further accidental [12].

To ensure the principle described above, we consider a *state*, which is a mapping of note names (and octaves, in the case of opt\_oct) into accidental symbols. For simplicity, we describe the case where (opt\_oct) is disabled. Starting from a state σ, when processing a note v with pitch class p, there are up to three possible transitions to a new state σ', corresponding to the possible name e and accidental a for p in Figure 1. If σ(e) = a, then σ' = σ, and the accidental a is not printed for v, otherwise, σ'(e) = a ≠ σ(e) (σ' is identical to σ for the other names), and a is printed.

Given a scale S, each bar begins with an initial state σ₀, defined according to one of the following options:

(opt\_und) σ₀ contains exactly the accidentals defined by the KS of S,

(opt\_lead) σ₀ contains the accidentals of the KS of S and the characteristic accidentals of S.

All notes in the bar are then processed to determine which accidentals are printed. By assigning an integral *cost value* to each transition, depending on printed accidentals, we can compute an optimal path for each bar and scale using a Viterbi algorithm [14] tagging each state σ with the cumulated cost of the best path from σ₀ into σ. The time complexity is linear in the number of states plus the number of transitions. In the worst case, the number of states can be exponential in the number of notes in the bar. However, we can prune unnecessary search branches by building the states and transitions on-the-fly, which keeps computation time reasonable in practice.

For additional efficiency, we impose the following restriction:

(res\_sim) two simultaneous notes (in the sense of in\_sim) in the same pitch class must have the same name. It is ensured by adding to the states an additional mapping of {0, ..., 11} into note names.
## 3.2 Modal Step

From now on, assume we are given *p* input notes to be spelled, distributed across *m* bars, and *n* possible scales denoted $S_1, \dots, S_n$. We construct an $n \times m$ table *G*, called the grid, where each entry $G[i, j]$ assigns an estimated scale to bar *j*, assuming the global starting scale is $S_i$. This involves two substeps.

**Substep 1** is the construction of a $n \times m$ table *T*, where $T[i, j]$ is the cumulative cost of a best-path computed with the algorithm of Section 3.1 under the following conditions: the initial state $\sigma_0$ is defined by ($\text{opt}_{\text{lead}}$), without the option ($\text{opt}_{\text{oct}}$), and, for each transition, a cost value of 0 if the corresponding accidental *a* is not printed, 1 if $a \in \{\flat, \sharp, \#\}$, or 2 if $a \in \{\flat, \star\}$. Thus, $T[i, j]$ is roughly the number of accidentals printed in bar *j* under global scale $S_i$. When different best-cost paths arise, tie-breakers are used (details omitted for brevity).

**Substep 2** is the construction of the grid *G*, where $G[i, j]$ gives the estimated local scale for bar *j*, assuming the starting scale is $S_i$. For $1 \le i \le n$ and $1 \le j \le m$, let $rk_T(i, j)$ be the rank of $T[i, j]$ in the *j*th column of *T*, i.e., the value *k* such that global scale $S_i$ gives the *k*th best cost in *T* on bar *j*. Given $i \in [1..n]$ the index of a hypothetical starting scale, let us consider the vector:

$$ \arg \min_{i_1, \dots, i_m \in [1..n]} \left( \sum_{j=1}^{m} rk_T(i_j, j) + \sum_{j=1}^{m} rk_d(S_i, S_{i_j}) + \sum_{j=1}^{m-1} rk_d(S_{i_j}, S_{i_{j+1}}) \right) $$

where $rk_d(S, S')$ is the rank of the distance $d(S, S')$, as defined in Section 2.3, among $\langle d(S, S_1), \dots, d(S, S_n) \rangle$. This yields for any line *i* the sequence $\langle i_1, \dots, i_m \rangle$ of local scale indices minimising a combination of spelling cost (first term in the sum), distance to the starting or "contextual" scale $S_i$ (second term), and modulation cost (third term). The sequence is computed using a shortest-path algorithm similar to that of Section 3.1. Finally, we set $G[i, j] = S_{i_j}$.

## 3.3 Tonal Step

The second and final step estimates a global KS ($\text{out}_{\text{ks}}$) and a note spelling with this KS ($\text{out}_{\text{spell}}$), using the local scales computed in grid *G*.

To this end, we construct a new $n \times m$ table *P*, similarly to *T*, but this time, with the option ($\text{opt}_{\text{oct}}$) enabled. Additionally, transition costs for computing $P[i, j]$ now account for the number of accidentals not in the estimated local scale $G[i, j]$. Intuitively, the spelling in $P[i, j]$ depends not only on the KS of $S_i$, but also on how well it fits the local scale $G[i, j]$.

More precisely, let *distance* be the number of accidentals in the transition that are not in $G[i, j]$ and let *accid* be the transition cost used for the construction of $T[i, j]$ (Section 3.2, Substep 1). The transition cost is defined as a lexicographically ordered triple: (i) *accid* + *distance*, (ii) *distance*, (iii) tie breakers as in Section 3.2.

The estimated global KS ($\text{out}_{\text{ks}}$) is the key signature $K_i$ of $S_i$ where row *i* of *P* is the one with the smallest cumulative cost. The chosen spelling ($\text{out}_{\text{spell}}$) corresponds to the minimal-cost path in that same row.
## 3.4 Rewriting Passing Notes

After spelling is chosen, we apply local corrections by rewriting passing notes, following the rules from D. Meredith's PS13 pitch-spelling algorithm [16], step 2.

Each rule applies to a trigram of notes $v_0, v_1, v_2$, separated by 1 or 2 semitones, in ascending, descending, or broderie patterns. If $v_0$ and $v_1$ (case $ℓ$), or $v_1$ and $v_2$ (case $r$), share the same name, then $v_1$ is rewritten. For example, in a broderie-up pattern, the rule $C C_# C \rightarrow C D^b C$ applies.

These rules follow classical voice-leading principles, we will discuss their relevance in a jazz context in the next section.

# 4 Evaluation

## 4.1 Implementation

The algorithm of Section 3 was implemented<fnref n="4" /> in C++20 (17k loc). This language was chosen for efficiency and integration into larger systems, in particular those designed for transcription, where quantised timings (especially bar boundaries) are computed before pitch spelling. A Python binding, based on `pybind11`, offers calls (in Python) to the C++ methods, and was used for evaluation.

For evaluation, we used the Music21 toolkit [7], to parse the ground-truth MusicXML score files in the evaluation datasets, extract the required note information (Section 2.1), and compare the estimated spellings with those in the original scores. Evaluation feedback is provided as tables (one row per opus) as well as output XML scores annotated with color-coded spelling differences, original spellings written under the staff when errors occur, and the estimated local scales and global KS (in grey)<fnref n="5" />. Example feedback can be found in Figure 3.

## 4.2 Datasets

We conducted an evaluation of our algorithm on three jazz datasets, based on the spelling in the original reference scores cited below (without annotations).

The first dataset comprises 200 lead sheets from the Real Book [1], in MusicXML format. Some were digitised by us, others were sourced from MuseScore, and have been manually curated to conform to the reference edition [1], in both spellings and chord symbols. Lead sheets are one page long on average, for a total of 6000 bars and 21000 notes in the whole dataset.

In addition to the above lead sheets, we considered a digitised version of [8], in musicXML format, consisting of 50 transcriptions of complex tenor sax soli from the Charlie Parker Omnibook [2]<fnref n="6" />. All scores in the dataset are transposed

<footnote n="4">⁴ See https://gitlab.inria.fr/pse/pse (branch beta) for the C++ code and the Python evaluation scripts.</footnote>

<footnote n="5">⁵ The complete outputs of our evaluations on the 3 datasets are available at https://github.com/florento/PSjazzEval.</footnote>

<footnote n="6">⁶ We corrected a few spelling discrepancies between [8] and the original [2].</footnote>
for C instruments. Some specificities of the scores in this dataset, regarding in particular note spelling, are discussed below in section 4.3. The dataset contains a total of 3640 bars and 22700 notes.

Finally, as a third case study from the same repertoire, we consider the dataset FiloBass [18] made of 48 MusicXML verified transcriptions of basslines of jazz standards, whose backing tracks are digitised from the Aebersold series [3], for a total of 12500 bars and 53000 notes.

## 4.3 Evaluation Options and Ablation Tests

We evaluated using the options defined in Section 3. Results are reported in Table 1. We vary the number of candidate scales for spelling (called $S_1, \dots, S_n$ in Section 3): 30 refers to major and harmonic minor modes for all KS, whereas 165 covers all the above, plus 6 other diatonic modes, melodic minor mode, and minor and major blues (see Section 2.2). We evaluate with and without the passing note rewrite rules of Section 3.4 (post-processing).

All datasets include one or several Chord Symbols (CS) per bar in standard jazz notation [15]. We offer 2 options regarding these CS during spelling. The first one, denoted by $\times$ in Table 1, is simply to ignore them. The second option consists in extracting CS notes (via Music21 [7]) and constraining their names during spelling. In this "force" mode, at CS positions, only the transitions that match the CS note names are allowed in the shortest-path search (Section 3.1). This last option makes sense in contexts such as automatic transcription of jazz soli, when the lead sheet is a standard whose CS are known in advance.

*Editorial choices.* In the Omnibook dataset [19], every opus uses a KS of 0, although the true global tonality is often not C major. We allow the option to force a global KS for out$_{ks}$ at the step in Section 3.3, but we did not use this option in our evaluations. Moreover, this dataset does not contain any B#, C, E#, or F#, nor any double accidental ♭ or $\times$. These can only be considered as editorial choices. Therefore, we offer the option to disable such spellings in our algorithm by removing the corresponding transitions (as in Figure 1) in the shortest-path search (Section 3.1). This editorial constraint is only applied to Omnibook as an option in our evaluations, as shown in the second results line for that dataset in Table 1. It is not applied to the other datasets, which do contain such spellings.

## 4.4 Results and Discussion

Evaluation results for every option and dataset are displayed in Table 1. We report a measure of accuracy, i.e., the percentage of estimated spellings that conform to those of the XML scores from the datasets. We take into consideration grace notes, and notes in chords (there are few chords in the evaluation datasets). Tied notes are counted only once, i.e., we ignore the spelling of a note tied to a previous one. Of course, when using the option to "force" chord symbols, we do not count the spelling of the notes in these chord symbols. We do not give the results of KS estimation, which are not very relevant in this context. Let
<table><caption>**Table 1.** Evaluation results.</caption><thead><tr><th></th><th>PKspell</th><th>PSJ</th><th>PSJ</th><th>PSJ</th><th>PSJ</th><th>PSJ</th><th>PSJ</th><th>PSJ</th></tr></thead><tbody><tr><td>scales</td><td></td><td>30</td><td>30</td><td>30</td><td>30</td><td>165</td><td>165</td><td>165</td></tr><tr><td>chords</td><td>×</td><td>×</td><td>×</td><td>force</td><td>force</td><td>×</td><td>×</td><td>force</td></tr><tr><td>rewrite</td><td>×</td><td>×</td><td>✓</td><td>×</td><td>✓</td><td>×</td><td>✓</td><td>×</td></tr><tr><td>Real Book</td><td>96.71</td><td>97.35</td><td>97.35</td><td>97.99</td><td><b>98.01</b></td><td>96.24</td><td>96.77</td><td>97.89</td></tr><tr><td>Omnibook</td><td>96.01</td><td>94.95</td><td>94.88</td><td>96.86</td><td>96.78</td><td>94.97</td><td>94.88</td><td>96.92</td></tr><tr><td>no B#, C#, E#, F#, G#, A#</td><td></td><td>97.23</td><td>97.06</td><td>97.91</td><td>97.70</td><td>96.78</td><td>96.63</td><td><b>98.04</b></td></tr><tr><td>FiloBass</td><td>94.73</td><td>94.68</td><td>94.53</td><td>94.84</td><td>94.68</td><td>94.87</td><td>94.71</td><td><b>95.23</b></td></tr></tbody></table>

us recall that KS and local scale estimations are by-products of the algorithm, mostly necessary for computing spellings.

We ran PKspell [10] on the 3 evaluation datasets (first column of Table 1). Note that the options on the number of tonalities, rewriting as well as exclusion of B#, C#, E#, F# and double accidentals are not relevant in the case of PKspell. The chord symbols were discarded (not spelled) for the evaluation with PKspell.

The algorithm of Section 3 is called PSJ in Table 1. The input notes are supplied using the values ($in_{pi}$), ($in_{sim}$) and ($in_{bar}$) presented in Section 2.1. For PKspell, the input is made of the pitch class and duration (in Music21 *quarter-length* [7]) of all notes in the datasets in the order in which they appear.

*Discussion.* We observe different trends in the results obtained with PSJ on the Real Book and Omnibook. Jumping from 30 scales to 165 scales globally improves the results of spelling for the Omnibook, while it worsens them for the Real Book. Regarding the rewriting of passing notes, on the whole, the situation is opposite. The explanation may lie in the different natures of the datasets. On the one hand, Real Book standards are made of rather simple melodies, fitting within the 30 tonal scales. The behaviour of PSJ with Real Book standards *wrt* rewriting is somewhat similar to what has been observed [4] with classical monophonic datasets or ASAP [11]. On the other hand, the Omnibook contains complex improvisations, with frequent changes in key, often drawing from a wider range of scales (off the 30, in the 165), even for brief incursions, and with a high degree of chromaticism making the classical rewriting rules at times inadequate. As one might expect, activating the option to exclude B#, C#, E#, F# and double accidentals improves drastically the spelling results on the Omnibook dataset.

The evaluations gave poorer results on the FiloBass corpus than on the others. As a potential explanation, we can point out an inherent difficulty of tackling the pitch spelling problem in a jazz context, which is the great variability of spelling logics in the available transcription datasets, sometimes even within a single piece. For instance, in the beginning of the 14th piece of the FiloBass corpus, the Hard-Bop standard *Four* of Eddie Vinson and Miles Davis, the 4th and 8th bars can be fruitfully compared - see Figure 3. Although they constitute a simple transposition by a Perfect Fourth of one another, the choices of spelling diverge for the third note of each bar. In the 4th bar, the surrounding harmonic
<figure><img src="image_3.png" /><figcaption>**Fig. 3.** Different spellings of bars 4 and 8 in opus 14 of FiloBass; bass clef, KS = -1, original spellings shown under the staff, estimated local scales written above it in grey.</figcaption></figure>

context of E♭m7 leads to a G♭, which is correctly predicted by our algorithm when using the cost class presented in Section 3.3. This cost combines the number of accidentals to the distance to the estimated local scale (left in Figure 3). In the 8th bar however, the reference chooses the other possibility B♭ instead of C♭. This alternative spelling is predicted by our algorithm if we change the cost class in the Tonal Step of Section 3.3 to a lexicographically ordered tuple: first the number of printed accidentals, then the distance to the current local scale. In this case, however, bar 4 is no longer spelled correctly (right in Figure 3).

A comparison of the results of PKspell [10] and PSJ on these datasets should be taken with caution. As explained before, input is not the same for both tools, and, moreover, the model of PKspell was not trained with jazz data, but with the dataset ASAP [11] of classical piano music. Nevertheless, we observed an advantage in results of PSJ over PKspell on the Real Book dataset similar to the one obtained on ASAP (see the summary in Introduction).

# 5 Conclusion

We propose a pitch spelling algorithm that takes temporally ordered MIDI pitches with bar boundaries as input and estimates a global key signature, one local scale per bar, and note spellings based on these guesses. Our algorithm draws on both engraving principles, following a principle of parsimony in use in common Western music notation for printing accidentals, and the kind of reasoning musicians use when inferring local tonalities from the accidentals. Design choices of the algorithm are guided by a concern for musical soundness.

This algorithm has been evaluated, showing good results, on 3 jazz datasets of different types: lead sheets, complex improvised tenor saxophone soli, and basslines. The results vary across these datasets, reflecting both the diversity of jazz repertoire documents and inconsistencies in spelling conventions across sources. This variability suggests that no single approach fits all use cases and motivates offering multiple options through a variety of coexisting cost classes and parameters, allowing users to adapt the algorithm to better reflect their priorities when transcribing jazz music.

An alternative approach to jazz PS would be to train a statistical model, such as PKspell, on the datasets of Section 4.2, or larger sources like the Weimar Jazz Database [17]. We see value in both algorithmic and data-driven strategies to jazz pitch spelling. One important virtue of learned models in this context is that
they relieve the designer from manually tuning cost functions and parameters. However, a rule-based algorithm like ours offers strong advantages, first in terms of user control, with options like those presented in Section 4.3, e.g., for editorial choices possibly related to one instrument, and second, for results explainability, as each spelling decision can be traced back to explicit, interpretable rules.

## References

1. The Real Book. Hal Leonard, 6th edn. (2007)

2. Aebersold, J., Slone, K.: Charlie Parker Omnibook. Hal Leonard (1978)

3. Aebersold, J.: Jamey Aebersold Jazz play-A-Long Series (2000), http://jazzbooks.com/jazz/JBIO

4. Bouquillard, A., Jacquemard, F.: Engraving Oriented Joint Estimation of Pitch Spelling and Local and Global Keys. In: Proc. of TENOR (2024)

5. Cambouropoulos, E.: Pitch spelling: A computational model. Music Perception 20(4), 411–429 (2003)

6. Chew, E., Chen, Y.C.: Real-time pitch spelling using the spiral array. Computer Music Journal 29(2), 61–76 (2005)

7. Cuthbert, M.S., Ariza, C.: music21: A toolkit for computer-aided musicology and symbolic music data. In: Proc. of ISMIR (2010)

8. Déguernel, K., Vincent, E., Assayag, G.: Using multidimensional sequences for improvisation in the omax paradigm. In: 13th Sound and Music Computing Conference (2016)

9. Feisthauer, L., Bigo, L., Giraud, M., Levé, F.: Estimating keys and modulations in musical pieces. In: Proc. of SMC (2020)

10. Foscarin, F., Audebert, N., Fournier-S'Niehotta, R.: PKSpell: Data-driven pitch spelling and key signature estimation. In: Proc. of ISMIR (2021)

11. Foscarin, F., Mcleod, A., Rigaux, P., Jacquemard, F., Sakai, M.: ASAP: A dataset of aligned scores and performances for piano transcription. In: Proc. of ISMIR (2020)

12. Gould, E.: Behind Bars: The definitive guide to music notation. Faber Music (2011)

13. Honingh, A.K.: Compactness in the Euler-lattice: A parsimonious pitch spelling model. Musicae Scientiae 13(1), 117–138 (2009)

14. Huang, L.: Advanced dynamic programming in semiring and hypergraph frameworks. In: COLING (2008)

15. Levine, M.: The Jazz Theory Book. Sher Music Co (1995)

16. Meredith, D.: The PS13 pitch spelling algorithm. Journal of New Music Research 35(2), 121–159 (2006)

17. Pfleiderer, M., Friel er, K., Abeker, J., Zaddach, W.G., Burkhart, B. (eds.): Inside the Jazzomat - New Perspectives for Jazz Research. Schott Campus (2017)

18. Riley, X., Dixon, S.: Filobass: A dataset and corpus based study of jazz basslines. In: Proc. of the 24th Int. Society for Music Information Retrieval Conference (2023)

19. Riley, X., Dixon, S.: Reconstructing the Charlie Parker Omnibook using an audio-to-score automatic transcription pipeline. In: Proc. of SMC (2024)

20. Temperley, D.: The cognition of basic musical structures. MIT press (2004)

21. Teodoru, G., Raphael, C.: Pitch spelling with conditionally independent voices. In: Proc. of ISMIR (2007)

22. Weber, G.: Versucht einer geordneten Theory der Tonsetzkunst. B. Schott's Sohnen (1818)

23. Wetherfield, B.: The minimum cut pitch spelling algorithm: Simplifications and developments. In: Proc. of TENOR (2020)