A genre of North Indian drumming has become the focus of experimental research in which an "expert system" is programmed to simulate the musical knowledge of the drummers themselves. Experiments involve the interaction of musicians with a computerized linguistic model contained within the expert system that formalizes their intuitive ideas regarding musical structure in a generative grammar. The accuracy of the model is determined by the musicians themselves, who assess its ability to generate correct pieces of music. The main aims of the research are the identification of the cognitive patterns involved in the creation and interpretation of a particular musical system, and the establishment of new techniques that make this approach to cognitive analysis applicable to other musical systems. This article attempts to demonstrate the advantages an ethnomusicological approach can bring to the analysis of musical perception and cognition. Such an approach links the analysis of musical sound to an understanding of the sociocultural context in which that music is created and interpreted.