---
title: 'ShrutiSense: 22-Shruti Correction'
url: https://www.emergentmind.com/topics/shrutisense
type: topic
---

# ShrutiSense: 22-Shruti Correction

to=container.exec code:
{"cmd":["bash","-lc","python - <<'PY'\nimport urllib.request\nurl='http://export.arxiv.org/api/query?search_query=id:2508.01498&start=0&max_results=1'\ntry:\n    print(urllib.request.urlopen(url,timeout=20).read()[:300])\nexcept Exception as e:\n    print('ERR',e)\nPY"]}】【：】【“】【assistant to=container.exec code  天天中彩票双色球json
{"stdout":"ERR HTTP Error 403: Forbidden\n","stderr":"","exit_code":0}
to=container.exec code:
{"cmd":["bash","-lc","python - <<'PY'\nimport urllib.request\nurl='https://export.arxiv.org/api/query?search_query=id:2508.01498&start=0&max_results=1'\nreq=urllib.request.Request(url,headers={'User-Agent':'Mozilla/5.0'})\ntry:\n    data=urllib.request.urlopen(req,timeout=20).read()\n    print(data[:500])\nexcept Exception as e:\n    print('ERR',e)\nPY"]}】【：】【“】【assistant to=container.exec code  天天中彩票投注 code?  盈立json
{"stdout":"b'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<feed xmlns=\"http://www.w3.org/2005/Atom\">\\n  <link href=\"http://arxiv.org/api/query?search_query%3Did%3A2508.01498%26id_list%3D%26start%3D0%26max_results%3D1\" rel=\"self\" type=\"application/atom+xml\"/>\\n  <title type=\"html\">ArXiv Query: search_query=id:2508.01498&amp;id_list=&amp;start=0&amp;max_results=1</title>\\n  <id>http://arxiv.org/api/z5x2PEHxcZnqT0kLNh5bVsWZgLU</id>\\n  <updated>2026-07-04T00:00:00-04:00</updated>\\n  <opensearch:totalResu'\n","stderr":"","exit_code":0}
to=container.exec code:
{"cmd":["bash","-lc","python - <<'PY'\nimport urllib.request, xml.etree.ElementTree as ET\nids=['2508.01498','2506.09653']\nfor aid in ids:\n    url=f'https://export.arxiv.org/api/query?search_query=id:{aid}&start=0&max_results=1'\n    req=urllib.request.Request(url,headers={'User-Agent':'Mozilla/5.0'})\n    data=urllib.request.urlopen(req,timeout=20).read()\n    root=ET.fromstring(data)\n    ns={'a':'http://www.w3.org/2005/Atom'}\n    entry=root.find('a:entry',ns)\n    print(aid)\n    if entry is None:\n        print('No entry')\n        continue\n    title=entry.find('a:title',ns).text.strip().replace('\\n',' ')\n    summary=entry.find('a:summary',ns).text.strip().replace('\\n',' ')\n    print(title)\n    print(summary[:500])\n    print()\nPY"]}】【。
to=container.exec code:
{"cmd":["bash","-lc","python - <<'PY'\nimport urllib.request\nfor aid in ['2508.01498','2506.09653']:\n    url=f'https://export.arxiv.org/api/query?search_query=id:{aid}&start=0&max_results=1'\n    req=urllib.request.Request(url,headers={'User-Agent':'Mozilla/5.0'})\n    data=urllib.request.urlopen(req,timeout=20).read().decode('utf-8')\n    print('AID',aid)\n    print(data[:1000])\n    print('---')\nPY"]}】【。
to=container.exec code:
{"cmd":["bash","-lc","python -c \"import urllib.request;print(urllib.request.urlopen(urllib.request.Request('https://export.arxiv.org/api/query?search_query=id:2508.01498&start=0&max_results=1',headers={'User-Agent':'Mozilla/5.0'}),timeout=20).read().decode('utf-8')[:1000])\""]} 博牛_rgctx to=container.exec code 的天天彩票json
{"stdout":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<feed xmlns=\"http://www.w3.org/2005/Atom\">\n  <link href=\"http://arxiv.org/api/query?search_query%3Did%3A2508.01498%26id_list%3D%26start%3D0%26max_results%3D1\" rel=\"self\" type=\"application/atom+xml\"/>\n  <title type=\"html\">ArXiv Query: search_query=id:2508.01498&amp;id_list=&amp;start=0&amp;max_results=1</title>\n  <id>http://arxiv.org/api/z5x2PEHxcZnqT0kLNh5bVsWZgLU</id>\n  <updated>2026-07-04T00:00:00-04:00</updated>\n  <opensearch:totalResults xmlns:opensearch=\"http://a9.com/-/spec/opensearch/1.1/\">1</opensearch:totalResults>\n  <opensearch:startIndex xmlns:opensearch=\"http://a9.com/-/spec/opensearch/1.1/\">0</opensearch:startIndex>\n  <opensearch:itemsPerPage xmlns:opensearch=\"http://a9.com/-/spec/opensearch/1.1/\">1</opensearch:itemsPerPage>\n  <entry>\n    <id>http://arxiv.org/abs/2508.01498v1</id>\n    <updated>2025-08-04T17:15:16Z</updated>\n    <published>2025-08-04T17:15:16Z</published>\n  \n","stderr":"","exit_code":0}
to=container.exec code:
{"cmd":["bash","-lc","python - <<'PY'\nimport urllib.parse, urllib.request, xml.etree.ElementTree as ET\nquery='all:\"Indian classical music\" AND (microtonal OR shruti OR raga)'\nurl='https://export.arxiv.org/api/query?search_query='+urllib.parse.quote(query)+'&start=0&max_results=5&sortBy=submittedDate&sortOrder=descending'\nreq=urllib.request.Request(url,headers={'User-Agent':'Mozilla/5.0'})\ndata=urllib.request.urlopen(req,timeout=20).read()\nroot=ET.fromstring(data)\nns={'a':'http://www.w3.org/2005/Atom'}\nfor e in root.findall('a:entry',ns):\n    print(e.find('a:id',ns).text.split('/')[-1], e.find('a:title',ns).text.strip().replace('\\n',' '))\nPY"]} 大发快三 to=container.exec code  彩神争霸官网json
{"stdout":"2508.01498v1 ShrutiSense: Microtonal Modeling and Correction in Indian Classical Music\n2504.06280v1 Cross-Cultural Alignment of Singing Voice Embeddings\n2410.19129v1 Enhanced Automatic Raga Classification in Indian Music through DNN-Based Tonic Estimation\n2409.01397v1 RAGAS: Reasoning and Generating Anything with Symbolic Music for Symbolic Music Generation\n2408.00269v1 Advancing Raag Classification in Hindustani Music through Novel Feature Engineering of Swaras and Tones\n","stderr":"","exit_code":0}
ShrutiSense is a symbolic pitch-processing framework for North Indian classical music that explicitly models the 22-shruti microtonal system and raga grammar, rather than collapsing pitch to the 12-tone equal temperament system. It is designed for two tasks: correcting westernized or corrupted pitch sequences, and completing melodic sequences with missing notes. The framework combines two complementary models: a Shruti-aware finite-state transducer optimized for correction, and a Grammar-Constrained Shruti Hidden Markov Model optimized for completion. In the reported evaluation, the FST-based correction model achieves 91.3% shruti classification accuracy on simulated data, while maintaining consistent performance across five ragas and under pitch noise up to $\pm 50$ cents [2508.01498].

