Score Structure¶
This module defines a Score Structure class (ScoreStruct
)
A ScoreStruct
holds the structure of a score
(its skeleton): it is a list of measure definitions (see addMeasure()
),
where each measure definition includes a time-signature, tempo and optional annotations.
A ScoreStruct
provides utilities to convert between score locations,
quarternote time and absolute time position.
Key Concepts¶
- Structure ≠ Contents
A
ScoreStruct
does not hold any actual content (notes, chords, silences, etc), it just provides a skeleton to organize such content within the given structure- Beat time vs Real time
Real time is the actual clock time, measured in seconds. Beat time refers to a symbolic time, measured in quarternotes. For example, an event (a note) starting at
beat=2.5
with a duration of0.5
beats means that the event starts2+1/2
quarternotes after the beginning and has a duration of an eighth note. The exact location in Real time depends on the tempo and on any tempo changes before and during the event.To convert between beat time and real time see
beatToTime()
andtimeToBeat()
.- Score Location
As mentioned above, beat time is measured in quarternotes since the beginning. Within a score with time-signature changes there is a more convenient way to indicate time: a
ScoreLocation
, which is basically a tuple(measure index, beat offset)
. SeelocationToTime()
,timeToLocation()
Note
Measure indexes start at 0
- Rational Numbers
To avoid rounding errors, any variable or attribute dealing with time (in beats, seconds, tempo, etc) is represented as a rational number
ScoreStruct and maelzel.core¶
The ScoreStruct
class is used extensively in maelzel.core. Within
this context a ScoreStruct
can be used as a context
manager to set a temporary score structure:
from maelzel.core import *
from maelzel.music.scale import *
scale = Chain([Note(m, 0.5) for m in pitchscale('3F', steps='minor-harmonic', endpitch='5F')])
scale.show()
with ScoreStruct(timesig=(5, 8), tempo=72):
scale.show()
scale.play()
Functions¶
|
Returns the beat structure for this measure |
Classes¶
|
A ScoreStruct holds the structure of a score but no content |
|
A MeasureDef defines one Measure within a ScoreStruct (time signature, tempo, etc.) |
|
A time signature |