A music note

Home

Amanda Crawford's Honours website Sitemap

- Introduction -

- Background -

* Methods *

- Results -
[Analysis]
[MIDI]

- Conclusions -

- Downloads -
[Documents]
[Source code]

- Logbook -

- References -
Methods
Musical analysis Music generation

Musical analysis

Music analysis involves observing various musical properties to gain an overall understanding of the structure of the music. Such details may include repeating patterns, tempo and key. Composers can then use this information to create new music based on certain properties of existing music, such that the new compositions will inherit the properties of the existing music.

The Internet today is populated with music in various formats such as MP3 and WAV. It would be useful to have some software tool that gives you statistical information about the contents of these files, especially if you wanted to make some comparisons between different music files in the same format. The statistical information could also be used to aid the transposition of the music into a form that could be played by a human, such as sheet music.

In this project, some possibilities for comparison of different music files in the same format include comparing songs from a particular genre (such as blues or classical music) and comparing different files of the same song (that is, files of the same song, but potentially created by different people). Theoretically, different files of the same song should be very similar in tempo, key and time signature, but may differ in the instruments that are used to create the music.

This thesis concentrates solely on using MIDI files. Not only do MIDI files number in their thousands on the Internet, the size of a MIDI file is very small compared to the size of MP3s and WAVs. Although some MIDI files may not be that interesting to listen to, they are very small in size.

Information that was considered relevant as a summary of the contents of the MIDI file is listed below:- 

  • File name
  • Playing time
  • Tempo
  • Key
  • Time signature
  • Total number of bars
  • Instruments used

Information such as the tempo, key and instruments used will be useful when comparing two different MIDI files of the same song. Although they may be recognised as the same song when they are played individually, there may be subtle differences in such features as tempo.

Some features such as time signature and key information are contained in a MIDI files as events with little calculation required to output them in a human-readable format. Other features such as tempo, however, are also contained in MIDI files as events but require some calculation to be carried out such that all possible events of the same type are taken into account. For example, to calculate the duration of a MIDI file, all changes in tempo must be considered.

 

Music generation

After looking at previous research that has been conducted in the area of computer composition, few new ideas could be thought of for generating new music in this thesis. Although people had tried using genetic algorithms, cellular automata, and grammars, something similar to what was going to be completed could not be found amongst the literature at hand.

After some consideration, and based on the author's experience with music composition, the use of guitar chords and traditional music theory became a very strong possibility for a new way to generate music on a computer. Since MIDI files are already being used for the analysis of music, it is natural that MIDI files will also be used to output the results of the new compositions.

But deciding to use guitar chords alone is not enough for the generation of new music. If chords simply were picked at random and played one after the other, the chances of the result having much musical is not very high. Traditional music theory dictates that some chords will sound better when played after certain ones than others. If music is said to be in a particular key, you know that there will be limits on what chords you can use and in what order you can play them in. Harmonic rules are used to define the relationship between notes and chords. Rules that were found to be useful in this thesis were (using the Roman numeral system which says the first note in the key is I, 2nd note is II, and so on):- 

  • A I chord can change to any chord
  • A II chord can change to any chord, except I
  • A III chord can change to any chord, except I
  • A IV chord can change to any chord
  • A V chord can change to any chord, except II
  • A VI chord can change to any chord, except I

 

An algorithm for music generation

Define the guitar chords that will be used
Define the keys that will be used
Define which chords can be played in a each key
Define the harmonic rules to be used
Set chordlen to a random integer between 20 and 50
Set chordprog to <empty_list>
Append first chord of key to chordprog
Set current_chord = first chord of key
Set counter = 1
While counter < chordlen
{
          Select next chord given harmonic rules and current_chord
          Append selected chord to chordprog
          Increment counter
}
Set maxnotes = notes_per_bar
Set mellist = <empty_list>
While ((current\_chord = getnext(chordprog)) != NULL)
{
         Set counter = 0
         While counter < maxnotes
         {
                 Select random note from arpeggio of current_chord
                 Append selected note to mellist
                 Increment counter
         }
}
While ((current\_chord = getnext(chordprog)) != NULL)
{
          Set duration of current_chord to <maxnotes> the duration of a single note
}
Output the concurrent composition of chordprog and mellist  
(C) 2003. This site was created and designed by Amanda Crawford