## 1. Microtonality and raga grammar

ShrutiSense is grounded in a distinction that is fundamental to Indian classical music: the difference between the 12-tone equal temperament system and the 22-shruti system. In 12-TET, an octave is divided into 12 equal semitones of 100 cents each, so the frequency of a note $n$ semitones above a tonic $f_0$ is

$$
f = f_0 \cdot 2^{n/12}.
$$

ShrutiSense instead formalizes shrutis as a logarithmic scale in cents relative to the tonic, or shadja. If $f_0$ is the tonic frequency, then the frequency of shruti $s_i$ is

$$
f_i = f_0 \cdot 2^{c_i/1200},
$$

where $c_i$ is the cent offset of the $i$-th shruti. The system uses the cent set

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

The minimum distinguishable interval in this representation is

$$
\delta_{\text{shruti}} = \min_{i \neq j} |c_i - c_j| = 22 \text{ cents}.
$$

That granularity is substantially finer than the 100-cent semitone and is presented as the basis for characteristic Indian ornaments and expressive intonation [2508.01498].

A recurrent misconception in computational treatments of raga is to treat a raga as merely a scale. ShrutiSense adopts the stronger formulation that a raga is a grammar of melodic movement. A raga selects a subset of shrutis; has distinct ascending and descending patterns, or arohana and avarohana; enforces allowed and forbidden transitions; and emphasizes characteristic phrases, or pakad. The paper therefore argues that a culturally faithful model must operate in a 22-shruti pitch space and must be grammar-aware.

