---
title: Shruti-Aware FST for Indian Classical Pitch Correction
url: https://www.emergentmind.com/topics/shruti-aware-finite-state-transducer-fst
type: topic
---

# Shruti-Aware FST for Indian Classical Pitch Correction

Searching arXiv for the specified paper to ground the article.
Indian classical music encodes pitch through a 22‑shruti microtonal system rather than the 12‑tone equal temperament framework used by most symbolic music processing tools. Within *ShrutiSense*, the **Shruti‑aware finite-state transducer (FST)** is the component designed for **pitch sequence correction**: it transforms “westernized or corrupted” pitch sequences into sequences consistent with the 22‑shruti system and raga grammar by combining cent-based pitch fidelity, raga-specific transition constraints, and edit operations in a weighted transduction framework [2508.01498]. The model is presented as the principal correction mechanism in a broader system that also includes a Grammar‑Constrained Shruti HMM (GC‑SHMM) for melodic completion [2508.01498].

## 1. Conceptual definition and musical scope

The Shruti‑aware FST is a **weighted edit‑distance‑like mapping** between an observed pitch sequence and a grammatically valid shruti sequence [2508.01498]. Its purpose is not merely to quantize continuous pitch to a fixed grid, but to recover a culturally valid symbolic representation under two simultaneous constraints: the **22‑shruti framework** and **raga grammar**. This design addresses the paper’s claim that standard 12‑TET processing is inadequate because it conflates distinct shrutis, removes raga-specific microtonal distinctions, and ignores permitted transitions and characteristic phrases [2508.01498].

The paper defines two tasks for symbolic pitch processing: **pitch sequence correction** and **melodic completion**. The Shruti‑aware FST is described as the **main workhorse for the correction task**, while its use for completion is secondary [2508.01498]. In that setting, a “westernized or corrupted” sequence may contain notes snapped to 12‑TET, random shruti substitutions, added or missing notes, or pitch noise of up to ±50 cents [2508.01498]. The FST is therefore framed as a correction mechanism for both intonational and structural corruption.

A plausible implication is that the transducer should be understood as a symbolic MIR device specialized for Indian classical repertories rather than a generic pitch normalizer. Its correction objective is explicitly tied to “cultural authenticity,” since the output is intended to preserve microtonal distinctions and raga-governed melodic movement rather than optimize only local acoustic proximity [2508.01498].

## 2. Representation of shrutis, grammar, and transduction symbols

The underlying pitch model formalizes shrutis as cent offsets from a tonic \( f_0 \), with shruti \( s_i \) defined by

\[
f_i = f_0 \cdot 2^{c_i/1200}
\]

where \( c_i \) is the cent deviation from the tonic [2508.01498]. The fixed 22‑shruti cent set is

\[
\mathbf{C} = \{0, 90, 112, 182, 204, 294, 316, 386, 408, 498, 520, 590, 612, 702, 792, 814, 884, 906, 996, 1018, 1088, 1110\}
\]

and the minimum shruti spacing is stated as 22 cents [2508.01498]. This minimum spacing is central to the need for context-sensitive decoding, because nearby shrutis may be separated by less than the magnitude of plausible performance or extraction noise.

Each raga is modeled as a directed graph \( G = (S, T) \), where \( S = \{s_1, \dots, s_{22}\} \) are shruti positions and \( T \subseteq S \times S \) are allowed transitions [2508.01498]. Only a subset of 7–10 shrutis per raga is active. The grammar indicator is defined as

\[
G(s_i, s_j) =
\begin{cases}
1 & \text{if } (s_i, s_j) \in T \\
0 & \text{otherwise}
\end{cases}
\]

with transition weights

\[
w(s_i, s_j) = G(s_i, s_j) \cdot \exp(-\alpha \cdot d(s_i, s_j)) \cdot \text{pakad\_bonus}(s_i, s_j)
\]

and \( \alpha = 0.1 \) [2508.01498]. The graph therefore encodes both hard admissibility and soft preferences, including stepwise motion and characteristic phrase emphasis.

The input to the FST is a time‑ordered list \( O = (o_1, \dots, o_T) \), where each \( o_t \) is a continuous cent value derived from MIDI, symbolic notation, or audio [2508.01498]. Audio is processed via librosa’s `piptrack` (or similar) to obtain per-frame fundamental frequencies, and pitch in Hz is converted to cents using a logarithmic relation relative to a reference and then normalized relative to the tonic [2508.01498]. The output space consists of corrected shruti tokens expressed either as shruti indices \( \{1,\dots,22\} \) or equivalently as their cent values in \( \mathbf{C} \) [2508.01498].

## 3. Transducer structure and weighted operations

The paper does not provide a full formal tuple for the FST, but describes enough structure to reconstruct its operational design [2508.01498]. States represent positions in the output shruti sequence and are associated with a current shruti and its predecessor, enabling the computation of grammar costs. The input alphabet is conceptually continuous cent values, while the output alphabet is shruti labels or shruti-coded cent values [2508.01498].

The transducer supports four operation types on each step:

