Score

A Score object contains a set of Part objects.  Score contents (parts, phrases, notes) are algorithmically generated, or read from a standard MIDI file (see Read).  Scores can be written to standard MIDI files (see Write).

Here are functions used to create scores.  Each of these functions creates a new Score object, so you need to save it in a variable (or other memory location).

Function Description
Score() Creates an empty score.
Score(title) Creates an empty score with the specified title (a string).
Score(tempo) Creates an empty score with the specified tempo (in beats-per-minute, e.g., 120.0).
Score(title, tempo) Creates an empty score with the specified title (a string), and with the specified tempo (in beats-per-minute, e.g., 120.0).
Score(part) Creates a score containing the specified part.

You can create a score as follows:

s = Score("Morning glory", 135.0)

This creates a score with the descriptive title “Morning glory”, with a tempo of 135 beats per minute.

Once a Score s has been created, the following functions are available:

 

Function Description
s.addPart(part) Add a part to this score.
s.addPartList(listOfParts) Adds the specified parts (a list) to the score.
s.copy() Returns a new score with the same parts and attributes as score.  This is used to create a copy to be modified, while the original score is not affected.
s.empty() Removes all parts from this score.
s.getDenominator() Returns the time signature denominator for this score.
s.getEndTime() Returns the score’s end time (a float).
s.getKeyQuality() Returns the score’s key quality (0 is Major, 1 is minor).
s.getKeySignature() Returns the score’s key signature (as an integer).  Zero (0) means the score is in the key of C.  A positive (+) integer indicates the number of sharps, whereas a negative (–) integer indicates the number of flats.
s.getNumerator() Returns the time signature numerator for this score.
s.getPartList() Returns the score’s parts (a list).
s.getSize() Returns the number of parts in this score.
s.getTempo() Returns the score’s tempo (a float).
s.getTitle() Returns the score’s title (a string).
s.getVolume() Returns the score’s volume (0 – 127).
s.setDenominator(denominator) Sets the time signature denominator for this score.
s.setKeyQuality(quality) Sets the score’s key quality (0 is Major, 1 is minor).
s.setKeySignature(signature) Sets the score’s key signature (as an integer).  Zero (0) means the score is in the key of C.  A positive (+) integer indicates the number of sharps, whereas a negative (–) integer indicates the number of flats.
s.setNumerator(numerator) Sets the time signature’s numerator for this score.
s.setPan(pan) Sets the pan position for all notes in this score (0.0 – 1.0).
s.setTempo(tempo) Sets the score’s tempo (in beats-per-minute, e.g., 120.0).
s.setTimeSignature(num, den) Specifies the score’s time signature (i.e., num / den).
s.setTitle(title) Give the part a new title (a string).