# Is this pseudoCode for composing a medieval song accurate/adequate?

I've created some pseudocode for some software that is supposed to compose music independently, given a specific musical time period. This particular algorithm is supposed to create a medieval song, help regarding how to make it more accurate to the medieval time period (circa. 500 to 1400).

I'm also going to put this on code review but I figured that this site would be better regarding the musical side of things ^_^

Set Time signature to 6:8

Set tempo to a random number between 60 and 75 bpm

Set dynamics interval (the amount of bars to wait until changing dynamics) to a random multiple of 2 between 4 and 12.

Set Dynamics to forte

Set number of bars to a random multiple of 4 between 16 and 32.

For each dynamic interval

Set the dynamics either one step louder (e.g. from forte to fortissimo) or one step quieter (e.g. from forte to mezzo forte).

Set key signature to any key signature whose sharps and flats are less than 4 (e.g. A major).

Create random chord sequence based on key signature (e.g. A, D, For the first bar:

``````Add a dotted minim with a random note of the chord (e.g. either A, C#, or E from A major).

Create a random pattern for half the bar (mostly either three quavers or a crotchet and a quaver) using random notes from the key signature.

Create another random pattern for the second half of the bar (preferably different from the first half)
``````

For the rest of the bars except for the last:

``````Add a dotted minim with a random note of the chord (e.g. either A, C#, or E from A major).

Create random notes using the same rhythm pattern for both halves of the first bar.
``````

For the last bar:

``````Add a dotted minim for each note of the final chord.
``````
• Why don't you try and listen for yourself? Commented Oct 5, 2015 at 9:36
• There is a name for this field of study: algorithmic composition. Look it up.
– user1044
Commented Oct 5, 2015 at 21:21

I'm not a programmer so I cannot say anything about the validity of the program but what I can say is that all of these parameters will not give you medieval music.

I usually just completely abstain from interacting with these types of questions because I do not want to build an atmosphere of opposition in my post on this site but I think I can make a meaningful contribution to this question.

What I will say is that I think you grossly underestimate the complexity of writing music. Ju8st to get to the level of writing a good 8 bar melody can take upwards of 5 - 6 years of quality instruction to achieve.

If a computer would be able to do this then it would almost have to posses some sort of artificial intelligence but let me leave it there and further delve into your question.

As I have mentioned before on this site modern Major and minor tonalities where not part of the Medieval music. It was an invention of the Baroque era. So unless your program does music in the church modes it is not really going to be medieval music.

Create random chord sequence based on key signature (e.g. A, D, For the first bar:...

Chords are definitely not chosen at random this is a poor way to choose chords.

Set Time signature to 6:8

Could you explain to me why exactly you think 6/8 would have to be chosen for Medieval music? This seems rather arbitrary.

Set number of bars to a random multiple of 4 between 16 and 32.

You would rather want multiple phrases of 8 bars. You would definitely not want 4 bar or 12 bar phrases.

Questions you would have to ask yourself is how are you going to teach the machine to write melodies? How are you going to teach the machine how to do rhythmical sequences? How are you going to get the machine to choose which part of the rhythm to make a sequence out of? How are you going to teach the machine to handle the issue of inversions? There exist a plethora of rules on how chordal inversions work.

In conclusion I think that all these problems I see on this sites in regards to reducing the making of music to some form of formula or program is that the people who do this have a fundamental lack of knowledge in regards to how music is created.

There is definite logical approach to good music creation. Nothing about this is random. The rules regarding melody can often be complicated. Chordal choosing has its own amount of rules that can also get complicated. You need a thorough understanding of the instrument you are writing for to know how the phrasing works and to know what notes the instrument can play.

And through it all even if you are able to teach all the nuances of all these rules to the machine how are you going to get the computer to feel emotions? How are you going to get the express emotions? How are you going to get the machine to write and tell stories trough the making of the music? Sterile, emotionless music is meaningless.

I do not think you would be able. You may get it to spout out a collection of notes but it would probably be far from music.

• Check out Philip K. Dick, "The Preserving Machine" Commented Oct 5, 2015 at 12:18
• I'll bet you could have a computer randomly create some convincing 12-tone compositions. That's mainly because those seem to be a bit random sounding when they are composed by humans. Commented Oct 5, 2015 at 12:44

I fear that you do not have sufficient musical background to achieve much with this.

Any such computer code would depend on your having listened to a great deal of music from the style period, and thoroughly understanding the rules that composers used to write music then. This means having studied all the relevant music theory and the relevant historical textbooks, and then trying to express those principles into code. This would be something that somebody with a master's degree or a Ph.D. in music composition might attempt after many years of study. It would be way beyond the skills of a musician such as myself.

As mentioned by Neil Meyer in his excellent answer, a lot of modern concepts in music did not exist in the Medieval period. They did not use the major or minor scales; they used the church modes. Key signatures had not been invented. They did not use chords or chord progressions per se. The concept of the time signature, and measures and bars, had not been invented. When you see medieval music written in modern notation, modern editors superimpose those elements onto the music to make it easier for modern musicians to read it, but the fact is that the composers in the medieval style period were not thinking in those terms and those ideas did not influence the music they wrote.

Polyphony and counterpoint were being invented and developed during this style period (leading to the Renaissance), and that is a difficult subject to learn. You would need an understanding of certain concepts including church modes, organum, discant, melisma, polyphony, clausulae, and rhythmic modes, and how they were used in that style period.

Historically, for medieval music, you would look to the work of Guido of Arezzo (992-1033) and Franco of Cologne (mid-1200s).

Finally, in any style period, there are many different kinds of music written for different purposes. Are you talking about church music, to be sung? Instrumental music for dancing? Sacred or secular motets? Music for strings, winds, brass, percussion and drums? Different styles of music popular in different nations and locations? There is no way to generalize and write one short piece of computer code that can cover the music made in many different nations across many hundreds of years.