- **Match**: map input pitch \( o_t \) to a shruti \( s \).
- **Substitution**: map input pitch \( o_t \) to a shruti different from the nominal nearest.
- **Insertion**: insert an output shruti without consuming input.
- **Deletion**: consume an input pitch without emitting an output shruti.

These operations let the model repair both note identity errors and structural corruption such as spurious or missing notes [2508.01498].

Each transition is assigned a weight combining pitch fidelity, grammar compliance, and edit cost. The paper gives the intended form as

\[
w(q_i, q_j, o, s) = \lambda_1 \cdot c_{\text{pitch}}(o, s) + \lambda_2 \cdot c_{\text{grammar}}(s_{\text{prev}}, s) + \lambda_3 \cdot c_{\text{edit}}
\]

with coefficients

- \( \lambda_1 = 0.6 \) for pitch fidelity,
- \( \lambda_2 = 0.3 \) for grammar compliance,
- \( \lambda_3 = 0.1 \) for edit penalties [2508.01498].

The pitch cost is

\[
c_{\text{pitch}}(o, s) = -|o - \mu_s|/50
\]

where \( \mu_s \) is the cent value of shruti \( s \) [2508.01498]. Grammar cost forbids illegal transitions by setting them to \( -\infty \), while allowed transitions reflect the raga grammar weight \( w(s_{\text{prev}}, s) \) [2508.01498]. Edit costs distinguish matches from substitutions, insertions, and deletions, although exact numeric values are not specified [2508.01498].

The transducer operates in the log‑score domain, and decoding selects the path with **maximum total weight** [2508.01498]. This suggests that the model behaves less like a deterministic quantizer and more like a constrained lattice decoder over a small symbolic state space.

## 4. Context sensitivity and ambiguity resolution

The defining feature of the Shruti‑aware FST is that correction is **contextual** rather than purely local. Context enters first through the grammar graph: only transitions in \( T \) are allowed, and among those, shorter interval moves are preferred through the factor \( \exp(-\alpha \cdot d) \), while pakad-related transitions receive higher weight through `pakad_bonus` [2508.01498]. As a result, when two shrutis are acoustically close to an observation, the transducer chooses the candidate that better fits the preceding melodic context.

The paper further describes a **sliding window of three surrounding notes** for context‑aware completion, with an extended scoring function containing `w_base`, `w_transition`, `w_pakad`, and `w_position` [2508.01498]. Although this is presented most directly for completion rather than correction, the same section states that, for correction, the sliding window supports disambiguation in ambiguous zones and prevents grammar‑violating corrections even when those are very close in cents [2508.01498]. This suggests that local phrase structure, not only pairwise adjacency, can influence the choice of corrected shruti.

This context mechanism is particularly important because the minimum shruti spacing is only 22 cents [2508.01498]. Under such conditions, pitch distance alone may be insufficient in noisy input. The transducer resolves these ambiguities by combining three forces: hard rejection of grammar-violating paths via \( -\infty \), soft preference for stepwise motion and pakad patterns through grammar weights, and a nonzero grammar coefficient \( \lambda_2 \) so that contextual admissibility materially affects the total score [2508.01498].

The handling of insertions, deletions, and substitutions extends context sensitivity to structural repair. A spurious observed note can be deleted, a missing note can be inserted if it restores a valid progression, and an incorrect note can be substituted if a different shruti yields a more plausible path under the grammar [2508.01498]. The paper states that these edits are limited by \( \lambda_3 \), so the model prefers minimal, contextually plausible changes rather than unconstrained sequence rewriting [2508.01498].

## 5. Construction, parameterization, and implementation

The Shruti‑aware FST is **not learned via EM or discriminative training**; it is constructed from **musicological rules plus heuristic weights** [2508.01498]. Raga grammars are derived from classical treatises and implemented through the graph \( G = (S, T) \), while transition weighting uses the rule-based form \( G(s_i, s_j) \cdot \exp(-\alpha \cdot d(s_i, s_j)) \cdot \text{pakad\_bonus}(s_i, s_j) \) with \( \alpha = 0.1 \) chosen heuristically [2508.01498]. The pitch and grammar coefficients, \( \lambda_1 = 0.6 \) and \( \lambda_2 = 0.3 \), are also described as hand‑tuned, and the paper does not report any optimization of these hyperparameters [2508.01498].

Evaluation data consists of **1,000 synthetic pitch sequences** generated from canonical raga grammar rules, with controlled corruption through random note substitutions at 10–50%, missing values at 10–50%, and pitch noise up to ±50 cents [2508.01498]. Ground-truth shruti labels are known from the generation process. The paper explicitly notes that the data is used for evaluation rather than for learning FST structure or weights [2508.01498].

The computational formulation is lightweight. The stated complexity for the Shruti FST is \( O(TM^2) \), where \( M \) is the lattice size, and the paper sets \( M = 23 \) to account for 22 shrutis plus epsilon transitions [2508.01498]. Because \( M \) is small, the system is reported to be very fast. No specific FST library is named; Python and librosa are mentioned for audio preprocessing and pitch extraction, and implementation may be done either as a custom dynamic programming decoder or using a weighted FST library [2508.01498].

