Composers' Forum

Music Composers Unite!

I'm writing a computer program to generate music, using the rules of counterpoint.

This is an example of first-species counterpoint in a major key.

Please let me know if it sounds as it should, and if not what's wrong with it.

Views: 77


Reply to This

Replies to This Discussion

Interesting subject but couldn't load the file.


I've replaced the midi file with an mp3 file, which is downloading on my computer (PC using Firefox).

I don't mean to discourage you, but rather empower you.. But it seems quite obvious that you have very little composing

experience.  What would be beneficial, it seems to me, would be taking a whole course on counterpoint and theory, with its attendant Many exercises to become familiar with the many ways these 'rules' can be applied to music..  Otherwise, it can feel like stabbing in the dark.. Are you able to play this submission on a keyboard?  (Rudimentary knowledge of the keyboard

could be very helpful in this endeavor..   You can disregard this comment if you feel no traction with the ideas offered.

Good Luck!

Hi James -

I don't know what your background is but I think we are willing to try and help with what seems like a difficult project as Gregorio has pointed out.  As you already realize midi files are pretty useless on their own, so I'm glad you have given us an mp3.

Here are a couple of free resources that might help.

Are there any changes that are more specific than what has already been suggested that can help me to improve the program?

Hi James -

You haven't defined the cantus firmus. You haven't followed the rules for writing a proper cantus firmus, which ever line it is. That's just the beginning, there's a bunch of rules for this.  That's why we suggested more study of the basics involved here.

Here's a list of the rules I've used. Either this list isn't complete, or they aren't properly realized in the program.


(p27) Each harmony must be a consonance.

(W) Can't have harmonic intervals greater than a tenth between two adjacent parts (ie more than 9 scale steps).

Thus must be 0, 3-4, 7-9, 12, or 15-16.

(W) Can't have unisons (zero) except at the beginning and end.

(p28) More imperfect than perfect consonances must be used.

(W) Can't use the same interval more than three times in a row [interpret this in terms of scale steps for now].


(Wikipedia) Acceptable movements are the perfect fourth, fifth, and octave, as well as the major and minor second, major and minor third, and ascending minor sixth [and unison]: 0-5, 7, +8, 12.

(W) An ascending minor sixth (+8 semitones) must be immediately followed by motion downwards.

(W) If have two skips in the same direction, the second interval must be smaller than the first [I interpret this to mean scale steps ie m3 is not smaller than M3]

(W) If have two skips in the same direction, the first and third note may not form a dissonance.

(W) If have two skips in the same direction, the interval between the first and third may not be bigger than an octave.

(W) Can't have more than two skips in the same direction.

(W) Note, and note two ahead of it, can't form a tritone.

(W) Any number of notes in a single direction can't form a seventh.


(p29) Second-last note of cantus firmus must be the second degree of the scale.

(p29) Second-last note of counterpoint must be seventh degree of the scale, and is raised if necessary.

(p29) Second-last bar must form a major sixth if the cantus firmus is the lower part, or a minor third if it is the upper part (didn't do, but made sure is consonance).

First and last note of cantus firmus must be tonic (wasn't sure about this, but confirmed from book).

(p28) Beginning and end must both be perfect consonances.

(W) If end on a perfect fifth, cantus firmus must be lower part.


(p22) Two parts can't move by direct motion (ie in the same direction) into a perfect consonance (ie unison, perfect fifth or octave--0, 7 or 12 semitones).

(W) Majority of movements should be contrary motion (ie both parts move, in opposite directions).

(W) Can't have parallel fifths (two consecutive intervals which are both 7 semitones apart) or parallel octaves. Note that this isn't entirely covered by rule saying no direct motion into perfect consonances, because can have perfect consonance formed when one or both parts doesn't move.

(W) Two parts can't move by similar motion by skip. [this means can't have two parts moving in same direction, with different intervals, and both be skips. For purposes of program, count m3 and M3 eg as same interval ie 'interval' defined only by number of scale steps.]

The list isn't complete. If you are doing this for a class, you've got the program to print a score that looks like counterpoint, maybe that's good enough?

If you really care about counterpoint you might consider following our suggestions.

Reply to Discussion


Sign up info

Read before you sign up to find out what the requirements are!


© 2021   Created by Gav Brown.   Powered by

Badges  |  Report an Issue  |  Terms of Service