Lade Inhalt...

Composing music using AI algorithms

Hausarbeit 2004 117 Seiten

Informatik - Angewandte Informatik

Leseprobe

Table Of Contents

Abstract

List of Tables

List of Figures

Acknowledgments

Chapter 1 - Introduction

Chapter 2 - The relationship between Mathematics and Music
2.1 Music, Mathematics and the ancient Greeks
2.2 The existence of mathematical patterns in music
2.3 Other relationships between maths and music

Chapter 3 - The human composition process
3.1 The act of composition
3.2 The composition process as an algorithm
3.2.1 Transposition
3.2.2 Inversion
3.2.3 Retrograde
3.2.4 Inversion Retrograde
3.2.5 Other similar techniques are:

Chapter 4 - Music Composition using AI algorithms
4.1 Music Composition using rule-based and statistical algorithms
4.1.1 Markov chains
4.1.2 Grammars
4.2 Expert Systems
4.2.1 The Architecture of Expert Systems
4.2.2 Expert Systems and Music Composition
4.3 Music Composition using Neural Networks
4.3.1 A brief introduction to Neural Networks
4.3.2 Artificial Neural Networks and Music Composition
4.4 Music Composition using Genetic Algorithms
4.4.1 A brief introduction to Genetic Algorithms
4.4.2 Genetic Algorithms and Music Composition

Chapter 5 - Artificial Intelligence Music Experiments
5.1 The Development Environment
5.2 AIME – technical overview
5.3 AIME - Import existing music
5.4 AIME - Composing using Markov chains
5.5 AIME – ANN composition
5.6 AIME – Expert System composition

Chapter 6 - Evaluate the outcome of the literature research
6.1 Experiment 1: Automated composition using Markov chains
6.2 Experiment 2: Automated composition using Expert systems
6.3 Experiment 3: Automated composition using Artificial Neural Networks

Chapter 7 - the Conclusion

Chapter 8 - Critical Evaluation
8.1 Did I reach the aims and objectives as stated in the proposal?
8.2 Is my work significant?
8.3 Personal Lessons Learned

Reference List I

Appendix A – Project proposal and project management methodology

Appendix B – Project Plan and Status Documents

Appendix C – Project Financials and Effort

Appendix D – Project Log

Appendix E – David Cope and EMI

Appendix F – A brief introduction to MIDI
A brief introduction to MIDI
What is MIDI?
MIDI note numbers
MIDI files

Content of the Appendix-CD Rom

Abstract

Artificial Intelligence (AI) and its applications in the field of Music Composition have been recognized as an important discipline in many music related AI projects and publications.

Therefore the research of AI related Music Composition is well established. There are many publications available. But most of them are dealing only with a view specific AI disciplines (e.g. Neural Networks). There has never been a publication which is describing all of the fundamental principles of AI related Music Composition to beginners. It is purpose of this work to fill this gap and give the reader a profound introduction to almost every AI related aspect regarding to the field of Music Composition.

Further this work states and investigates some conditions which should be met in order to make composing Music using AI algorithms a promising approach. These conditions are a strong affinity between maths and music and a strong relationship between the human composition process and algorithms in general.

As this work will show, these two conditions are met. As a result, composing music using AI algorithms will be a promising approach. To strengthen this statement the most important and promising AI composition techniques were tested in a “Proof of Concept” program, coded in C#. This piece of software, called AIME (Artificial Intelligence Music Experiments), is a collection of modules, demonstrating the most basic concepts of AI related Music Composition, which are Markov chains, Artificial Neural Networks and rule-based systems (Expert Systems).

List of Tables

Table 1: The quadrivium (Uzo-Okoro, 2002)

Table 2: Frequencies of Notes in A-Major Scales (Garland and Kahn, 1995)

Table 3: Examples of rules used by an Expert System (eXpertise2Go.com, 2001)

Table 4: Examples of rules for Music Composition (Pirkle, 2001)

Table 5: Experiment 1: Automated composition using Markov chains

Table 6: Experiment 2: Automated composition using Expert Systems

Table 7: Experiment 3: Automated composition using Artificial Neural Networks

Table 8: Planned aims and objectives of the project

Table 9: Additional aims and objectives

Table 10: Planned outcomes and deliverables

Table 11: Additional outcomes and deliverables

Table 12: Project Financials

Table 13: Project Effort

List of Figures

Figure Page

Figure 1: Using strings to produce pitches (Boyd-Brent, 2003)

Figure 2: A keyboard and its correlation to Fibonacci Numbers (Garland and Kahn, 1995)

Figure 3: A simple melody (Britannica, 2004b)

Figure 4: The former melody after inversion (Britannica, 2004b).

Figure 5: A set of input notes and its corresponding transition matrix (McCormack, 2000)

Figure 6: An example of a grammar displayed in form of a tree (Miranda, 2001)

Figure 7: A simple musical grammar by Eduardo Reck Miranda (2001)

Figure 8: A musical phrase generated by Mirandas grammar (Miranda, 2001)

Figure 9: Music produced by successive activation of grammatical rules (Miranda, 2001)

Figure 10: The Architecture of an Expert System

Figure 11: The architecture of a biological neuron (Molnar, 2001)

Figure 12 Architecture of an artificial neuron (Zell, 1997)

Figure 13 Multilayer Perceptron Architecture (Kanellopoulos, 1995)

Figure 14: Using a note by note approach (Herfort and Rehberger, 2003)

Figure 15: The building blocks of Genetic Algorithms

Figure 16: A schematic representation of a GA for Music Composition (Towsey et al., 2001)

Figure 17: Technical Overview of AIME

Figure 18: The user interface of AIME’s Midi Import module

Figure 19: A transition table as used in AIME

Figure 20: A screen shot of AIME’s Markov chain composition module

Figure 21: ANN training patterns

Figure 22: A screen shot of AIME's ANN composition module

Figure 23: a screen shot of AIME’s ANN configuration options

Figure 24: Project Plan, Iteration 1

Figure 25: Project Plan, Iteration 2

Figure 26: Project Log

Figure 27: Notes in standard notation and their equivalent as a sequence of midi events

Figure 28: A basic MIDI setup

Figure 29: The MIDI note numbers (Kruse, 2002)

Acknowledgments

I wish to express gratitude to the following persons. Without their support this project would have not been possible.

- Bill Pirkle, for teaching me some insights of his composition system and explaining me some details about the “rules of music”.
- David Cope and the people from Spectrum Press, who kindly gave me permission to use one of EMI’s (an Automated Composition System written by David Cope) compositions to evaluate the quality of computer generated composition.
- Matt Paton, for sharing his ideas about composition using Markov chains.
- Alexey Vasilyev., for sharing his ideas about music composition using Artificial Neural Networks.
- Stephen Toub, for giving me permission to use his MIDI class library.
- Christoph Ruegg, for giving me permission to use his Neural Network class library and for his support during the implementation of AIME. Together we were able to improve the outcome of the library and thus improve the quality of this project.
- Guenter Herfort, for taking a critical look at this work, sharing some ideas and teaching me the basics of Blues.
- My brother Johann, for taking a critical look at the source code I have written.
- My brother Hubert, for proof-reading the final report.
- Herbert Hoertlehner, for his support as my final year project tutor.

Chapter 1 Introduction

Objectives of this chapter:

- To state a hypothesis
- To give an overview of the structure and the content of this report

1 Introduction

What is the process of composition? Is it an act of genius? Is it an act of hard work best described as a “process of incremental revisions” (Jacob, 1998). Is da Silva right when he says:

“… Every composition is a finite sequence of steps. It is logical, then, to assume that, regardless of who the composer is, the act of composing is as an algorithmic process. Algorithms emerge, then, as the most appropriate tool for the creation and study of music…” (da Silva, 2003).

If he is right, composing is algorithmic in nature and therefore should be convertible to computer algorithms. In this work I will examine if the composition process is, at least partly, algorithmic in nature. If it is, it seems obviously to hypothesize that:

- There should be a strong affinity between music and mathematics.
- It should be possible to find algorithmically aspects in the “human composition process”.

Why do I think that these two assumptions are correct?

First, it is common knowledge, that the solution to many mathematical problems may be derived through algorithms. If there is a strong correlation between Music and Mathematics, it seems obviously that the solution to many musical problems (e.g. composition) may also be achieved using algorithms.

Second, if it is possible to find algorithmically aspects in the “human composition process”, it seems obvious, that the process of composition may be, at least partly, described using algorithms.

To either support or disprove this hypothesis Chapter 2 investigates the relationship between Maths and Music and Chapter 3 analyzes some human composition techniques and examines if they may be described using algorithms.

Chapter 4 describes the basics of various AI methodologies and shows how these methodologies may be used to compose music. Among these methodologies are: Markov chains, Grammars, Expert Systems, Artificial Neural Networks and Genetic Algorithms.

Finally Chapter 5 describes a group of software modules. The purpose of which is to demonstrate, that composing music using AI algorithms is actually working. This “Proof of Concept” application is called AIME (Artificial Intelligence Music Experiments).

Chapter 2 The relationship between Mathematics and Music

Objectives:

- To describe some of the relations between music and mathematics as discovered by the ancient Greeks
- To explain the existence of mathematical patterns in musical compositions

2 The relationship between Mathematics and Music

On the first look mathematics and music may not have much in common. Mathematics is considered to be a deterministic science. It is related to numbers, patterns and calculations. Mathematics has evolved from elemental practices of counting, measuring, and describing the shapes of objects. Mathematics deals with logical reasoning and quantitative calculation (Britannica, 2004c). Mathematics is often accompanied by feelings of rejection and disinterest. (Beer, 1998)

Music, on the other hand is the cause for emotions and feelings. We all have our favourite songs. Music is something everyone has an affinity to.