A conceptual Viterbi-like decoder is described in pseudocode, using DP and backpointers over shruti states with grammar filtering and edit operations [2508.01498]. This indicates that the FST can be realized as an explicit dynamic programming lattice without dependence on a specialized WFST toolkit.

## 6. Empirical behavior, comparative performance, and system role

Within *ShrutiSense*, the Shruti‑aware FST is characterized as the **main tool for pitch correction**, while the GC‑SHMM is the primary method for melodic completion [2508.01498]. Both models share the same 22‑shruti cent values, the same raga grammar graph, and the same tonic-normalized cent representation [2508.01498]. For practical audio correction, the reported pipeline is audio to cent sequence to **FST** to corrected cent sequence to synthesized audio [2508.01498].

The evaluation covers five ragas—Yaman, Bhairavi, Bilaval, Kalyan, and Khamaaj—with sequence lengths of 30, 50, and 100 notes [2508.01498]. Metrics include **Shruti Classification Accuracy (%)**, **Average Pitch Error (APE)**, grammar-related measures such as Raga Grammar Compliance and Pakad Pattern Recognition, and computational measures including time per sequence, memory, and real-time feasibility [2508.01498].

For the correction task at Yaman with corruption \( = 0.4 \), the paper reports the following comparison [2508.01498]:

| Method | Shruti Acc. (%) | Mean Error (cents) |
|---|---:|---:|
| GC‑SHMM | \(84 \pm 0.4\) | \(107.6 \pm 3.6\) |
| Shruti FST | \(91.3 \pm 0.2\) | \(45.6 \pm 1.4\) |
| Nearest Cent | \(89.4 \pm 0.3\) | \(51.8 \pm 1.4\) |
| Random | \(12.6 \pm 0.3\) | \(452.6 \pm 2.4\) |

The same experiment reports time values of \(12.5 \pm 0.3\) ms for GC‑SHMM and 0.1 ms for both Shruti FST and Nearest Cent, with 0 for Random [2508.01498]. The reported highlights are that the FST outperforms the HMM by about 7.3 percentage points in shruti accuracy, halves pitch error, slightly outperforms naive nearest‑shruti quantization, and is extremely fast [2508.01498].

Robustness results indicate that across 900 simulations, FST accuracy remains around **91.3%** with noise up to ±50 cents [2508.01498]. Example-sequence results at corruption levels 0.2–0.4 are reported as **86.7–90.0%**, with graceful degradation as corruption increases [2508.01498]. Across ragas, the reported accuracies are Yaman 91.1%, Bhairavi 90.7%, Bilaval 91.2%, Kalyan 91.8%, and Khamaaj 91.8% [2508.01498]. The paper interprets this as evidence that the Shruti‑aware FST generalizes across different raga grammars.

For melodic completion, however, the FST is weaker overall, with average accuracies of \(48.6 \pm 22.2\%\) versus \(60.1 \pm 30.9\%\) for the HMM [2508.01498]. The FST is therefore presented as principally a correction model rather than a general missing-data imputation model.

## 7. Musicological significance, limitations, and future directions

The Shruti‑aware FST is presented as preserving cultural authenticity in three explicit ways: it uses the **22‑shruti grid** instead of 12‑TET, enforces **raga grammar** through grammar cost and transition weights, and balances pitch proximity with grammar compliance so that corrections are raga-appropriate rather than merely numerically closest [2508.01498]. The paper also states that it implicitly captures preference for stepwise motion through \( \exp(-\alpha d) \), characteristic phrases through `pakad_bonus`, and, in completion scoring, metrical relevance of vadi/samvadi through `w_position` [2508.01498].

Several applications are proposed: automatic correction of digital notations, educational feedback on pitch accuracy at shruti resolution, digital archives and MIR systems using microtonal symbolic representations, and DAW or notation software integration as an FST-based “Indian pitch corrector” that respects raga grammar [2508.01498]. These uses are consistent with the model’s combination of symbolic precision, explicit grammar control, and low runtime.

The limitations are also stated clearly. The FST assumes note-level granularity and struggles with **gamak** and **meend**, where continuous microtonal motion is musically meaningful [2508.01498]. It uses a **single raga grammar at a time**, so cross-raga modulation is not modeled [2508.01498]. Extreme pitch deviations beyond ±75 cents lead to incorrect corrections, and context sparsity harms completion, especially near sequence boundaries or across long missing segments [2508.01498]. These limitations define an important boundary on interpretation: the model is not a comprehensive performance model of Indian classical music, but a rule-driven symbolic correction mechanism over a discrete shruti lattice.

Future directions named in the paper include **adaptive raga learning**, tighter **end-to-end audio integration**, explicit modeling of ornaments as first-class entities, **multi-voice handling**, and **cross-tradition adaptation** to other microtonal systems such as Carnatic and maqam traditions [2508.01498]. This suggests that the Shruti‑aware FST is best seen as a foundational architecture for grammar-constrained microtonal correction rather than a finished account of all intonational and expressive phenomena in performance practice.

Source: https://www.emergentmind.com/topics/shruti-aware-finite-state-transducer-fst