This position is also a critique of standard symbolic music tooling. The paper states that most symbolic systems quantize to 12-TET MIDI pitches, assume Western tonal or scale-based constraints, remain agnostic to raga grammar, and treat microtonal deformations as out-of-tune errors rather than structural elements. ShrutiSense is explicitly constructed to avoid those failure modes.

## 2. Task formulation and pitch representation

ShrutiSense addresses two formally distinct tasks. The first is pitch correction: transforming noisy or westernized pitch sequences into shruti-aligned sequences that respect raga grammar. The second is melodic completion: inferring missing notes in a sequence by using contextual and grammar constraints [2508.01498].

All pitch is represented in cents relative to a tonic and mapped into the 22-shruti scale. The shruti positions are denoted

$$
S = \{s_1, \dots, s_{22}\},
$$

with cent offsets $c_i \in \mathbf{C}$. For audio input, pitch tracking is performed with Librosa’s `piptrack`, yielding instantaneous frequencies that are converted to cents relative to a reference frequency:

$$
\text{cents}(f) = 1200 \log_2\left(\frac{f}{440}\right).
$$

The system then normalizes to the specified tonic and either maps the continuous values to shruti states or uses them as real-valued observations for the HMM.

The paper defines corrupted or westernized sequences synthetically. Grammar-correct sequences are distorted through random note substitutions, with 10% to 50% of symbols replaced by random shruti labels; random pitch displacement, with noise up to $\pm 50$ cents and analysis up to $\pm 75$ cents; and missing values, with 10% to 50% of notes removed. Westernization in practice is described as quantization to the nearest 12-TET pitch, which removes microtonal distinctions. ShrutiSense instead re-quantizes to the 22-shruti set and constrains the result by raga grammar.

## 3. Shruti-aware finite-state transducer

The Shruti-aware finite-state transducer, denoted $\mathcal{T}$, is the principal correction mechanism. Its states represent positions in the sequence together with information about the last shruti chosen for grammar scoring. The lattice size is approximately $M \approx 23$, corresponding to 22 shrutis plus epsilon. Inputs are observed pitch tokens, either in cents or as pre-binned shruti labels, and outputs are corrected shruti states $s \in \{s_1, \dots, s_{22}\}$ [2508.01498].

The FST supports four edit operations through weighted transitions labeled by input, output, and weight: match, substitution, insertion, and deletion. Each shruti output symbol is associated with a cent mean $\mu_s \in \mathbf{C}$. An observed pitch $o$ can be mapped to any shruti $s$, but the cost depends on the distance $|o-\mu_s|$ and on whether the transition from the previous shruti is allowed by the grammar.

The transition weight is defined 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

$$
c_{\text{pitch}}(o, s) = -\frac{|o - \mu_s|}{50}.
$$

If a transition is forbidden by the raga grammar, then

$$
c_{\text{grammar}}(s_{\text{prev}}, s) = -\infty,
$$

which excludes that path. The mixture weights are fixed at

$$
\lambda_1 = 0.6,\quad \lambda_2 = 0.3,\quad \lambda_3 = 0.1.
$$

Pitch fidelity is therefore dominant, grammar remains strongly influential, and edit operations are mildly penalized.

