TimeSignature¶
- class maelzel.scorestruct.TimeSignature(*parts, subdivisions=())[source]¶
Bases:
object
A time signature
In its simplest form a type signature consists of one part, a tuple (numerator, denominator). For example, a 4/4 time signature can be represented as TimeSignature((4, 4))
- Parameters:
parts (
tuple
[int
,int
]) – the parts of this time signature, a seq. of tuples (numerator, denominator)subdivisions (
Sequence
[int
]) – subdivisions as multiples of the denominator. Only valid for non-compound signatures. It is used to structure subdivisions for a single part. For example, 7/8 subdivided as 2+3+2 can be expressed as TimeSignature((7, 8), subdivisionStruct=(2, 3, 2)).
Attributes Summary
The denominator of this time signature
The numerator of this time signature
The duration of this time signature, in quarternotes
Methods Summary
copy
()- rtype:
Is this a compound meter with heterogeneous denominators?
parse
(timesig[, subdivisionStruct])Parse a time signature definition
The qualified subdivision structure, a tuple (denominator, subdivisions) where the denominator is the max.
Attributes Documentation
- denominator¶
The denominator of this time signature
For non-compound signatures, this is the same as the denominator of its only part. For compound signatures, this corresponds to the denominator of the fused signature
>>> TimeSignature((7, 8)).denominator 8 >>> TimeSignature((2, 4), (5, 8)).denominator 8
- numerator¶
The numerator of this time signature
For non-compound signatures, this is the same as the numerator of its only part. For compound signatures, this corresponds to the nominator of the fused signature
>>> TimeSignature((7, 8)).numerator 7 >>> TimeSignature((2, 4), (5, 8)).numerator 9
- quarternoteDuration¶
The duration of this time signature, in quarternotes
Methods Documentation
- isHeterogeneous()[source]¶
Is this a compound meter with heterogeneous denominators?
Heterogeneous meters are 3/4+3/8, 4/4+1/8, 3/8+3/16. Homogeneous meters are 3/8+2/8, 3/4+4/4
- Return type:
bool
- Returns:
true if this is a compound meter with heterogenous denominators
- classmethod parse(timesig, subdivisionStruct=())[source]¶
Parse a time signature definition
- Parameters:
timesig (
str
|tuple
) – a time signature as a string. For compound signatures, use a + sign between parts.subdivisionStruct (
Sequence
[int
]) – the subdivision structure as multiples of the fused signature denominator.
- Return type:
- Returns:
the time signature
- qualifiedSubdivisionStruct()[source]¶
The qualified subdivision structure, a tuple (denominator, subdivisions) where the denominator is the max. common denom. of the parts of this signature and the subdivisions are the subdivisions as given in the subdivisionStruct
This method will raise ValueError if this time signature does not have a subdivision structure
- Return type:
tuple
[int
,tuple
[int
,...
]]
Example
>>> t = TimeSignature((7, 8), subdivisionStruct=(3, 2, 2)) >>> t.qualifiedSubdivisionStruct() (8, (3, 2, 2)) >>> t2 = TimeSignature((2, 4), (3, 16), subdivisionStruct=(4, 4, 3)) >>> t2.fusedSignature (11, 16) >>> t2.qualifiedSubdivisionStruct() (16, (4, 4, 3))