”Everyone has sung a song, pressed a key on a piano, blown into a flute, and therefore made music” (Beer, 1998)

Though mathematics and music play very different roles in society; they are more closely related to each other that it seems on the first glance.

According to Michael Beer (1998) there are three different aspects, which indicate this sort of relationship.

The first aspect describes some of the relations between music and mathematics as discovered by the ancient Greeks, the second aspect is that there exist examples of mathematical patterns in musical compositions and the third aspect reveals connections concerning the artistic aspect of the mathematical way of thinking. In the following sections I will explain the first two aspects.

2.1 Music, Mathematics and the ancient Greeks

During the ime of the ancient Greeks (about 400 to 700 BC) mathematics and music were strongly connected. In fact, music was considered to be a sub domain of mathematics. Music was strictly considered to be a mathematical discipline. In the quadrivium (the curriculum of the Pythagorean School) music was placed on the same level as arithmetic, geometry and astronomy. Music was the science of sound and harmony (see Table 1).

The Pythagoreans had a strong affinity and to numbers. They thought that the essence of nature may be represented in whole numbers, or in relationships between whole numbers. They even belie fed in strong mystical relationships between whole numbers and the structure of the universe:

”God has ordered the universe by means of numbers. God is unity, the world is plurality, and it consists of contrasting elements. It is harmony which restores unity to the contrasting parts and which moulds them into a cosmos. Harmony is divine, it consists of numerical ratios. Whosoever acquires full understanding of this number harmony, he becomes himself divine and immortal” (Waerden, 1988) cited in (Garland and Kahn, 1995)

The numbers that intrigued the Pythagoreans the most were those found in musical ratios (Woebeke, 2004).

Abbildung in dieser Leseprobe nicht enthalten

Table 1: The quadrivium (Uzo-Okoro, 2002)

Pythagoras himself is considered to be the first person who recognized the consonant (= wellsounding) acoustic relationship between frequencies. As the story goes, Pythagoras observed that when the blacksmith struck his anvil, different notes were produced according to the weight of the hammer. Further, he observed that if you take two strings in the same degree of tension, and then divide one of them exactly in half, when they are plucked (see Figure 1), the pitch of the shorter string is exactly one octave higher than the longer (Boyd-Brent, 2003).

Abbildung in dieser Leseprobe nicht enthalten

Figure 1: Using strings to produce pitches (Boyd-Brent, 2003)

Producing frequencies using variations of the previously described methodology the only harmonic musical intervals to the Pythagoreans were those produced by dividing the string in a manner, that the two resultant lengths were in the simple rations of 2:1, 3:2, 4:3, or 5:4. They named these intervals: octave, the fifth, the fourth and the third (Sabine, 2000). The difference between a fifth and a fourth (ratio 8:9) was defined as a “whole tone”.

The studies of harmonic ratios and proportions were the essence of music during Pythagorean times.

The intervals as defined by the Pythagoreans faced one problem: By adding several intervals to a base note, one never reaches an octave of the base note again. Several attempts to overcome this limitation were made, starting at the middle ages.

The attempt of Johann Sebastian Bach survived until nowadays. Bach divided an octave into twelve equal semitones (Beer, 1998).

Bach’s attempt is based on the ratio 1:2 for octaves. All the other Pythagorean intervals were slightly tempered in order to fit into the new pattern. For example the whole tone as used by the Pythagoreans was defined by the ratio 9/8 = 1.125. Bach defined the ratio for a whole tone as 1.1225. So there is only a minimal difference. Bach’s scale is also known as “even-tempered”.

Table 2 compares the frequencies between the notes in the Pythagorean scale and the notes in the even-tempered scale. It shows that there are only minor differences. The human ear still prefers the “clear” Pythagorean frequencies, but the even-tempered scale is better suitable to produce a greater variety of complex music.

Abbildung in dieser Leseprobe nicht enthalten

Table 2: Frequencies of Notes in A-Major Scales (Garland and Kahn, 1995)

2.2 The existence of mathematical patterns in music

Another very interesting facet of mathematical aspects in musical compositions is the appearance of mathematical patterns in music. The most astonishing appearance is the appearance of Fibonacci numbers.

Fibonacci numbers are a special series of integers named after Leonardo de Pisa (alias Fibonacci, 1175 - 1250).

The first two integers of the Fibonacci series are both 1, whereas every new member of the sequence is formed by addition of the two preceding. (e.g 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89…).

So where is the correlation to music?

Consider the keyboard of a piano (see Figure 2): 1 octave is made up of 13 keys. There are 8 white keys and 5 black keys. The black keys are positioned in groups of 2 and 3.

The numbers 1, 2, 3, 5 and 8 are the first six Fibonacci numbers. (Garland and Kahn, 1995).

Abbildung in dieser Leseprobe nicht enthalten

Figure 2: A keyboard and its correlation to Fibonacci Numbers (Garland and Kahn, 1995)

In his work “Mathematics and Music” David Sabine (2000) further outlines the following correlations:

Consider the octave: It is made of 13 semitones. 13 is a Fibonacci number. The semitone (interval 1) and the wholetone (2 semitones) are the building blocks of the diatonic scales. 1 and 2 are Fibonacci numbers. Pentatonic scales are based on 5 wholetones. 5 is a Fibonacci number. Diatonic scales are based on 8 wholetones. 8 is a Fibonacci number. The 1st, 3rd, and 5th notes in the diatonic scale are the building blocks of root chords. 1, 3 and 5 are Fibonacci numbers.

Even more astonishing is the appearance of the so called golden ratio in musical compositions.

The sequence of Fibonacci ratios (the ratio of a Fibonacci number to its bigger adjacent) converges to a constant limit, called the golden ratio (0.61803398). Various studies have revealed that the golden ratio is very common in musical compositions (Beer, 1998).

For Example: In the first movement of Béla Bartók’s piece “Music for Strings, Percussion and Celeste, the climax is situated at bar 55, out of 89 bars (Elkies, 1995). 55 and 89 are two neighbouring Fibonacci numbers. 55/89 = 0,61798 (the golden ratio). Additionally in the same piece the measures 1, 2, 3, 5, 8, 13, 21, 34, 55, and 89 (all of which are Fibonacci numbers) mark significant moments (changes in key, dynamics or instrumentation) (Sabine, 2000).

Another Example is the “Halleluja” chorus in Handel’s Messiah. This piece of music consists of 94 measures. One of the most important events in this piece is the entrance of solo trumpets (“King of Kings”). It happens in the measures 57 to 58 after about 8/13 (golden ratio) of the whole piece (Beer, 1998).

After 8/13 (golden ratio) of the first 57 measures (measure 34, a Fibonacci number) the entrance of the theme “The kingdom of glory” marks another essential point. After 8/13 (golden ratio) of the second 37 measures (measure 79) again there are some solo trumpets marking a special “event” in the piece of music (Beer, 1998).

From Bartók's letters and journals it is known that he used the Fibonacci numbers consciously (Sabine, 2000). However, in the same manner some Mozart sonatas were examined and the presence of the Fibonacci sequence and the golden ration was found there too (Beer, 1998).

2.3 Other relationships between maths and music

In his work “The Mathematical Basis of the Arts” Josef Schillinger (1948) shows, that every mathematical formula may be translated into an algorithm which is capable of producing pieces of music.

This is an interesting aspect which supports the theory that there must be a strong affinity between mathematics and music.

Chapter 3 The human composition process

Objectives:

- To explain the “act of composition”

- To explain some “human composition techniques”

- To demonstrate, that the human composition process is, at least partly, inherently algorithmic

3 The human composition process

3.1 The act of composition

According to the Encyclopaedia Britannica (2004e) musical composition is defined as:

“the act of conceiving a piece of music, the art of creating music, or the finished product. These meanings are interdependent and presume a tradition in which musical works exist as repeatable entities. In this sense, composition is necessarily distinct from improvisation”.

I agree to this definition. The act of composition is an art. Therefore it is an act of creativity.

According to Jacob (1998) there are two distinct types of creativity “the flash out of the blue (inspiration, genius)”, and the “process of incremental revision (hard work)”.

I share this idea. In order to make automated composition using AI Algorithms a promising approach it should be possible to demonstrate that the “hard work part” of composition is algorithmic in nature. This is the aim of the next section.

3.2 The composition process as an algorithm

In his book “Techniques of the Contemporary Composer” David Cope (1997) shows several composition techniques which are widely used among human composers. Every single of these techniques may be categorized as being part of the “hard work” of composition.

3.2.1 Transposition

In music transpositon means moving a note or collection of notes up or down in pitch by a constant interval. (Wikipedia, 2004c)

3.2.2 Inversion

In music-theory the term “inversion” has a number of meanings. A very useful aspect when it comes to composition is the “inversion” of melodies. To invert a melody means to change its ascending intervals to descending ones and vice versa (Britannica, 2004b).

For example:

Abbildung in dieser Leseprobe nicht enthalten

Figure 3: A simple melody (Britannica, 2004b)

becomes

Abbildung in dieser Leseprobe nicht enthalten

Figure 4: The former melody after inversion (Britannica, 2004b).

Another definition of Inversion is also widely used among composers. This second definition states, that an inversion of a melody is the melody turned upside down (Wikipedia, 2004b).

3.2.3 Retrograde

Playing a melody retrograde does mean playing the melody from the end to the beginning. You start playing the last note of the phrase and end with playing the first.

3.2.4 Inversion Retrograde

Inversion Retrograde is a combination of Retrograde and Inversion.

3.2.5 Other similar techniques are:

