Score

A Score contains a set of Parts.

The music library provides several functions to create musical scores.  It also provides several others to retrieve or modify existing scores.

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.

 

Below are functions used to retrieve and modify attributes of an existing Score object.  It is assumed that a score has already been created, for example, as follows:

 

 

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

 

Function Description
score.addPart(part) Add a part to this score.
score.addPartList(listOfParts) Adds the specified parts (a list) to the score.
score.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.
score.empty() Removes all parts from this score.
score.getDenominator() Returns the time signature denominator for this score.
score.getEndTime() Returns the score’s end time (a float).
score.getKeyQuality() Returns the score’s key quality (0 is Major, 1 is minor).
score.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.
score.getNumerator() Returns the time signature numerator for this score.
score.getPartList() Returns the score’s parts (a list).
score.getSize() Returns the number of parts in this score.
score.getTempo() Returns the score’s tempo (a float).
score.getTitle() Returns the score’s title (a string).
score.getVolume() Returns the score’s volume (0 – 127).
score.setDenominator(denominator) Sets the time signature denominator for this score.
score.setKeyQuality(quality) Sets the score’s key quality (0 is Major, 1 is minor).
score.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.
score.setNumerator(numerator) Sets the time signature’s numerator for this score.
score.setPan(pan) Sets the pan position for all notes in this score (0.0 – 1.0).
score.setTempo(tempo) Sets the score’s tempo (in beats-per-minute, e.g., 120.0).
score.setTimeSignature(num, den) Specifies the score’s time signature (i.e., num / den).
score.setTitle(title) Give the part a new title (a string).