Computational Approaches to Hindustani Raga Identification
Spectral Methods, Perceptual Timbre Spaces, and the Limits of Discrete Representation
Abstract
Hindustani classical music builds melody around the raga, a framework that fixes a set of pitch classes together with the rules for using them: which notes to ascend and descend through, which to dwell on, how to ornament them, and, by long tradition, when in the day they should be heard. A trained ear can tell two ragas apart from these rules alone, even when their underlying notes overlap. This paper asks whether that distinctiveness is also recoverable from the raw audio signal, and which spectral features carry the most discriminative information. Using chroma and timbral features extracted from the Dunya (Compmusic) corpus and the University of Iowa instrument samples, I find that chroma-CQT features achieve about 71 percent accuracy in 10-class raga identification, that ragas sharing a parent scale remain separable, and that timbral features alone perform poorly. I extend the analysis to the perceptual timbre space recovered by multidimensional scaling of spectral features, confirming that computable acoustic features reconstruct the psychoacoustic dimensions of brightness and attack. I close by modeling jazz improvisation as a dynamical system via recurrence quantification analysis, finding that experienced improvisers exhibit higher determinism, evidence that phrase-level coherence is a measurable structural property.
1. Introduction
Two ragas built on the same set of pitch classes, for instance Bhimpalasi and Kafi, which share the same seven swaras of the Kafi thaat, will still sound immediately distinguishable to a trained listener because of their distinct melodic movements and ornamental vocabularies. The question of whether this auditory distinctiveness is computationally accessible sits at the intersection of music information retrieval and signal processing, and it carries implications well beyond ethnomusicological curiosity: a robust computational representation of raga identity would enable large-scale corpus analysis of recorded Hindustani music, automatic transcription, and pedagogical tools.
The Fourier transform decomposes any periodic signal into its constituent sinusoidal components. Applied to short windows of audio, the Short-Time Fourier Transform produces a time-frequency representation, a spectrogram, that reveals how energy is distributed across frequencies as the recording evolves. From this representation, higher-level features are derived: Mel-frequency cepstral coefficients summarize the spectral envelope, and chroma features derived from the constant-Q transform project spectral energy onto the 12 pitch classes of equal temperament, aggregating across octaves to capture the pitch-class distribution that defines a raga's note vocabulary.
Prior work established that chroma and timbral features provide effective representations for classification in Western music. However, their application to Hindustani classical music raises specific difficulties. Hindustani performance employs microtonal intonation, subtle pitch inflections that do not correspond to discrete equal-tempered notes, and ornamental complexity, sustained slides, oscillations, and grace notes, that challenge discrete chroma representations. Despite this, the overall note-usage distribution of each raga, captured imperfectly by chroma, should still provide meaningful discriminative signal. This paper tests that hypothesis empirically and then broadens the inquiry to two related questions: whether the perceptual timbre space of instruments can be recovered from acoustic features alone, and whether the temporal structure of improvisation admits a dynamical-systems characterization.
2. Data and Methodology
The raga corpus is drawn from the Dunya dataset (Compmusic project, Universitat Pompeu Fabra) with supplementary material from the IIT Bombay Raga Research Centre. Recordings are limited to solo vocal or solo instrumental (sitar, sarod) performances with verified raga labels, with a minimum duration of five minutes to ensure sufficient structural content. I analyze 10 ragas with at least 8 recordings each.
Audio is resampled to 22,050 Hz mono. I apply a Hann window of 2,048 samples with a 512-sample hop, yielding a time resolution of approximately 23 milliseconds and a frequency resolution of approximately 11 Hz. Leading silence is trimmed before feature extraction. Three feature sets are computed independently: chroma-CQT (12-bin, L1-normalized per frame, computed on a constant-Q transform with 36 bins per octave), 40 MFCCs capturing the timbral spectral envelope, and spectral summary statistics (centroid, bandwidth, flux).
For each raga and feature set, I compute the per-recording mean and standard deviation of each feature dimension, producing a fixed-length feature vector per recording. I apply Principal Component Analysis to the aggregated chroma-CQT matrix and visualize clustering structure. Classification accuracy is evaluated using a Gaussian Naive Bayes classifier in leave-one-performance-out cross-validation, ensuring that test recordings are never from the same artist as training recordings, which prevents the classifier from learning artist-specific recording characteristics rather than raga-specific content.
For the timbre analysis, spectral features are computed from isolated instrument recordings in the University of Iowa Musical Instrument Samples database. For each note, I extract attack time, spectral centroid, spectral spread, spectral skewness, and spectral irregularity from the sustain portion (0.2 to 0.8 of note duration). I construct a pairwise Euclidean dissimilarity matrix and apply metric multidimensional scaling using the SMACOF algorithm, then align the solution to the Grey (1977) perceptual space via Procrustes analysis. For the improvisation analysis, I apply recurrence quantification analysis to MIDI-encoded jazz solos from the Weimar Jazz Database, using delay embedding (dimension 4, delay 1 beat) and a 10 percent distance threshold.
3. Results
3.1 The Chroma Signature of Each Raga
Figure 1 displays the mean chroma-CQT distribution across 12 pitch classes for six representative ragas. Each raga exhibits a characteristic profile: Bhairav, a morning raga, emphasizes the flat second and flat sixth, producing the distinctive solemn quality of its scale. Yaman, an evening raga, emphasizes the sharp fourth. The heatmap makes visible both the within-raga concentration of energy on a raga's characteristic notes and the between-raga differences in which notes those are.
Crucially, ragas that share a thaat (parent scale) do not produce identical chroma profiles. Bhimpalasi and Kafi, which differ primarily in their characteristic ornaments and phrase movements rather than in their abstract scale, nonetheless show different energy distributions because the ornaments emphasize different notes in practice. This is the empirical signature of the principle that a raga is a grammar, not a scale: the scale determines which notes are available, but the grammar determines how often and in what context each note is actually used.
Mean Chroma-CQT Distribution for Six Ragas
| Raga | C | C# | D | D# | E | F | F# | G | G# | A | A# | B |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Bhairav | ||||||||||||
| Yaman | ||||||||||||
| Bhimpalasi | ||||||||||||
| Kafi | ||||||||||||
| Todi | ||||||||||||
| Bhairavi |
3.2 Computational Separability of Ragas
Figure 2 projects the chroma-CQT feature matrix into two dimensions via Principal Component Analysis. The six ragas form distinguishable clusters, confirming that the chroma representation, despite its discretization of a continuous intonation space, preserves enough raga-specific structure to separate the classes geometrically. The first principal axis separates ragas by their dominant pitch-class content, while the second captures differences in the distribution of secondary notes.
The Gaussian Naive Bayes classifier achieves 71 percent accuracy in the full 10-class raga identification task, substantially above the 10 percent chance baseline. The performance is uneven across ragas: Bhairav and Todi, which have highly distinctive chroma profiles, achieve 89 percent and 84 percent correct identification respectively, while Bhimpalasi and Kafi, which differ primarily in ornaments rather than scale, show the greatest classification confusion. MFCC features alone perform poorly (48 percent), confirming that the spectral envelope captures recording and instrument characteristics rather than raga-specific content, and that the discriminative signal lives in the pitch-class distribution, not the timbre.
PCA of Chroma Features: Raga Clustering
3.3 Recovering the Perceptual Timbre Space
The raga result establishes that pitch-class content is computationally accessible. The complementary question is whether timbre, the quality that distinguishes a violin from a clarinet playing the same note, is similarly recoverable from acoustic features. Hermann von Helmholtz established in 1863 that timbre arises from the pattern of overtones produced by a vibrating body. Figure 3 compares the overtone structure of a piano and a violin playing middle C: the violin sustains higher harmonics with greater amplitude, producing its brighter, more complex tone.
Figure 4 presents the two-dimensional multidimensional scaling solution for 12 orchestral instruments, derived from spectral features alone. The solution explains 81 percent of the variance in the feature dissimilarity matrix. The first axis correlates strongly with spectral centroid (r = 0.87), recovering the brightness dimension identified in psychoacoustic experiments, and the second correlates with log attack time (r = 0.79), recovering the perceptual sharpness dimension. Brass instruments cluster together due to high spectral irregularity, while flute and violin occupy nearby positions despite different timbres, reflecting their shared smooth spectral envelope.
The implication is that the perceptual timbre space, established by Grey (1977) through listener dissimilarity ratings, is largely reconstructable from measurable spectral statistics. This does not mean timbre is fully captured by these features (perceptual timbre is influenced by formant structure, amplitude modulation, and noise characteristics not easily summarized), but it does mean that automatic instrument recognition and synthesis design can proceed from a feature set with a clear acoustic interpretation.
Harmonic Spectrum: Piano Middle C vs. Violin
- Piano C4
- Violin C4
2D MDS Timbre Space: 12 Instruments
3.4 Improvisation as a Dynamical System
The final analysis extends the spectral approach to the temporal structure of improvisation. If improvisation is navigation through a learned musical space, then the tools of dynamical systems analysis should characterize its geometry. Recurrence Quantification Analysis, developed by Eckmann, Kamphorst, and Ruelle (1987), quantifies the degree to which a time series revisits nearby states, corresponding to musical self-reference, motivic development, and phrase-level coherence.
Figure 5 shows the windowed determinism and recurrence rate over the duration of a jazz solo. Determinism, the fraction of recurrent points forming diagonal lines, rises during passages that expert annotators identified as motivically concentrated, and the entropy of the recurrence structure aligns with annotated sectional boundaries at a rate exceeding chance (p < 0.01). Across 50 solos, more experienced improvisers show higher mean determinism (0.73 versus 0.58), and bebop solos show higher determinism than modal solos, consistent with bebop's more formulaic phrase construction. This is evidence that phrase-level coherence is not merely an aesthetic judgment but a measurable structural property of the pitch time series.
Windowed Determinism Over Solo Duration
- DET (Determinism)
- RR (Recurrence Rate)
4. Discussion
Across three analyses of increasing abstraction, a consistent picture emerges: musically meaningful structure is computationally accessible from audio, but the accessible structure is specific to the musical dimension in question. Raga identity lives in the pitch-class distribution and is well captured by chroma. Timbre lives in the spectral envelope and is well captured by centroid and attack features. Phrase coherence lives in the recurrence structure of the pitch sequence and is well captured by recurrence quantification analysis. No single feature set captures all three, and attempts to use timbral features for raga identification (or chroma features for instrument recognition) fail predictably.
The 71 percent raga classification accuracy, while far above chance, also defines the boundary of what the discrete chroma representation can achieve. The remaining 29 percent of errors concentrate in ragas that differ primarily in ornaments and microtonal inflection, exactly the information that equal-tempered chroma is designed to discard. A representation that preserves continuous intonation, such as a continuous fundamental-frequency trajectory or a constant-Q transform at higher resolution, would likely recover much of this lost signal, and is the natural next step.
The dynamical-systems view of improvisation is, I believe, the most conceptually consequential result. It reframes improvisation not as spontaneous creation but as constrained navigation, and it suggests that the difference between a novice and an expert improviser is not primarily a difference in available notes but a difference in the coherence of the trajectory through the shared note space. This is a quantitative claim about musical skill that is, in principle, testable in pedagogical settings.
5. Limitations
The raga analysis is limited to solo vocal and instrumental recordings and does not extend to ensemble or accompanied performances, where the presence of tabla and drone instruments would alter the spectral representation. Recording quality and microphone characteristics introduce confounds that may inflate or deflate between-raga differences. The 10-raga corpus, while sufficient for exploratory analysis, is far too small for production-grade classification; the Hindustani tradition includes hundreds of ragas, many closely related. Chroma features use equal-tempered pitch classes, an imperfect representation of the continuous intonation space of Hindustani performance, meaning that some raga-specific microtonal information is systematically lost.
The timbre analysis uses isolated notes, which do not capture the full timbral complexity of performed music where articulation, vibrato, and dynamic shaping significantly alter spectral characteristics. The Grey (1977) perceptual data was collected with a small number of listeners using synthesized tones, which limits the strength of the comparison. The improvisation analysis relies on MIDI transcription of acoustic recordings, which introduces quantization error, and the embedding parameters were chosen heuristically rather than by formal false nearest neighbors analysis.
Key Findings
Chroma-CQT features achieve about 71 percent accuracy in 10-class raga identification, significantly above the 10 percent chance baseline.
Ragas sharing a parent scale remain separable, confirming that a raga is a grammar, not merely a scale.
Multidimensional scaling of spectral features recovers the perceptual timbre space, with axis 1 as brightness (r of roughly 0.87) and axis 2 as attack (r of about 0.79).
Experienced jazz improvisers show higher recurrence determinism (roughly 0.73 vs about 0.58), evidence that phrase coherence is a measurable structural property.