- Adding notes
- Augmenting and diminishing intervals within a motive
- Skeletonizing (omitting a note or a set of notes)
- Elongating (adding notes to the beginning, middle, or end
- Augmenting durations or otherwise altering the rhythm of motives

Every single of the above composition techniques is used by human composers. These techniques have nothing to do with computers and they evolved a long time before computers were even invented. But every technique shown above is easily convertible to an algorithm, making it possible to write a piece of software which is “composing music” using techniques which are also used by human composers.

Chapter 4 Music Composition using AI algorithms

Objectives:

- To explain the basic principles of Markov Chains, Grammars, Expert Systems, Neural Networks and Genetic Algorithms

- To describe how Markov Chains, Grammars, Expert Systems, Neural Networks and Genetic Algorithms may be used to compose music

4 Music Composition using AI algorithms

4.1 Music Composition using rule-based and statistical algorithms

4.1.1 Markov chains

(i) A brief introduction to Markov chains

One well recognized approach to computer based Music Composition is to make use of Markov chains.

Markov chains are “conditional probability systems where the probability of future events depends on one or more past events” (Miranda, 2001). They may be used to generate “sequences of events” using probabilities. Markov chains are named in honour of Andrei Andreevich Markov, who was a Russian mathematician. He lived between 1856 and 1922 (Wikipedia, 2003a).

In Music Composition these events correspond to pitch, duration, velocity or something like that.

The number of the past events which are taken into consideration is called “order” of the chain. A Markov chain which is of “first order”, takes into account one predecessor. A Markov chain which takes into account the “predecessor” and the “predecessor of the predecessor” is of “second order”, and so on.

Markov chains may be generated using a transition matrix. This matrix has n + 1 dimensions, where n stands for the order of the matrix chain. The transition matrix may be used to store information about the probability of an events’ occurrence, if the previous n events are taken as input.

(ii) The properties of Markov Chains (Cortina, 2003b)

- A state X is reachable from state Y if it is possible to reach state X from state Y after a finite number of steps.
- If state X is reachable from state Y and state Y is reachable from state X, states X and Y communicate.
- Those states that are certain to occur again are called recurrent states.
- Those states that may never occur again are called transient states.
- A Markov chain that contains exactly one set of recurrent states is called ergodic.

(iii) Markov chains and Music Composition

Markov chains may be used in different ways in order to compose music. A simple but interesting approach is to select notes sequentially according to a transition matrix which could be used to specify the probability of the next note as a function of the current note (Herfort and Rehberger, 2003).

Figure 5 shows a series of notes and its corresponding transition matrix. This matrix may be used as input to an algorithm which makes use of the technique described by Herfort and Rehberger. It shows a first order Markov model, where the probability of a given note to be played depends only on the note immediately played before. Each element in the transition matrix represents the probability of note j (next event) occurring given that note i (current event) has just occurred.

Abbildung in dieser Leseprobe nicht enthalten

Figure 5: A set of input notes and its corresponding transition matrix (McCormack, 2000)

The composition process using Markov chains consists of two stages. During the first stage some existing music must be analyzed and the transition matrix has to be built. During the second stage the “composition process” has to take place. This is done by generating a “sequence of notes” using the previously built transition matrix.

Markov chains have some serious limitations. Given a specific piece of music as input, the resulting Markov model will produce only music which has a style very similar style to the input. (McCormack, 2000). Another limitation is described by Matt Paton (2003):

While Markov models may be used not only to predict the pitch, but also the velocity or duration of notes, each of this attributes requires its own Markov chain. These chains are totally independent from each other. This is very unrealistic when compared to the human composition process.

”…This situation is comparable to many different composers collaborating on a composition, each controlling the value of a certain musical attribute and none being aware of what the other composers are doing.” (Paton, 2003).

Further compositions which are based on a Markov model do not follow some global musical structure. Though the process is suitable to reproduce musical patterns on the micro level (e.g. measures or simple motives), it is insufficient at the macro level.

4.1.2 Grammars

When we use the term “grammar” we usually speak about the original linuguistics meaning of grammar. The theory of linguistics models the unconscious knowledge of speech by a formal system of principles or rules. These set of rules is called a grammar. The grammar describes (or generates) the possible and valid sentences of a language (Burns 1996).

Formal grammars are one of the main topics in computer science. They were introduced in the 1950s by the North American Linguist Avram Noam Chomsky and are used to formalize natural as well as programming languages. (Puente et al., 2002).

Chomsky suggested that people are able to understand and speak a language mostly because they have mastered its grammar. According to Chomsky, the specification of a grammar must be based upon a mathematical formalism in order to thoroughly describe its functioning. A grammar should then manage to characterise sentences objectively and without guesswork. Chomsky also believed that it should be possible to define a universal grammar, which is applicable to all languages (Miranda, 2001).

(i) A brief introduction to formal grammars

A formal grammar is “a collection of either or both descriptive ore prescriptive rules for analysing or generating sequences of symbols” (Miranda, 2001).

A formal grammar consists of:

- A finite set N of nonterminal symbols
- A finite set T of terminal symbols
- A finite set P of production rules
- A Symbol S which is an element of N. S is called the start symbol.

Following its production rules a grammar may be used to generate a string of terminal symbols. This string of terminal symbols is referred to as the language described by the grammar.

An example of a simple grammar G might be defined as follows (Miranda 2001):

Abbildung in dieser Leseprobe nicht enthalten

Considering the grammar G one could obtain the following sequence:

Abbildung in dieser Leseprobe nicht enthalten

The previous example was rather “theoretical”. To give the reader a better understanding about formal grammars I will give an example of a grammatical rule for a simple sentence: E.g. “The dog catches the cat”.

Abbildung in dieser Leseprobe nicht enthalten

The above rules define that a sentence (S) is formed by a noun phrase (NS) and a verb phrase (VS).

A noun phrase is formed by an article (A) followed by a noun (N). A verb phrase is formed by a verb (V) followed by a noun phrase.

In order to form valid sentences, one could code this rules into a computer and allow a program to build valid sentences. To be able to do so we also have to define some sort of lexicon of words to choose from (these represent the Terminal symbols of the grammar).

Abbildung in dieser Leseprobe nicht enthalten

Given the above production rules and the lexicon a computer program could be written which generates syntactically valid sentences like: ’The dog catches the cat’ or ‘A cat eats the meat’. Of course not all of the possible sentences are semantically correct. E.g. ‘The mouse eats the dog’ does not make any sense.

It is important to understand the difference between semantics and syntax. In general, semantics always refers to some kind of meaning. It is thus usually opposed to syntax, which refers to the formal way in which something is written. (Wikipedia, 2003b)

The most intuitive kind to express a grammar is in form of a tree. Figure 2 shows the tree-structure of the previous described grammar of a simple english sentence.

Abbildung in dieser Leseprobe nicht enthalten

Figure 6: An example of a grammar displayed in form of a tree (Miranda, 2001)

(ii) The Chomsky hierarchy of grammars

Grammars are classified according to a hierarchy established by Noam Chomsky (1965). The Chomsky hierarchy divides the formal grammars into three types:

Type 1: regular grammars

Type 2: context free grammars

Type 3: context sensitive grammars

A grammar in which the start symbol does not appear as a substitution on the right-hand side of any production is called a regular grammar, if all non-start productions are of one of the following two forms: A -> a, where A is a non terminal symbol and a is a terminal symbol,
A -> aB, where A and B are non terminal symbols and a is a terminal symbol.

A grammar in which all production rules contain only one single non-terminal on the left-hand side is referred to as a context-free grammar (CFG).

(iii) Grammars and Music Composition

Music composition may be thought of as a process of generating some musical “sentences” using rules. Therefore grammars may be used to define those compositional rules (Cortina, 2003a).

Music and AI research has been strongly influenced by linguists and in particular by formal grammars. Many researchers, regarding AI and Music, are convinced that Chomsky’s theories about grammars for languages may be applied also to music (Lerdahl and Jackendoff, 1983).

In his book “Composing Music with computers”, Edurado Reck Miranda (2001) describes a simple grammar which may be used to generate music and thus used to demonstrate the relationship between grammars and music. This section is a description of the example used by Miranda. Miranda defines the following constituents of his grammar in terms of 5 fundamental notions:

- the notion Rn of a reference note (e.g., R 1 = C4)
- the notion of interval In between two notes (e.g., I 1 = perfect 5th)
- the notion of direction Dn of the interval (e.g., D 1 = upwards)
- the notion of sequence SEQn
- the notion of simultaneity SIMn

Miranda defines the following generation rules for his grammar:

Abbildung in dieser Leseprobe nicht enthalten

Figure 7 shows these rules in form of a tree.

Abbildung in dieser Leseprobe nicht enthalten

Figure 7: A simple musical grammar by Eduardo Reck Miranda (2001)

Miranda defines the lexicon for his grammar as followed:

I = {minor 2nd, major 2nd, minor 3rd, major 3rd, perfect 4th, augmented 4th, perfect 5th, minor 6th, major 6th, minor 7th, major 7th, octave, none}

D = {upwards, downwards, none}

For example, the pair (I5D1) indicates that the interval is a perfect 4th (the fifth element of the set I) and the direction of the interval is upwards (the first element of the set D).

Having defined the grammar and the lexicon the above rules “read” as follows:

A musical passage (SIM1) is composed. It is “built of” two sequences (SEQ1, SEQ2) which are played simultaneously. The notes of SEQ1 are calculated from a given reference note in this order: a perfect 4th upwards, a minor 6th upwards and a major 7th upwards. The notes of SEQ2 are calculated, using the same reference note, in this order: a perfect 4th downwards and a minor 6th downwards.

Using R = C4 (reference note = C4) the musical passage shown in Figure 8 can be generated.

Abbildung in dieser Leseprobe nicht enthalten

Figure 8: A musical phrase generated by Mirandas grammar (Miranda, 2001)

Miranda also describes how the above grammar may be extended. E.g. a transformational rule could create a new sequence (SEQ3) by joining the two sequences into a single simultaneous event. (SIM2 = SEQ1 + SEQ2), followed by the original first sequence SEQ1. A computer could be programmed to produce an entire musical composition (see Figure 9) by successive activation of a variety of generative and transformational rules (Miranda, 2001).

Abbildung in dieser Leseprobe nicht enthalten

Figure 9: Music produced by successive activation of grammatical rules (Miranda, 2001)

4.2 Expert Systems

An Expert System is

“…a computer program that simulates the judgement and behaviour of a human or an organization that has expert knowledge and experience in a particular field. Typically, such a system contains a knowledgebase containing accumulated experience and a set of rules for applying the knowledgebase to each particular situation that is described to the program” (Whatis.com, 2001)

Usually Expert Systems are used in the area of decision support. Their primary aim is to support decision-makers during the decision-making process. Expert Systems may be even used not only to support the decision-makers, but actually “be” the decision makers.

The first Expert System was developed in 1965 by Edward Feigenbaum and Joshua Lederberg from Stanford University. Their System was designed to analyze chemical compounds. The development of this system, called DENDRAL, took them more than 10 years.

The experiences earned from this early program allowed Expert Systems to emerge from the laboratory into the marketplace as the first successful commercial AI products (Britannica, 2004a).

4.2.1 The Architecture of Expert Systems

Figure 10 shows an overview about the architecture of an Expert System. Each of its elements will be briefly explained in the following sections.

Abbildung in dieser Leseprobe nicht enthalten

Figure 10: The Architecture of an Expert System

(i) The knowledgebase

Expert Systems use human knowledge to solve problems that normally would require human intelligence. This knowledge is stored in the knowledgebase. Thus, the knowledgebase holds the “body of expert knowledge”. This knowledge may be factual or heuristic (Engelmore and Feigenbaum, 1993).

Factual knowledge is widely recognized, usually available in books, on the Internet or through other publicly available sources. Heuristic knowledge is not that obvious. It is that type of knowledge which an expert often acquires through experience. Heuristic knowledge is very “individual”.

One common approach to store the expert knowledge is in form of production rules.

Usually these rules consist of an IF-Part and a THEN-Part. The IF-Part lists a set of conditions; the THEN-Part lists a set of conclusions. The If-Part describes a specific situation out of the problem domain. The THEN-Part describes the solution or conclusion to that specific problem.

Table 3 is showing some examples of simple production rules, which may be used in an Expert System which is built to support a car mechanic. The problem is: A car is not starting.

Rule 1: If the result of switching on the headlights is nothing happens or the result of trying the starter is nothing happens
Then the recommended action is recharge or replace the battery

Rule 2: If the result of trying the starter is the car cranks normally and a gas smell is not present when trying the starter
Then the gas tank is empty

Rule 3: If the gas tank is empty
Then the recommended action is refuel the car

Rule 4: If the result of trying the starter is the car cranks normally and a gas smell is present when trying the starter Then the recommended action is wait 10 minutes, then restart flooded car

Table 3: Examples of rules used by an Expert System (eXpertise2Go.com, 2001)

(ii) The inference engine

The inference engine is a collection of mechanisms. These mechanisms evaluate the expert knowledge in the knowledgebase and then form a conclusion, or decision. Typically this collection of mechanisms has the purpose to chain a series of IF-THEN rules in order to reach a conclusion to a given problem.

For Example the goal of the car diagnosis example illustrated in Table 3 is to find a recommended action: what to do when the car is not starting?

Rule 3 tells us what to do if the gas tank is empty. Rule 2 could prove that the gas tank is empty. Rule 3 and Rule 2 may be chained (if rule 2 fires then rule 3 will also fire) thus providing a recommended course of action (to refuel the car) (eXpertise2Go.com, 2001).

(iii) The knowledge acquisition process

The process of building an Expert System is known as “Knowledge Engineering”. The people who build the Expert Systems are named “Knowledge Engineers”. The knowledge engineer has to take make sure that the Expert System has all the necessary information built in to be able to solve a specific problem. It is the job of the knowledge engineer to collect all the required information, in order to build the Expert System.

This process of collecting information is called “knowledge acquisition”.

Knowledge acquisition is the process where the knowledge engineer gets appropriate information about a specific problem domain and then presents it into a manageable form. According to (McGraw and Harbison-Briggs, 1989) it is the most important step when building an Expert System and there basically exist three approaches to knowledge acquisition:

- Interviewing experts
- Learning by being told
- Learning by observations

4.2.2 Expert Systems and Music Composition

Music is not chaotic. It contains some chaotic elements, but it is well structured, following specific rules.

During an E-Mail conversation which I had with Bill Pirkle (2004) he confirmed:

The rules I use are taken from my own experiences. This is true of all composers, for example Chopin had his rules and they were different that the rules that Beethoven had. But there are some rules that both would have agreed on”

Bill is a Composer and the author of an Expert System for composing music, named PMCS (Pirkle’s Music Composition Studio). Since music is following some specific rules, it should be possible to build an Expert System for Expert. Table 2 shows an example of some rules for Music Composition.

Rule1: If the underlying harmony is C major, then use c, e, or g as the melody note.

Rule 2: If the passage is ending with a V7 chord, I cadence, generate a melody that rises from b to c

Rule 3: If the last development fragment had a complex rhythm, find a fragment with a simple rhythm for this passage

Rule 4: If the composition is to be “classical” then use a simple 1-3-5-3 pattern in accompaniment

Table 4: Examples of rules for Music Composition (Pirkle, 2001)

But an Expert System for Music Composition faces some challenges, as described by (Pirkle, 2001):

Using Expert Systems, as they are described in the previous sections, composing music involves acquiring expertise or “knowledge” in the form of rules – in this case rules about Music Composition. However, unlike most Expert Systems, there must be a creative element to the process.

Typical Expert Systems have a rather analytical behaviour. They make use of rules to conclude in the same optimal solution to the same set of inputs. But when we think about composing music there is no optimal solution.

Thus the rules of an Expert System for Music Composition must provide only a “general guideline” and not a “deterministic” set of rules. There must be space for some kind of “simulated creativity”. This is necessary to prevent every composition from sounding alike.

One approach to simulate creativity is to make use of randomness, or chaos. Bill Pirkle has introduced the concepts of “Chaos-based rule control” and “Rule-based chaos control” in his work “Expert System Composes Music: AI Creativity” (Pirkle, 2001).

In his work Pirkle compares these concepts with the purpose of the function of the right and left-brain, or the id, an ego/super ego in Freudian psychology. The left brain (or super ego) evaluates and controls that what the right brain (or ego) is suggesting. Pirkle uses rules to control chaos, and chaos to control rules.

(i) a brief introduction to chaos-based rule control

Using this concept one of several possible rules for Music Composition is selected via a random number (chaos to control rules)

(ii) a brief introduction to rule-based chaos control

Using this concept rules are used to limit the output of random numbers which may be used by the previously described “chaos based rule control”. For example, a rule might pick a random number from 1 to 3 to select one of three valid composition rules to be used (this is chaos-based rule control). Additionally another rule may limit the random number. If rule 3 was used in a specific previous composing step, then the random number at this time cannot be 2, because then the composition would sound boring. (this is rule-based chaos control).

4.3 Music Composition using Neural Networks

4.3.1 A brief introduction to Neural Networks

Basically spoken, there are two major types of Neural Networks:

- Biological Neural Networks
- Artificial Neural Networks

Usually when computer scientists are talking about a Neural Network, they should more properly say Artificial Neural Network (ANN). Since Artificial Neural Networks try to imitate the way a human brain works, it is helpful to take a closer look at the biological model, ANNs are based on: the human brain.

(i) A brief explanation of Biological Neural Networks

The human brain, which is the most sophisticated biological Neural Network, is a web of approximately 100 billion of interconnected nerve cells, called neurons (Freudenrich, 2003).

Each of these neurons may communicate with many other neurons. Thousands of neurons are involved with even the simplest behaviour. It is believed that these connections and their efficiency can be modified, or altered, by experience (Toga, 2004).

A neuron has five different parts, each of which has a specific purpose:

- The Axon
- The Dendrite
- The Soma (cell body)
- The Nucleus (cell core)
- Some Synapses

Abbildung in dieser Leseprobe nicht enthalten

Figure 11: The architecture of a biological neuron (Molnar, 2001)

Each neuron is a cell that uses biochemical reactions to receive, process, and transmit information or messages, through an electrochemical process. The chemicals in use are called neurotransmitters.

Connections between neurons are formed by a group of Dendrites. These are threadlike extensions to the neurons. Neurons also have extensions called Axons. Dendrites deliver electrochemical signals to the cell body. Axons deliver signals away from the cell body to other cells, crossing a gap, called Synapse.

The branches of a neuron’s Dendrite are connected to a thousand neighbouring neurons. If one of those neighbouring neurons is firing, a positive or negative charge is received by one of the Dendrites. The inputs of all the charges are added together and the aggregate input is then passed to the Soma, the cell body. It is just one part of the Soma, the Axon Hillock, which concerns itself with the signal processing. If the aggregate input is greater than the Axon Hillock’s threshold, this causes the neuron to fire and an output signal which is transmitted down the Axon. (Carter, 2004)

The Nucleus is referred to as the “control centre” of a cell. It controls many activities of the cell, like its growth or heredity. The Nucleus holds most of the cell’s genetic information, called the DNA. It is the DNA which is responsible for providing the cell with its unique characteristics.

(ii) A brief explanation of Artificial Neural Networks

According to the Webopedia (2004) an artificial Neural Network is

“a type of artificial intelligence that attempts to imitate the way a human brain works. Rather than using a digital model, in which all computations manipulate zeros and ones, a neural network works by creating connections between processing elements, the computer equivalent of neurons. The organization and weights of the connections determine the output.”

A substantial element of the Artificial Neural Networks is their adaptability, the ability to learn a task independently, using training examples, without explicitly programming the artificial neural net (Zell, 1997).

Since Artificial Neural Networks try to emulate “brain behaviour” their architecture is based on the architecture of a human brain, thus it is based on the concepts of “artificial neurons”.

Artificial neurons are strongly idealizes representations of biological neurons. Following its biological model, an artificial neuron is based on a cell core, some Dendrites, which sum the input of the net into the cell, and an Axon, which is passing the output of a cell to to other neurons, using Synapses (see Figure 12).

The inputs of a neuron are weighted. One neuron can have a number of inputs. Each neuron also has a threshold value (part of the cell core). It uses an activation function (also part of the cell core) to determine if the neuron should fire, or not. In its easiest form, the activation function is as followed: If the sum of all weights of all inputs (Dendrites) is greater than its threshold, then the neuron is considered to be active.

This is a very basic architecture of an artificial neuron. There are a couple of more sophisticated models out there (e.g. some use more sophisticated activation functions instead of a simple threshold), but basically they are all based on this simple concept.

Abbildung in dieser Leseprobe nicht enthalten

Figure 12 Architecture of an artificial neuron (Zell, 1997)

According to its biological model (the human brain) Artificial Neural Networks are built of artificial neurons, which are connected to each other. Whereas these connections in the human brain are very complex, artificial neurons use simple models of connectivity. Artificial neurons are arranged in layers. These are: the input layer, one or more hidden layers, and the output layer.

In its simplest form each neuron of a layer is connected to each neuron of the following layer. A neuron is activated by its predecessors and passes its output on to all its successors. Thus an information flow from the input neurons to the output neurons is established. (Figure 13)

Abbildung in dieser Leseprobe nicht enthalten

Figure 13 Multilayer Perceptron Architecture (Kanellopoulos, 1995)

Theoretically there are various techniques to train an ANN. According to A. Zell (1997) these are:

- To establish new connections between neurons
- To delete existing connections between neurons
- To modify the connection weight
- To modify the threshold
- To create new cells (neurons)
- To delete cells (neurons)

All of these techniques are based on the model of the human brain. Though all of these techniques may be used to train a Neural Network, it is the modification of connection weights which is the most common practice. There are various mathematical algorithms to do so. The most common ones are the Learning rule of Hebb, the Delta rule and Backpropagation rule. (the explanation of these concepts is out of the scope of this report)

4.3.2 Artificial Neural Networks and Music Composition

One way to use artificial Neural Networks to compose music is to feed the ANN with examples of existing compositions. The theory here is that the network is able to learn the hidden structure of the example music.

In its simplest form this existing compositions are fed into the network note by note. The ANN learns to predict the next note, based on a set of previous notes. The previous notes represent the input for the ANN. The next note represents its desired output.

The note by note approach was first examined by Peter M. Todd (Todd, 1989) Further an ANN architecture working that way was proposed by Kenny McAlpine (1999).

We used the note by note approach with limited success in our “Blues Soloist” Project. (Herfort and Rehberger, 2003). The architecture of the network we used is shown in Figure 14. This architecture was “too simple” to produce a broad variety of compositions, though it produces simple melodic pitch sequences.

The problem with the “note by note” approach using a Feed Forward Backpropagation Network (as described in the previous section) is that the output is lacking some kind of “global structure” because the net is not able to learn the long term dependencies (Eck and Schmidhuber, 2002).

Abbildung in dieser Leseprobe nicht enthalten

Figure 14: Using a note by note approach (Herfort and Rehberger, 2003)

4.4 Music Composition using Genetic Algorithms

4.4.1 A brief introduction to Genetic Algorithms

Like Artificial Neural Networks, Genetic Algorithms are based on some of the principles of nature.

In this case the principles of evolution.

(i) A brief introduction to evolution and natural selection

There are two primary processes in nature which are driving the evolution of organisms. These are natural selection and sexual reproduction. The first, natural selection, determines which members of a population will survive. The second, sexual reproduction, “...ensures mixing and recombination among the genes of their offspring” (Holland, unknown) .

The first fundamental principle of evolution, natural selection, has been formulated by Charles Darwin (1859) in his famous work “The Origin of Species”. Natural selection is the evolutionary process which selects the variation(s) of organisms best suited for a particular environment (Buckley, 1999 - 2003). According to Darwin (1859) “no being or species has been specifically created. They all are in a constant struggle for existence, with extinction looming for those not fitted for the task.”

According to (Knowles, unknown) natural selection as devised by Charles Darwin is based on the following principles:

- All species are capable of producing more than enough offspring to replace themselves.
- The environment may affect an individual's chances of survival.
- Because individuals are not all identical, some may be more likely to survive than others
- The individuals who are best adapted to a specific environment are more likely to survive.

Charles Darwin put forward his ideas without explicit knowledge about the basic heredity principles, like inheritance. Even he was aware of the fact, that there must be something like a process of sexual reproduction; he did not exactly know how it was working.

It was the Austrian botanist and plant experimenter, Gregor Mendel, who discovered the basics of the second fundamental principle of evolution, sexual reproduction (around 1860). Mendel discovered the laws of heredity. He was the first “…to lay the mathematical foundation of the science of genetics” (Britannica, 2004d).

It was the combination of Darwin's and Mendel's ideas, which led to the modern evolutionary theory (Guyagular, unknown).

(ii) A brief introduction to Genetic Algorithms

Genetic algorithms are based on the modern evolutionary theory, as described in the previous section. They move towards an optimum solution to a given problem in making use of the same processes which nature uses to select the individual fittest to its environment. These are: natural selection and sexual reproduction.

According to Gary William Flake (2000) Genetic Algorithms are “a method of simulating the action of evolution within a computer”.

Genetic Algorithms were introduced by John Holland at the University of Michigan. He was

“the pioneering founder of much of today's work in Genetic Algorithms, which has moved on from a purely theoretical subject (though based on computer modelling) to provide methods which can be used to actually solve some difficult problems today” (Wikipedia, 2004a)

Genetic Algorithms work through iterations of the following steps:

- create a population
- test the fitness of each individual
- select the fittest individuals
- mate the fittest individuals to create a new population

First, an initial population is created. This population is a collection of individuals. Each individual is a representation of a possible solution to a given problem. It is represented through a sequence of symbols (preferably bits), called a genome.

The “fitness” of an individual is evaluated according to some predefined quality criterion, referred to as the “fitness function”. To form a new population the “fittest” individuals are selected for “sexual reproduction”.

(iii) Implementation details

If someone wants to implement a Genetic Algorithm he/she has to find “computer representations” of the following objects and processes:

- a population
- an individual
- the process of natural selection
- the process of sexual reproduction

Individuals may be implemented as a sequence of bits. A population is a collection of individuals. Thus it may be implemented as a collection of sequences of bits. The population represents the search space of all possible solutions to a given problem. Each individual represents one single possible solution.

To implement the process of natural selection one has to define some quality criterion and implement this criterion in form of a fitness function. This process is called selection. Selection alone cannot introduce any new individuals to the population. This is done through the process of reproduction. The basic processes of reproduction are:

- Crossover (or Recombination)
- Mutation

Crossover is the act of swapping genes (bits) between two individuals, thus “simulating” the mating of two individuals.

These crossover action tends to “enable the evolutionary process to move toward promising regions of the solution space” (Thomas, unknown). This often may be a “local optima solution”.

Mutation is a way out of this situation. It prevents a early convergence to local optima by randomly vary new points in the search space. (Thomas, unknown) Mutation is the act of randomly altering the value of a gene (bits) of an individual.

Figure 15 gives an overview of the building blocks of Genetic Algorithms and how they work together.

Abbildung in dieser Leseprobe nicht enthalten

Figure 15: The building blocks of Genetic Algorithms

4.4.2 Genetic Algorithms and Music Composition

Figure 16 is showing a schematic representation of a Genetic Algorithm for Music Composition.

Since a Genetic Algorithm can only produce melodies as good as the knowledge encoded in its fitness function, the design of the fitness function is a critical part in the process of developing a GA for Music Composition.

Abbildung in dieser Leseprobe nicht enthalten

Figure 16: A schematic representation of a GA for Music Composition (Towsey et al., 2001)

Andrew Gartland-Jones and Peter Copley (2003) name two basic types of fitness function, or critic (as the fitness function is sometimes called in the context of Music Composition). These are:

- Use a human critic to make the selection – an interactive Genetic Algorithm (IGA)
- Automatic fitness assessment (AFA)

As we have heard in the previous chapters, music is following certain rules. A big part of composition is “hard work” and inherently algorithmic whereas only a small part is considered to be “genius”.

So using a rule-based, automated fitness function will definitely work. But the disadvantage of this attempt is that the outcome will never be of a “genius” type. It will never be better than that of rule-based composition systems.

Only the human critic could overcome this situation. The human critic has no boundaries, except for personnel taste. The human critic is the only one, which could lead to “genius” type of music. Thus, many attempts have been made to use a human critic in order to evaluate the fitness of melodies.

But these attempts are facing one major problem: a human would have to objectively evaluate the fitness of about a thousand melodies, most of them which are not harmonically. This is a time consuming, not very pleasant task.

”…these methods are defeated by the mental stamina required of humans to objectively assess, possibly thousands of tunes over the course of many GA generations, the great majority of which will not be tuneful” (Towsey et al., 2001).

Towsey et al (2001) proposed a statistical based approach to deal with this situation.

They analyzed a library of melodies and evaluated the question: “are there any quantitative features or melodic properties that can help to define a good melody?” They found 21 quantitative features to be relevant in order to define a good melody. These features involved pitch, tonality, melodic contour, rhythm and repeated patterns or motifs.

Towsey et al conclude as followed:

”The (normalised) quantitative melodic features we have described above were developed based on rules of best practice in melodic writing as taught to students of melody. Some of the rules are vague heuristics at best, such as, there should be variety of pitch, rhythm and contour. Analysis of our library of melodies has helped to put uite strong quantitative constraints on some of these vague heuristics and this is helpful in the attempt to construct a GA fitness function. For example, melodies whose values for the features shown in Table 1 are more than two standard deviations from the mean, would receive a low fitness rating.”

In my opinion Towsey et al did not reach their goal to overcome the problems regarding fitness functions.

They used statistics and analyzed existing musical material. They examined which features have how much influence to make a good melody. These features are based on rules in melodic writing.

Again, we have rules and statistics, so the approach is a sophisticated automatic fitness assessment approach, based on statistics and rules. It will produce good, sophisticated music, but it will not generate the “genius” type of music.

Chapter 5 Artificial Intelligence Music Experiments

Objectives:

- To describe the basics of AIME, a “Proof of Concept” application for Music Composition

- To give a brief introduction to MIDI

:

5 Artificial Intelligence Music Experiments

AIME – the short form for “Artificial Intelligence Music Experiments” is a computer program. It is used to demonstrate various concepts for Music Composition, as described in this report. At the moment these are: Markov chains, Artificial Neural Networks and Expert Systems.

AIME is a prototype application. Its only purpose is to evaluate the outcome of my literature research: Is composition using AI Algorithms really possible, not only in theory, but also in practice?

5.1 The Development Environment

The software is written in C# and targets the .NET platform. Why did I choose C# and .NET? At the beginning of my project I was evaluating the following Platforms and languages: C++, C#, Java, Prolog, VB, VB.NET and Mathlab.

The evaluation criteria were:

- the platform must have powerful, easy to use, MIDI support
- there must be a Neural Network library available
- the platform must allow for rapid prototyping

C# and Java were the platforms which passed every evaluation criteria. C# had more powerful MIDI support (thanks to Matt Paton, who developed a powerful MIDI Library). I was able to code a program for reading, writing and playing MIDI files in less than 15 minutes. The same goes for the Neural Network libraries available. Thus I choose C#.

5.2 AIME – technical overview

The following diagram shows an overview of AIME’s components. The purpose of each component is explained in the following sections.

Abbildung in dieser Leseprobe nicht enthalten

Figure 17: Technical Overview of AIME

5.3 AIME - Import existing music

AIME has a module to import existing Music. The input file format is MIDI. AIME reads the MIDI Files, scans it for “Note On” and “Note Off” events and stores these events in a database. All other events are discarded. For simplicity the AIME imports only the pitches and the velocity of the notes, not their duration. Figure 18 shows a screen shot of AIME’s Midi import module.

Abbildung in dieser Leseprobe nicht enthalten

Figure 18: The user interface of AIME’s Midi Import module

5.4 AIME - Composing using Markov chains

(i) stage one, build the transition matrix

The transition matrix process works as described in section 4.1.1 (Markov chains). But there is one minor difference. AIME does not directly store probabilities in its transition matrix. AIME scans the training data and builds up a statistic table, as shown in Figure 19.

Abbildung in dieser Leseprobe nicht enthalten

Figure 19: A transition table as used in AIME

AIME interprets this table as followed: The note with the midinumber 40 (column midinumber = 40) is appearing 109 times in the training data. 5 times it is followed by the note with the midinumber 36 (column M36). Three times it is followed by the note with the midinumber 38 (column M38), and so on. AIME’s composition algorithm uses this data to predict the next note from a given previous note. It does so using probabilities.

(ii) Stage two, the composition process

The composition process in AIME is straight forward:

The user chooses a sequence of notes from the training set as “start values”.

AIME walks through the resulting Markov chain and immediately plays the composition. Additionally AIME stores the composition in form of a MIDI File (default location: c:\output.mid). Figure 20 show a screen shot of AIME’s Markov chain composition module.

Abbildung in dieser Leseprobe nicht enthalten

Figure 20: A screen shot of AIME’s Markov chain composition module

5.5 AIME – ANN composition

AIME’s ANN composition process works exactly as described in section 4.3 - “Music Composition using Neural Networks”. The same approach has been used by me and a colleague in our BluesSoloist project (Herfort and Rehberger, 2003). The composition process consists of two stages: creating the training patterns and do the actual composing.

(i) Stage 1: create training patterns

The ANN learns to predict the next note, based on a set of previous notes. The previous notes are the input for the ANN. The next note represents its desired output. In order to be able to train the ANN, I had to create training patterns. For this purpose I used the Access and VBA. I reused. Actually, I reused the BluesSoloist components to do so.

Abbildung in dieser Leseprobe nicht enthalten

Figure 21: ANN training patterns

Figure 21 illustrates some sample ANN training patterns. The columns note1, note1, note3 and note4 represent the input vector to the Artificial Neural Network. The column next note represents the desired output.

(ii) Stage 2: compose using ANNs

The composition process in AIME consists of two stages:

- Train the artificial Neural Network
- Compose

During the training process AIME reads the input vectors, calculates the desired output and modifies the connection weight through Backpropagation. The composition process, again, is straight forward. The network is feed with existing sequences of notes (taken from the training data). Then it is calculating the next note. This next note then is fed back to the input layer, thus serving as a previous note for the next iteration.

Abbildung in dieser Leseprobe nicht enthalten

Figure 22: A screen shot of AIME's ANN composition module

Abbildung in dieser Leseprobe nicht enthalten

Figure 23: a screen shot of AIME’s ANN configuration options

5.6 AIME – Expert System composition

AIME’s BluesSoloist module is a basic rule-based composition system, which is capable of composing Blues accompaniments. Though this module shows that rule-based Music Composition is working, its outcome is not very sophisticated. Since the rule base is limited, all the compositions sound more or less alike. But the system clearly demonstrates that rule-based composition is possible.

The BluesSoloist module works with Expert System concepts, but it does not have a separate inference engine. Neither does it have a separate knowledgebase. The Inference engine and the knowledge are spread between AIME’s database and the source code. The system has stored a corpus of accompaniment measures in its database. According to the rules of 12-bar Blues, AIME synthesizes these measures together and forms a blues accompaniment.

Chapter 6 Evaluate the outcome of the literature research

Objectives:

- To evaluate the outcome of the literature research using AIME.

6 Experiments with AIME

In order to evaluate the outcome of the literature research, I did some experiments with AIME. These experiments and their results are explained in this section. The music which was composed during these experiments can be found on the appendix-cd.

6.1 Experiment 1: Automated composition using Markov chains

Abbildung in dieser Leseprobe nicht enthalten

Table 5: Experiment 1: Automated composition using Markov chains

6.2 Experiment 2: Automated composition using Expert systems

Abbildung in dieser Leseprobe nicht enthalten

Table 6: Experiment 2: Automated composition using Expert Systems

6.3 Experiment 3: Automated composition using Artificial Neural Networks

Abbildung in dieser Leseprobe nicht enthalten

Table 7: Experiment 3: Automated composition using Artificial Neural Networks

Chapter 7 the Conclusion

7 Conclusion

As stated in the introduction, it is the purpose of this work to examine if the process of composition is, at least partly, algorithmic. To do so, I hypothesized as followed:

- There should be a strong affinity between music and mathematics.
- It should be possible to find algorithmically aspects in the “human composition process”.

In Chapter 2 “The relationship between Mathematics and Music” the affinity between mathematics and music was examined. The outcome of this chapter leads to the conclusion that there is a strong affinity between mathematics and music and that this affinity is proven.

In Chapter 3 “The human composition process” I was able to explain some algorithmically aspects found in the human composition process. The human composition process is based to a great amount on “hard work” and to a very little amount on “genius” which is inherently algorithmic. Further the chapter about Expert Systems has shown that music is following certain rules.

These facts, based on an intense literature research, lead me to the conclusion that it should be possible to implement algorithms and build computer based composition systems.

The outcome of the literature research was proven practically through implementing AIME (Artificial Intelligence Music Experiments). My Experiments with AIME clearly support the outcome of the literature research

Thus, automated Composition using AI Algorithms is possible and promising!

However: Markov chains, Expert Systems, Grammars and Neural Networks face, more or less, one common problem: They cover the “hard work” part of composition very well, but they do not cover the “genius” part. Everything they produce is a (very sophisticated) recombination of existing music.

Genetic Algorithms are a way out of this dilemma, but only if a way is found which effectively integrates human critics in the fitness evaluation process. To the best of my knowledge this has not been accomplished so far. Thus this would be a good starting point for further research.

In order to get best results, combining the various methodologies seems to be the most promising approach.

Chapter 8 Critical Evaluation

Objectives:

- Compare the Aims of the project with the actual outcome

- Is this work significant?

- To state the “Lessons Learned”

8 Critical Evaluation

8.1 Did I reach the aims and objectives as stated in the proposal?

“During a research and development project one does not exactly know in which direction the project will go while it is going on. It may happen that a specific idea is not working as expected and so this idea is leading to a dead end, or something shows up to work better than expected, leading to new and better ideas.” – Leopold Rehberger

I have stated the above message in my project proposal and it turned out to come true. The following tables give an overview about the planned, modified and finally reached aims and deliverables of this project

Abbildung in dieser Leseprobe nicht enthalten

Table 8: Planned aims and objectives of the project

Abbildung in dieser Leseprobe nicht enthalten

Table 9: Additional aims and objectives

Abbildung in dieser Leseprobe nicht enthalten

Table 10: Planned outcomes and deliverables

Abbildung in dieser Leseprobe nicht enthalten

Table 11: Additional outcomes and deliverables

8.2 Is my work significant?

I think it is. It is the only AI centred work I am aware of, which does not only explain how automated composition using AI algorithms is working, but also tries to explain why automated composition may be a promising approach. It is promising because there is a strong affinity between mathematics and music and because the human composition process is inherently algorithmic and music is following certain rules.

8.3 Personal Lessons Learned

Of course I learned a lot about the theory of Automated Composition and Artificial Intelligence while reading books and articles. But it was the contact to the people like David Cope, Bill Pirkle, Matt Paton and Alexey Vasilyev which gave me the “real insights” to Automated Composition using AI methodologies.

Thanks to Christoph Ruegg, I learned a lot about implementing ANNs. Together we were able to improve the quality of his Neural Network Library. Additionally I improved my skills in programming C#.

Further I was learning very much about music theory and the process of music composition. I also never was aware, that there is such a close affinity between mathematics and music.

Reference List

BEER, M. (1998) How do mathematics and music relate to each other. [Internet]

Available from: http://perso.unifr.ch/michael.beer/mathandmusic.pdf [Accessed 03/28/2004]

BOYD-BRENT, J. (2003) Pythagoras: Music and Space. [Internet]

Available from: http://www.aboutscotland.com/harmony/prop.html [Accessed 03/28/2004]

BRITANNICA (2004a) Feigenbaum, Edward Albert. [Internet]

Available from: Encyclopaedia Britannica

http://www.britannica.com/eb/article?eu=369727 [Accessed 02/04/2004]

BRITANNICA (2004b) Inversion. [Internet]

Available from: Encyclopaedia Britannica

http://www.britannica.com/eb/article?eu=43625 [Accessed 01/12/2004]

BRITANNICA (2004c) Mathematics. [Internet]

Available from: Encyclopaedia Britannica

http://www.britannica.com/eb/article?eu=52650&tocid=0&query=mathematics&ct= [Accessed 03/28/2004]

BRITANNICA (2004d) Mendel, Gregor. [Internet]

Available from: http://www.britannica.com/eb/article?eu=53267&tocid=0&query=gregor%20mendel&ct= [Accessed 04/20/2004]

BRITANNICA (2004e) Musical Composition. [Internet]

Available from: Encyclopaedia Britannica

http://www.britannica.com/eb/article?query=composition&ct=&eu=118775&tocid=0#0.toc [Accessed 04/19/2004]

BUCKLEY, J. M. (1999 - 2003) Natural Selection. [Internet]

Available from: http://regentsprep.org/Regents/biology/units/evolution/selection.cfm [Accessed 04/05/2004]

CARTER, P. (2004) Brain Enigma. [Internet]

Available from: http://www.knowl.demon.co.uk/page44.html [Accessed 02/26/2004]

CHOMSKY, N. (1965) Aspects of the Theory of Syntax. MIT Press

COPE, D. (1997) Techniques of the Contemporary Composer. Schirmer Thomson Learning

CORTINA, T. (2003a) Computer Music Composition using Grammars. [Internet]

Available from: http://www.cs.sunysb.edu/~cse393/CSE393unit8.pdf [Accessed 02/13/2004]

CORTINA, T. (2003b) Computer Music Composition using Markov chains. [Internet]

Available from: http://www.cs.sunysb.edu/~cse393/CSE393unit7.pdf [Accessed 02/13/2004]

DARWIN, C. (1859) The Origin of Species. Wordsworth Editions Limited Cumberland House

ECK, D. & SCHMIDHUBER, J. (2002) A First Look at Music Composition using LSTM Recurrent Neural Networks. [Internet]

Available from: http://www.idsia.ch/~juergen/blues/IDSIA-07-02.pdf [Accessed 02/16/2004]

ELKIES, N. D. (1995) Bartok and golden ratio. [News Group]

Available from: http://www.math.niu.edu/~rusin/uses-math/music/music-fibon

ENGELMORE, R. S. & FEIGENBAUM, E. (1993) Expert Systems and Artificial Intelligence. [Internet]

Available from: http://www.wtec.org/loyola/kb/c1_s1.htm [Accessed 02/04(2004]

EXPERTISE2GO.COM (2001) Representing knowledge in rule-based systems. [Internet]

Available from: http://www.expertise2go.com/webesie/tutorials/esintro/ESIntro15.htm [Accessed 02/07/2004]

FLAKE, G. W. (2000) The Computational Beauty of Nature. MIT Press

FREUDENRICH, C. C. (2003) How Your Brain Works. [Internet]

Available from: http://science.howstuffworks.com/brain.htm/printable [Accessed 02/19/2004]

GARLAND, T. H. & KAHN, C. V. (1995) Math and Music - Harmonious Connections. Dale Seymour Publications

GARTLAND-JONES, A. & COPLEY, P. (2003) The Suitability of Genetic Algorithms for

Musical Composition. Contemporary Music Review, 22 , 43-55.

GLATT, J. (unknown) What is MIDI? [Internet]

Available from: http://www.borg.com/~jglatt/tutr/whatmidi.htm [Accessed 04/22/2004]

GUYAGULAR, B. (unknown) Genetic Algorithm. [Internet]

Available from: http://pangea.stanford.edu/~baris/professional/theoryga.html [Accessed 04/06/2004]

HERFORT, G. & REHBERGER, L. (2003) Blues Soloist. Vienna, University of Derby in Austria.

HOLLAND, J. H. (unknown) Genetic Algorithms - Computer programs that "evolve in ways that resemble natural selection can solve complex problems even their creators do not fully understand. [Internet]

Available from: http://www.arch.columbia.edu/DDL/cad/A4513/S2001/r7/ [Accessed 04/20/2004]

JACOB, B. L. (1998) Algorithmic Composition as a model of creativity. [Internet]

Available from: http://www.enee.umd.edu/~blj/papers/OrganizedSound.pdf [Accessed 12/23/2003]

KANELLOPOULOS, I. (1995) USE OF NEURAL NETWORKS FOR IMPROVING SATELLITE IMAGE PROCESSING TECHNIQUES FOR LAND COVER/LAND USE CLASSIFICATION. [Internet]

Available from: http://europa.eu.int/en/comm/eurostat/research/supcom.95/16/result/final-report.html [Accessed 03/06/2004]

KNOWLES, F. (unknown) Natural Selection. [Internet]

Available from: http://www.english.ilstu.edu/351students/flknowl/flk3/museum/four.html [Accessed 04/06/2004]

KRUSE, P. M. (2002) Einfuehrung in MIDI. [Internet]

Available from: http://www.cs.uni-magdeburg.de/~pkruse/stud/sem03/computermusik/midi.pdf [Accessed 04/22/2004]

LERDAHL, F. & JACKENDOFF, R. (1983) A Generative Theory of Tonal Music. MIT Press

MCALPINE, K. (1999) Applications of Dynamical Systems to Music Composition. Department of Mathematics. Glasgow, University of Glasgow.

MCCORMACK, J. (2000) Grammar Based Music Composition. [Internet]

Available from: http://www.csse.monash.edu.au/~jonmc/resources/L-systemsMusic.pdf [Accessed 01/06/2004]

MCGRAW, K. L. & HARBISON-BRIGGS, K. (1989) Knowledge Acquisition, Principles and Guidlines. [Internet]

Available from: http://www.scism.sbu.ac.uk/inmandw/review/knowacq/review/rev15561.html#kw68 [Accessed 07/02/2004]

MIRANDA, E. R. (2001) Composing Music with Computers. Music Technology Series, 2. Focal Press

MOLNAR, P. (2001) Neural Networks. [Internet]

Available from: http://www.cis.cau.edu/675/z/NeuralNetworks-HO.pdf [Accessed 02/19/2004]

PATON, M. (2003) Composing Music with Markov Chains. Glasgow Caledonian University.

PIRKLE, W. L. (2001) Expert System Composes Music: AI Creativity. PCAI Magazine, 15.

PUENTE, A. O. D. L., ALFONSO, R. S. & MORENO, M. A. (2002) Automatic composition of music by means of Grammatical Evolution. [Internet]

Available from: http://www.ii.uam.es/~alfonsec/docs/apl2002b.pdf [Accessed 12/23/2003]

SABINE, D. (2000) Mathematics and Music. [Internet]

Available from: http://www.davesabine.com/music/mathematics.asp?action=pythagoras [Accessed 03/28/2004]

SCHILLINGER, J. (1948) The Mathematical Basis of the Arts. New York, Philosophical Library

SILVA, P. D. (2003) David Cope and Experiments in Musical Intelligence. [Internet]

Available from: http://www.spectrumpress.com/da-silva-david-cope-and-emi.pdf [Accessed 01/15/2004]

SWIFT, A. (unknown) An Introduction to MIDI. [Internet]

Available from: http://www.doc.ic.ac.uk/~nd/surprise_97/journal/vol1/aps2/ [Accessed 02/22/2004]

THOMAS, J. (unknown) Genetic Algorithm. [Internet]

Available from: http://chaos.phy.ohiou.edu/~thomas/complex_frame.html [Accessed 04/21/2004]

TODD, P. M. (1989) A connectionist approach to algorithmic composition. Computer Music Journal, 4 , 27-43.

TOGA, A. W. (2004) Brain. [Internet]

Available from: http://encarta.msn.com/text_761555359___0/Brain.html [Accessed 02/19/2004]

TOWSEY, M., BROWN, A., WRIGHT, S. & DIEDERICH, J. (2001) Towards Melodic Extension Using Genetic Algorithms. [Internet]

Available from: Towards Melodic Extension Using Genetic Algorithms [Accessed 04/21/2004]

UZO-OKORO, E. (2002) The Relationship Between Math and Music. [Internet]

Available from: http://www.montgomerycollege.edu/Departments/StudentJournal/volume1/Ezinne_Uzo_Okoro.pdf [Accessed 03/28/2004]

WAERDEN, B. L. V. D. (1988) Science Avakening I: Egyptian, Babylonean, and Greek Mathematics. Princeton Junction, NJ,

WALE, J. D. (1997) A Brief Introduciton to MIDI. [Internet]

Available from: http://www.j-omega.co.uk/midi.html [Accessed 04/22/2004]

WEBOPEDIA (2004) Neural Network. [Internet]

Available from: http://www.pcwebopaedia.com/TERM/N/neural_network.htm [Accessed 02/18/2004]

WHATIS.COM (2001) Expert System. [Internet]

Available from: TechTarget Network: Whatis.com

http://whatis.techtarget.com/definition/0,,sid9_gci212087,00.html [Accessed 04/02/2004]

WIKIPEDIA (2003a) Andrey Markov. [Internet]

Available from: Wikipedia: The Free Encyclopedia http://en2.wikipedia.org/wiki/Andrei_Andreevich_Markov [Accessed 01/08/2004]

WIKIPEDIA (2003b) Semantics. [Internet]

Available from: Wikipedia: The Free Encyclopedia

http://en.wikipedia.org/wiki/Semantics [Accessed 01/08/2004]

WIKIPEDIA (2004a) Genetic Algorithm. [Internet]

Available from: http://en.wikipedia.org/wiki/Genetic_algorithm [Accessed 04/20/2004]

WIKIPEDIA (2004b) Inversion.

Available from: Wikipedia: The Free Encyclopedia

http://en.wikipedia.org/wiki/Inversion_(music) [Accessed 01/12/2004]

WIKIPEDIA (2004c) Transposition. [Internet]

Available from: Wikipedia: The Free Encyclopedia

http://en.wikipedia.org/wiki/Transposition [Accessed 01/12/2004]

WOEBEKE, C. (2004) Pythagoras and the Music of the Sphere. [Internet]

Available from: http://www.myastrologybook.com/Pythagoras-music-of-the-spheres.htm [Accessed 03/28/2004]

ZELL, A. (1997) Simulation neuronaler Netze. Muenchen, Oldenbourg Verlag

Appendix A – Project proposal and project management methodology

Abbildung in dieser Leseprobe nicht enthalten

Appendix B – Project Plan and Status Documents

(i) Project Plan Iteration 1

Abbildung in dieser Leseprobe nicht enthalten

Figure 24: Project Plan, Iteration 1

This plan may be viewed on the web on http://rehberger.sharepoint.bcentral.com/fyp

(ii) Project Plan Iteration 2

Abbildung in dieser Leseprobe nicht enthalten

Figure 25: Project Plan, Iteration 2

This plan may be viewed on the web on http://rehberger.sharepoint.bcentral.com/fyp

(iii) Status Documents

All Project Management and Status Documents can be found on the web on:

http://rehberger.sharepoint.bcentral.com/fyp.

This will include:

- Project Plan
- Status Documents
- Project Logs
- Activity Lists
- An Issue List

Appendix C – Project Financials and Effort

(i) Financials

Abbildung in dieser Leseprobe nicht enthalten

Table 12: Project Financials

(ii) Effort

Abbildung in dieser Leseprobe nicht enthalten

Table 13: Project Effort

A detailed activity log is available on: http://rehberger.sharepoint.bcentral.com/fyp

Appendix D – Project Log

Abbildung in dieser Leseprobe nicht enthalten

Figure 26: Project Log

A detailed project log is available on: http://rehberger.sharepoint.bcentral.com/fyp

Appendix E – David Cope and EMI

An analysis of existing automated composition systems was not in the scope of this project.

But there is one system which I want to mention, because I think it is the most sophisticated automated composition system available at the moment. Further its author, David Cope, is one of the major key players when it comes to automated composition. The system I am talking about is called EMI. EMI stands for Experiments in Musical Intelligence.

EMI is capable to compose in the style of other composers. E.g. it can be trained to compose like Mozart, Haydn, Bach or anyone else. EMI first analyzes some existing music, e.g. from Bach. Through sophisticated “Data Mining” algorithms it extracts the “essence” of musical compositions. EMI extracts patterns which work on the “micro level” of music and structures which work on the “macro level”. If David trains EMI with pieces of Mozart, it will compose in the style of Mozart. If he trains EMI with pieces of Bach, it will compose like Bach.

”The music, in effect, inherits the voice-leading rule of the works upon which it bases its replications” - David Cope

During my research I read an article about David’s EMI System. EMI immediately got my attention so I bought David’s books “Virtual Music - Computer Synthesis of Musical Style” and „Computers and style”. The first thing I did was listening to the music on the CD. I was really surprised (if not to say emotionally moved) when I was listening to the songs which David produced using EMI.

I instantly thought that it would be really difficult or almost impossible for an average listener (as I am one) to judge if a composition was composed by EMI or a human composer.

I decided to do a little test. I put three pieces of music on a website. One composed by EMI in the style of Johann Sebastian Bach, two composed by Johann Sebastian Bach himself. All of them were fugues. Then I asked friends and colleagues to judge the compositions. Which one is composed by a computer program?

I got eight answers. Only three of the eight identified the EMI composition as “computer generated”.

Thanks to David Cope and Spectrum Press for giving me the permission to use their material for this little “survey”.

Appendix F – A brief introduction to MIDI

A brief introduction to MIDI

When writing composition software, one of the first decisions to make is, in which format to store the compositions (output). And the second question which arises is how do I get some training data into my system?

The answer to these questions is: use MIDI. There are thousands of MIDI Files available on the internet. So if the software is able to generate training data out of MIDI Files, question 2 is answered.

If the software is able to save its compositions in MIDI Format, no special player module is needed. There are a lot of media players available on various platforms. Each Operating System has its player preinstalled. E.G. Windows Media Player is able to play MIDI Files.

If you use MIDI as your output format, everyone equipped with a computer will be immediately able to playback the generated compositions. Further, there are many professional music software packages available which are able to handle MIDI files. So it will be immediately possible to

That is, why I choose to use MIDI in AIDA.

What is MIDI?

(i) What was the initial need for MIDI?

Musicians often wanted to be able to manage electronic instruments remotely or automatically.

Remote control is “when a musician plays some music one musical instrument, and additionally that instrument controls (one or more) other musical instruments” (Glatt, unknown). Consider a Keyboarder who has five Keyboards available. He wants to control all five Keyboards using one “Master Keyboard”, thus remote control the other four.

Automatic control is “when the musician uses some other device to play a musical instrument as if another musician were playing it. (Such a device is referred to as a Sequencer)” (Glatt, unknown).

To accomplish remote control and automatic control musicians needed a way to interconnect their instruments. They searched for a manufacturer independent standard, which was not tied to one particular type of instrument. To satisfy this need, some music manufacturers worked together in mid 1983 and created MIDI, which stands for Musical Instrument Digital Interface (Glatt, unknown)

There are many aspects to MIDI, but essentially it is concerned with transferring information about which notes are being played from a control device (such as a keyboard, sequencer or computer) to a sound generator (such as a synthesiser, organ, piano or any other musical instrument capable of being operated by electrical signals)” (Wale, 1997)

(ii) How does MIDI work?

Much in the same way as two computers communicate via serial interfaces, two (or more) music instruments may communicate via their MIDI Interfaces. They do so in exchanging standardized MIDI messages. There are many different messages, each of which is corresponding to a specific musical action. The most basic messages are “Note On” and “Note Off”.

Consider a piano player pressing and holding a key on a piano, thus start playing a note. This is the musical equivalent of the “Note On” Message. After some time (length of the note to play) the piano player releases the key on the piano, thus stop playing the note. This is the musical equivalent of the “Note Off” message.

Whereas in standard notation a single note is represented with exactly one symbol, in MIDI systems, the activation of a particular note and the release of the same note are considered as two separate events. This is an important difference when it comes to implementation.

Figure 27 shows some notes in standard musical notation and their equivalent sequence of midi messages.

Abbildung in dieser Leseprobe nicht enthalten

Figure 27: Notes in standard notation and their equivalent as a sequence of midi events

(iii) A basic MIDI setup

One of the most common ways of entering the world of MIDI is using two keyboards. This enables two different sounds to be played at the same time, generating a richer sound. The first step is to connect the keyboards together. This is done using MIDI cable which is a standard 5 pin DIN type connector. The user can now play on the master keyboard as normal. Every key pressed will make the slave keyboard sound (Swift, unknown).

This type of setup is shown in Figure 28. It does not use the power of MIDI to its full potential, but it is well suited to demonstrate the basics of MIDI.

Abbildung in dieser Leseprobe nicht enthalten

Figure 28: A basic MIDI setup

MIDI note numbers

In MIDI, all notes are represented as numbers. The note with the number 60 is the “middle C”.

Abbildung in dieser Leseprobe nicht enthalten

Figure 29: The MIDI note numbers (Kruse, 2002)

MIDI files

During the 80s Music and Computer companies began to realize the potential of MIDI in conjunction with the power of computers. As a result Roland (a keyboard manufacturer) developed the first MIDI interface for an IBM PC.

Having the power of a PC the possibilities of MIDI could be extended. Music instruments at those times did not have any “data store”, but computers were able to store and manipulate data. Thus, on computers it was possible to store MIDI sequences (for later use or manipulation).
Therefore the MIDI file format was developed.

Content of the Appendix-CD Rom

- This report
- The interim report
- Compositions composed by AIME
- AIME
- A copy of all online references

[...]

Details

Seiten
117
Jahr
2004
Dateigröße
1.4 MB
Sprache
Englisch
Katalognummer
v108991
Note
A (1,0)
Schlagworte
Composing

Autor

Teilen

Zurück

Titel: Composing music using AI algorithms