Another tool for Carnatic pedagogy - a layout of ragams on a 2D chart! Ragams close together on the chart are supposed to sound similar.

*Force directed graph layout* is a wonderful class of algorithms for generating a layout of a graph on a plane in a way that is useful and intuitive for humans to visualize. Suppose you have a graph with weighted edges, the algorithm assumes that nodes are point masses connected by attractive-repulsive force fields (i.e, repulsive at small distances and attractive at large distances; imagine springs) whose strengths are related to the weight of the corresponding edge. The algorithm starts with a random initial configuration of the masses, and uses any of a gazillion techniques (say simulated annealing) to find the resting configuration of minimal potential energy.

But to lay out ragams on chart, how does one define the edge weights? I simply considered the Hamming distance between the scales; i.e, if a note is found in one ragam but not in the other, then it contributes one unit to the distance. The weight between two edges is inversely related to the distance, so that the more notes two ragams share, the greater the edge weight.

*This is very crude and ignores most of the information about the ragam.* However, it is an excellent starting point and already gives surprisingly good/useful results. For instance, one of my favorite clusters is Hanumatodi/Asaveri/Ahiri/Desiyatodi/Dhan

yasi near the top left.

Ragam chart version 1 - 2200x2200 png (180K). Uses alpha transparency, so might look like crap in Internet explorer. Get firefox.

There are 180 ragams in the chart, the 72 melakartas plus 108 janyas. The janyas were chosen somewhat arbitrarily based on familiarity, because I couldn't find a definitive list of the most common ragams. The layout tool I used was ccvisu, which is not great but has all the basic features. Plus it generates svg output which is great. (Livejournal won't let me upload svgs for some reason, so I was forced to convert it to png before uploading. Grrrr.)

There are two main things that need to be improved:

* layout - the melakartas need to be in a different color. I can do this by scriptomatically postprocessing the svg. Python-fu! Also, a few of the raga labels overlap with others, which I can easily hand-edit.

* Ragam similarity algorithm. This is the main problem. One obvious improvement is to look at the arohanam scale and the avarohanam scale separately. I plan to implement that. However, I have no idea how to incorporate information about gamakams, tempo or anything else because I don't have that information in the first place. A list of each ragam's gamakams would greatly improve the accuracy of the chart. I've tried googling and found nothing. Does anyone know if such a list exists?

Oh, and two things:

* 'Scriptomatically' needs to be a word!

* I ♥ SVG :)

**Update**: version 2 released (2000x2000 png, 200K). The layout issues have been fixed. I find it fascinating how the melakaratas (blue) cluster together in the center. The algorithm should be slightly better now because it considers the scale of the arohana and avarohana separately. For example Sri is close to Madhyamavati whereas it wasn't in version 1. Of course, it still completely ignores gamakams and everything else. (SVG is also available if anyone wants to hack on it.)