## 2 Proposed Method
### Music Language Model
#### 2.2.2 Transition Function  
A state \(S_{t-1}\) has a transition to state \(S_{t}\) if and only if each voice \(V_{i}\in S_{t-1}\) can either be transformed into the corresponding \(V_{i}\in S_{t}\) by assigning to it a single note with onset time \(t\), or if it is identical to the corresponding \(V_{i}\in S_{t}\).  
Figure 2: Example from an /a/ vowel utterance (one singer) templates: (**a**) original templates from the variable-Q transform (VQT) spectrogram; (**b**) revised dictionary templates following replication.  
This transition from \(S_{t-1}\) to \(S_{t}\) can be represented by the variable \(T_{S_{t-1},N_{t},W_{t}}\), where \(S_{t-1}\) is the original state, \(N_{t}\) is a list of every note with onset time \(t\) assigned to a voice in \(S_{t}\) and \(W_{t}\) is a list of integers, each representing the voice assignment index for the corresponding note \(N_{t}\). Specifically, \(N_{t}\) and \(W_{t}\) are of equal length, and the \(i\)-th integer in \(W_{t}\) represents the index of the voice to which the \(i\)-th note in \(N_{t}\) is assigned in \(S_{t}\). Notice that here, \(N_{t}\) only contains those observed notes that are assigned to a voice in \(S_{t}\), rather than all observed notes.  
The HMM transition probability \(P(S_{t}|S_{t-1})\) is defined as \(P(T_{S_{t-1},N_{t},W_{t}})\):  
\[P(T_{S_{t-1},N_{t},W_{t}})=\Psi(W_{t})\prod_{i=1}^{|N_{t}|}C(S_{t-1},n_{i},w_{ i})P(V_{w_{i}},n_{i}) \tag{10}\]  
The first term in the above product is a function representing the voice assignment probability and is defined as follows:  
\[\Psi(W)=\prod_{j=1}^{M}\begin{cases}P_{v}&j\in W\\ 1-P_{v}&j\
otin W\end{cases} \tag{11}\]  
Here, the parameter \(P_{v}\) is the probability that a given voice contains a note in a frame.  
\(C(S_{t-1},n,w)\) is a penalty function used to minimize the voice crossings, which are rare, though they do sometimes occur. It returns by default one, but its output is multiplied by a parameter \(P_{cross}\)--representing the probability of a voice being out of pitch order with an adjacent voice--for each of the following cases that applies:  
1. \(w>1\) and \(\text{Pitch}(V_{w-1})>\text{Pitch}(n)\)
2. \(w<M\) and \(\text{Pitch}(V_{w+1})<\text{Pitch}(n)\)  
These cases in fact provide the definition for precisely what constitutes two voices being \"out of pitch order\". For example, if the soprano voice contains a note at a lower pitch than the alto voice in a given frame, the soprano voice is said to be out of pitch order. Cases 1 and 2 apply when a note is out of pitch order with the preceding or succeeding voice in the state, respectively. \(\text{Pitch}(V)\) represents the pitch of a voice and is calculated as a weighted sum of the pitches of its most recent \(l\) (a parameter) notes, where each note's weight is twice the weight of the previous note. Here, \(n_{i}\) refers to the \(i\)-th note assigned to voice \(V\).  
\[\text{Pitch}(V)=\frac{\sum\limits_{i=0}^{\min(l,|V|)}(2^{i}\text{Pitch}(n_{|V| -i}))}{\sum\limits_{i=0}^{\min(l,|V|)}2^{i}} \tag{12}\]  
\(P(V,n)\) represents the probability of a note \(n\) being assigned to a voice \(V\) and is the product of a pitch score and a gap score.  
\[P(V,n)=\text{pitch}(V,n)\text{gap}(V,n) \tag{13}\]  
The pitch score, used to minimise melodic jumps within a voice, is computed as shown in Equation (14), where \(\mathcal{N}(\mu,\sigma,x)\) represents a normal distribution with mean \(\mu\) and standard deviation \(\sigma\) evaluated at \(x\), and \(\sigma_{p}\) is a parameter. The gap score is used to prefer temporal continuity within a voice and is computed using Equation (15), where \(\text{Off}(V)\) is the offset time of the most recent note in \(V\), and \(\sigma_{g}\) and \(g_{min}\) are parameters. Both \(\Delta_{p}\) and \(\Delta_{g}\) return one if \(V\) is empty.  
\[\text{pitch}(V,n)=\mathcal{N}(\text{Pitch}(V),\sigma_{p},\text{Pitch}(n)) \tag{14}\]  
\[\text{gap}(V,n)=\text{max}\bigg{(}\ln\big{(}-\frac{\text{On}(n)-\text{Off}(V)} {\sigma_{g}}+1\big{)}+1,g_{min}\bigg{)} \tag{15}\]