Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!accuvax.nwu.edu!ferret!sandell From: sandell@ferret.ils.nwu.edu (Greg Sandell) Newsgroups: comp.music Subject: Re: programs that can infer key/meter Message-ID: <1240@accuvax.nwu.edu> Date: 10 Oct 89 00:27:22 GMT References: <15170@netnews.upenn.edu> <125936@sun.Eng.Sun.COM> Sender: news@accuvax.nwu.edu Reply-To: sandell@ferret (Greg Sandell) Organization: /etc/organization Lines: 54 >In article <15170@netnews.upenn.edu> hardt@linc.cis.upenn.edu (Dan Hardt) writes: >>I'd like to know what programs exist that can >>infer the key and meter of a melody, just based >>on the pitch and duration information. Does anyone >>know about programs that can do this? Now that some responses directly addressing Dan's question have come in, let me suggest an indirect method. There have been several writings on meter in music that attempt to list exactly those features which instantiate this or that time signature. This theoretical material can (and has, I think) become the basis for something more computational. In particular I am thinking about A GENERATIVE THEORY OF TONAL MUSIC by Fred Lerdahl and Ray Jackendoff (MIT Press, 1983). Lerdahl (a composer and theorist) and Jackendof (a linguist) use grouping mechanisms from Gestalt psychology theory to define musical meter. For example, given a recurring pattern of two beats and silence, where the silence is longer than the duration of time separating the onsets of the two beats, the second of the two beats tends to be heard as a strong beat, or, the first beat of a measure. If the silence is roughly twice as long as the inter-onset time, then 3/4 meter will be perceived. Of course, competing musical elements could contradict that and create a different meter, but all things being equal, 3/4 time will be heard. Of course, real music is more complicated than this simple example, but the book also describes more complicated conditions Regarding the ability to figure out the key signature of the piece, I'm sure that what you are concerned with are non-trivial examples where more than seven diatonic pitch-classes present. One method uses a rather simple statistical approach of counting the number of each instance of every pitch-class in the piece, and comparing it with a prototypical distribution for every possible major and minor key. This method grew out of the research described by Carol Krumhansl in "Perceptual Structures for Tonal Music" (MUSIC PERCEPTION 1, 1983, pp. 28-62). (The actual key-finding algorithm has never been published). To successfully match C major, for example, the count will have to show a tendency to have more C's than any other note, G's running in second place, E's third, and so on. I can't remember the exact order of the remaining nine notes, but the remainder of the 'white notes' follow before any of the 'black notes.' The actual prototypical distribution is somewhat more detailed that a simple descending distribution (e.g., the ratio of G's to C's is not identical to that of E's to G's). Despite the seemingly anti-musical approach of a statistical count, I have seen the approach work quite well, especially when the pitch classes are weighted according to their duration and amplitude. Using MIDI, I once used the algorithm to analyze the keys of real-time performance using exactly that weighting scheme (key velocity to measure amplitude), and it had pretty good accuracy. *************************************************************** * Greg Sandell, Institute for Learning Sciences, Evanston, IL * * sandell@ferret.ils.nwu.edu * *************************************************************** 'Oh Hey, Look at that: there's a fish on a hat; And we'd like to treat everyone here to a cow souvenir.' - Peter & Lou Berryman *************************************************************** * Greg Sandell, Institute for Learning Sciences, Evanston, IL * * sandell@ferret.ils.nwu.edu * ***************************************************************