Bill Manaris : Fall 2010 / CSCI 180 Homework 3

Assigned Date: Wednesday, Nov. 3, 2010
Due Date: Friday, Nov. 12, 2010
Due Time: 8:45am

Last modified on November 07, 2010, at 08:04 AM (see updates)

This is a pair-programming assignment (i.e., you may work with one partner). You may discuss the assignment only with your partner or the instructor.


This assignment focuses on:


Johann Sebastian Bach (1685-1750) explored the connection between mathematics and music by creating a variety of compositions that are especially pleasing to those with a mathematical inclination. His fugues and canons are particularly mathematical in nature. Bach also played clever games with music. For example, a sheet of music with his "Crab Canon" on it can literally be turned upside down and remain unchanged. M. C. Escher had a special affinity for Bach, which he wrote about on more than one occasion. "In my periods of weakness and spiritual emptiness and lethargy, I reach out to Bach's music to revive and fire my desire for creativity." (quoted from Profiles in math & art)


Find a soggetto (theme) from a non-canonic piece of music. Create a canon in jMusic (using the soggetto and appropriate canonic devices, such as retrograde, inversion, augmentation, and/or diminution).

Note that not all melodic lines can be used as canon soggettos. Bach was an expert in inventing and discovering such subjects. One trick is to use melodies that mainly emphasize triadic pitches (pitches from the tonic triad). For example, think of the soggettos for "Row, Row your Boat" and "Frère Jacques".

Write a Jython program that generates a canon as described above.


Follow the Golden Rule of Style: "A program should be as easy for a human being to read and understand as it is for a computer to execute." [1]

In general, you should comment any variable, obscure statement, block of code, etc. you create.

Additionally, your code should always include opening comments as follows:

#   Author:     <Your Name(s)>
#   Email:      <Your email address(es)>
#   Class:      CSCI 180, Section 1
#   Assignment: HMWK2
#   Due Date:   <The assignment's due date>
#   Certification of Authenticity <remove one of the following>:     
#      I certify that this lab is entirely my own work.
#      I certify that this lab is my own work, but I received
#      some assistance from:  <Name(s)>
#   Purpose: <Provide a simple, yet complete description of the task being
#         performed by this program. It may be several sentences long.>


You will submit your assignment via WebCT. Be prepared to demo your music to the rest of the class. Your submission consists of:

  1. Your Python program. Give it a meaningful name.
  2. The MIDI file generated from your program.


Your grade will be based on how well you followed the above instructions, and the depth/quality of your work.


  1. Cooper, D. and Clancy, M. (1985) "Oh! Pascal", 2nd ed., W.W. Norton & Company, New York, p. 42.
(Printable View of