Skip to content

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).

Creating a Score

You can create a Score using the following functions:

Score()
Score(title)
Score(tempo)
Score(title, tempo)
Score(part)
Parameter Type Default Description
title str '' A title for the Score.
tempo int or float 60.0
part Part None The first Part to add to the Score.

For example,

score = Score("Morning Glory", 135.0)

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

Functions

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

Function Description
score.addPart(part) Add a part to the score.
score.addPartList(partList) Add several parts to the score at once.

You can also set the tempo, volume, panning, and title of the score.

Function Description
score.getTempo() Return the score's tempo.
score.setTempo(tempo) Set the score's tempo.
score.getVolume() Return the score's volume.
score.setVolume(volume) Set the score's volume.
score.setPan(pan) Set the stereo position of every note in the score.
score.getTitle() Return the score's title.
score.setTitle(title) Set the score's title.

Finally, here are some additional Score functions:

Function Description
score.copy() Return a copy of the score.
score.empty() Remove every part from the score.
score.getSize() Return how many parts are in the score.
score.getPartList() Return the score's parts.
score.getStartTime() Return when the score starts.
score.getEndTime() Return when the score ends.
score.setTimeSignature(numerator, denominator) Set the score's time signature.
score.getNumerator() Return the top number of the score's time signature.
score.getDenominator() Return the bottom number of the score's time signature.
score.getKeyQuality() Return the score's key quality (major or minor).
score.setKeyQuality(quality) Set the score's key quality (major or minor).
score.getKeySignature() Return the score's key signature.
score.setKeySignature(signature) Set the score's key signature.