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 |
|---|---|
addPart(part) |
Add a part to the 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 |
|---|---|
getTempo() |
Return the score's tempo. |
setTempo(tempo) |
Set the score's tempo. |
getVolume() |
Return the score's volume. |
setVolume(volume) |
Set the score's volume. |
setPan(pan) |
Set the stereo position of every note in the score. |
getTitle() |
Return the score's title. |
setTitle(title) |
Set the score's title. |
Finally, here are some additional Score functions:
| Function | Description |
|---|---|
copy() |
Return a copy of the score. |
empty() |
Remove every part from the score. |
getSize() |
Return how many parts are in the score. |
getPartList() |
Return the score's parts. |
getStartTime() |
Return when the score starts. |
getEndTime() |
Return when the score ends. |
setTimeSignature(numerator, denominator) |
Set the score's time signature. |
getNumerator() |
Return the top number of the score's time signature. |
getDenominator() |
Return the bottom number of the score's time signature. |
getKeyQuality() |
Return the score's key quality (major or minor). |
setKeyQuality(quality) |
Set the score's key quality (major or minor). |
getKeySignature() |
Return the score's key signature. |
setKeySignature(signature) |
Set the score's key signature. |