Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!gatech!artsnet!mgresham From: mgresham@artsnet.UUCP (Mark Gresham) Newsgroups: comp.music Subject: Re: programs that can infer key/meter Message-ID: <487@artsnet.UUCP> Date: 13 Oct 89 01:51:04 GMT References: <15170@netnews.upenn.edu> <125936@sun.Eng.Sun.COM> <1240@accuvax.nwu.edu> Reply-To: mgresham@artsnet.UUCP (Mark Gresham) Organization: ARTSNET Atlanta, GA USA Lines: 121 In article <1240@accuvax.nwu.edu> sandell@ferret (Greg Sandell) writes: >>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). [...] 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. One simple simple musical example that directly contradicts the above is the typical 'sarabande' where the first beat of the meter is the shorter of the two stresses that are felt behind the 3/4 or 3/2 meter of that dance, the second being twice as long. (Half + whole in 3/2.) >If the silence is roughly twice as long as the inter-onset time, then 3/4 meter >will be perceived. (Maybe it would be a slow 3/8 or a fast 3/2?) >Of course, competing musical elements could contradict that >and create a different meter, but all things being equal, 3/4 time will be heard. But competing musical elements are as often the norm as they are the exception. The process would have a difficult time (pardon the pun :-)) with even such familiar examples as Schumann's "Traumerei" or Beethoven's Piano Sonata #5 in C-minor (Op. 10, #1). Just the opening measures of either of these would give such a program fits, even if played 'squarely.' I suspect the "Traumerei" would be recognized as a 5/4 bar with an anacrusis followed by a 3/4 bar then followed by 4/4. The 'strong' accents (thinking only metrically, even) do not necessarily fall on the first pulse of any given measure. Most of Brahms' works in 3/4 have significant passages which contradict the 'tyranny of the bar-line' ("How Lovely Is..." from his Requiem, the "They praise Thee..." passages; a great deal of the piano music in 3/4 frequently include significant passages which 'go against' the meter. >Of course, real music is more complicated than this simple example, but the book >also describes more complicated conditions. But there's more problems with simple conditions: Where a pulse is divided into three parts, what will your program automatically decide is 'correct'? 1) a 4/4 meter with triplet eighths? 2) a 6/8 meter? 3) a 12/8 meter? or 12/16? 4) a very fast 3/4 with one pulse to the measure? same for 3/8? 5) some other possibility? (Groups of 3 syncopated 16ths against normal groupings of 4 16ths?) If the passage has a series of, say, some 2 dozen repeated G#'s in 3/4 before anything else happens (this could easily happen in a pseudo-Beethoven scherzo): 1) is the first note an anacrusis? 2) is the first note on the first beat of the measure? 3) is the first beat silent? 4) will the program even recognize, in that instance, the 3/4 meter? Part of the point of all this is differentiating between 'rhythmic' features of music and 'metrical.' Even an example from the sixteenth century, "Ecce quomodo moritur" (Jacob Handl) would be made into a metrical hash by the Lerdahl/Jackendoff approach to analysis, eliminating the wonderful rhythmic overlap that occurs throughout the constant duple (in the example I have, 4/4) meter. It would result in this: 2/2 |3/4 | |3/2 |4/2 |3/4 | |3/2 |3/4 | |5/4 |3/4 |4/4 etc. ...as a likely computational 'solution.' (I'd like to see what such a program would do with examples from the 'ars nova' period or Elliott Carter's Piano Concerto!) >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. How about 'tonal' music without key signature? >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. Greg, most music of an oral tradition contradicts that, with the dominant being the most *frequently occurring* note, followed by the mediant, then the submediant; the same goes for spontaneous songs made by children. Certainly we can spell 'fish' with the series of letters 'ghoti' and find justifiable reasons for doing so in some statistical-psychological manner. But beyond the curiosity, would it be meaningful and helpful in terms of reproducing and communicating the music (the real thing, aside from its representation on paper)? Cheers, --Mark ======================================== Mark Gresham ARTSNET Norcross, GA, USA E-mail: ...gatech!artsnet!mgresham or: artsnet!mgresham@gatech.edu ========================================