The FST is not merely a nearest-cent quantizer. It incorporates raga membership constraints, transition costs derived from grammar, pakad bonuses for characteristic phrases, and positional relevance. In the completion-related scoring description, the candidate score is written as

$$
\text{score}(s_{\text{candidate}}) = w_{\text{base}} + w_{\text{transition}} + w_{\text{pakad}} + w_{\text{position}},
$$

where the terms reflect raga membership, grammar-based transition probability, motif bonuses, and metric position, including vadi or samvadi emphasis on strong beats of the tala cycle. The same grammar and pakad concepts inform correction as well. A plausible implication is that the FST functions as a hybrid between edit-distance correction and rule-constrained melodic decoding, rather than as a purely local pitch snapper.

## 4. Grammar-Constrained Shruti Hidden Markov Model

The Grammar-Constrained Shruti Hidden Markov Model, or GC-SHMM, is specialized for completion, although the paper notes that it can also be used for correction. Its hidden state space is the active shruti set of a given raga,

$$
S = \{s_1, \dots, s_N\},
$$

with $N \in [7,10]$ typically, since a raga uses only a subset of the full 22-shruti inventory [2508.01498].

Observations are noisy pitch values in cents. Emissions are modeled as Gaussians centered at the shruti means:

$$
P(o_t \mid s_i) = \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(o_t - \mu_i)^2}{2\sigma^2}\right),
$$

with $\sigma = 25$ cents. For missing observations, the emission is set uniformly:

$$
P(o_t \mid s_i) = 1 \quad \text{if } o_t \text{ is missing},
$$

so inference at that position depends entirely on the transition model.

The raga grammar is encoded as a directed graph $G = (S, T)$ with grammar function

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

Transition weights combine grammatical admissibility, interval preference, and pakad structure:

$$
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),
$$

where $d(s_i,s_j)$ is interval distance in cents and $\alpha = 0.1$ favors stepwise movement. These weights are normalized as

$$
P(s_j \mid s_i) =
\begin{cases}
\dfrac{w(s_i, s_j)}{Z_i}, & \text{if } G(s_i, s_j) = 1,\\[0.5em]
0, & \text{otherwise},
\end{cases}
$$

with

$$
Z_i = \sum_{k: G(s_i, s_k)=1} w(s_i, s_k).
$$

The model further distinguishes direction-aware transition matrices $A_{\text{up}}$ and $A_{\text{down}}$ for ascending and descending motion, with melodic direction inferred from pitch gradients.

Inference uses grammar-constrained Viterbi decoding for the most likely shruti sequence:

$$
\delta_t(j) = \left( \max_{i: G(s_i, s_j)=1} \left[ \delta_{t-1}(i) \cdot P(s_j \mid s_i) \right] \right) \cdot P(o_t \mid s_j),
$$

and forward-backward for missing-value completion, with posterior

$$
\gamma_t(i) = \frac{\alpha_t(i)\beta_t(i)}{\sum_j \alpha_t(j)\beta_t(j)}.
$$

The paper explicitly states that the model is not described as data-trained: transitions and emissions are defined from theory, shruti cent values, raga grammar, and fixed $\sigma$.

## 5. Evaluation, robustness, and implementation

The reported evaluation uses synthetic data generated from raga grammar rather than model-generated sequences. The dataset comprises 1,000 canonical pitch sequences of lengths 30, 50, and 100, across five ragas: Yaman, Bhairavi, Bilaval, Kalyan, and Khamaaj. Corrupted versions are produced through random note substitution, missing values, and pitch noise or quantization noise [2508.01498].

The metrics are Shruti Classification Accuracy, Average Pitch Error in cents, Raga Grammar Compliance, Pakad Pattern Recognition, and computational performance. For the correction task in Yaman at corruption level $0.4$, the reported results are: GC-SHMM at $84 \pm 0.4$ shruti accuracy with mean error $107.6 \pm 3.6$ cents and 12.5 ms; Shruti FST at $91.3 \pm 0.2$ shruti accuracy with mean error $45.6 \pm 1.4$ cents and 0.1 ms; nearest-cent baseline at $89.4 \pm 0.3$ with mean error $51.8 \pm 1.4$ cents and 0.1 ms; and random at $12.6 \pm 0.3$ with mean error $452.6 \pm 2.4$ cents. The paper reports 95% confidence intervals based on 900 simulations and states that one-way ANOVA plus Cohen’s $d$ analyses show the FST significantly outperforms the HMM.

