Raga Math

Indian music theory as formulas: melakarta combinatorics, Pingala's Fibonacci rhythms, and number sequences as melody. Optional Magenta.js MusicRNN (~13 MB, in-browser) continues it.

maths melody AI continuation (snapped to raga) tanpura drone (Sa–Pa)
Where the maths comes from

72 melakartas = 6 × 6 × 2. Sa and Pa are fixed. Ri–Ga can pair 6 ways, Dha–Ni 6 ways, Ma 2 ways. The raga number alone gives its scale (Venkatamakhin, 1600s). See Combinatorial enumeration of ragas, J. Integer Sequences 2002.

Pingala / Virahanka / Hemachandra: the number of rhythms of n mātrās built from short (1) and long (2) beats is Fibonacci F(n+1), centuries before Fibonacci. See Pingala.

Yati: Carnatic phrase shapes. Gopuccha (cow's tail) shrinks, srotovaha (river) grows.

Pisano period: Fibonacci mod m always repeats, so the Fibonacci melody loops naturally.