Robustness is reported in several forms. With pitch noise up to $\pm 50$ cents, the FST maintains approximately 91.3% average accuracy. Example sequences at corruption levels 0.2 to 0.4 show FST accuracies of 86.7% to 90.0%. Across ragas, the reported FST accuracies are 91.1% for Yaman, 90.7% for Bhairavi, 91.2% for Bilaval, 91.8% for Kalyan, and 91.8% for Khamaaj. The paper interprets this as consistent performance across diverse ragas.

Completion behaves differently. For random missing patterns, HMM accuracy is 57.1 with error 203.0 cents, while FST accuracy is 62.6 with error 158.7 cents. For clustered missing patterns, HMM achieves 40.3 and 344.9 cents, while FST reaches 26.6 and 317.0 cents. For structured missing patterns, HMM achieves 82.9 and 48.5 cents, while FST achieves 70.5 and 228.1 cents. The overall means are $60.1 \pm 30.9\%$ for HMM and $48.6 \pm 22.2\%$ for FST, so the HMM is generally better suited to completion, especially when sequential structure is informative.

The implementation pipeline is also specified. Audio input is a WAV file loaded via Librosa, typically at 44.1 kHz. Pitch extraction uses `piptrack`, selecting the maximum-magnitude peak per frame and ignoring zeros. Sequences are segmented into phrases of length 8 to 32 notes. A user-specified raga determines the grammar and shruti set. Corrected pitches can then be synthesized back to audio, with each corrected cent value rendered as a 0.5-second stereo 16-bit PCM sine wave at 44.1 kHz and concatenated into a continuous WAV stream. Reported complexity is $O(TN^2)$ time and $O(TN)$ space for GC-SHMM, and $O(TM^2)$ time for the FST with $M \approx 23$.

## 6. Assumptions, limitations, and significance

ShrutiSense is built under several explicit assumptions. It assumes monophonic input, requires the tonic to be known or specified, uses a fixed 22-shruti cent configuration, and employs pre-defined raga grammars and pakad bonuses rather than learning them adaptively [2508.01498].

The paper also states several limitations. Ornament boundaries are difficult because gamak and meend are not modeled as separate state types; the system works at note-level granularity, so continuous glides are only partially captured through pitch variance and allowable transitions. Cross-raga modulation is unsupported because each sequence is assumed to follow a single raga grammar. Extreme pitch deviations beyond $\pm 75$ cents significantly degrade shruti classification. Completion accuracy declines with long contiguous gaps of five or more notes or when boundary notes are missing. Finally, evaluation relies on synthetic sequences derived from grammar rules rather than on large corpora of real performances.

The proposed future directions follow directly from those constraints: adaptive raga learning through unsupervised corpus analysis, tighter end-to-end audio integration with more robust pitch tracking such as CREPE or YIN, explicit ornament modeling, polyphonic extensions to handle drones and accompaniment, and cross-cultural transfer to other microtonal traditions such as Carnatic music, Middle Eastern maqam, or contemporary non-Western composition.

The framework’s significance lies in the combination of three elements. First, it offers a formal computational representation of 22 shrutis using fixed cent values and shruti-specific Gaussian models rather than 12-TET reduction. Second, it models raga as a directed graph with hard constraints and soft biases, including pakad bonuses and direction-aware transitions. Third, it separates correction and completion into two complementary symbolic mechanisms, using a grammar-aware FST for low-latency correction and a GC-SHMM for structurally informed completion. This suggests a broader methodological point: for non-Western musical systems, symbolic pitch processing can benefit from embedding expert musical knowledge as both hard grammatical constraints and probabilistic preferences, rather than treating all deviations from equal temperament as noise.

Source: https://www.emergentmind.com/topics/shrutisense