Portability | non-portable (TF,GNTD) |
---|---|
Stability | experimental |
Maintainer | hans@hanshoglund.se |
Safe Haskell | None |
- data TimeSignature
- time :: Integer -> Integer -> TimeSignature
- compoundTime :: [Integer] -> Integer -> TimeSignature
- isSimpleTime :: TimeSignature -> Bool
- isCompoundTime :: TimeSignature -> Bool
- toSimpleTime :: TimeSignature -> TimeSignature
- getTimeSignature :: TimeSignature -> ([Integer], Integer)
- timeSignature :: (HasMeta a, HasPart' a, HasOnset a, HasOffset a) => TimeSignature -> a -> a
- timeSignatureDuring :: (HasMeta a, HasPart' a) => Span -> TimeSignature -> a -> a
- withTimeSignature :: TimeSignature -> (TimeSignature -> Score a -> Score a) -> Score a -> Score a
- getTimeSignatures :: TimeSignature -> Score a -> Reactive TimeSignature
- getTimeSignatureChanges :: TimeSignature -> Score a -> [(Time, TimeSignature)]
- getBarDurations :: [(TimeSignature, Duration)] -> [Duration]
- getBarTimeSignatures :: [(TimeSignature, Duration)] -> [TimeSignature]
- standardTimeSignature :: Duration -> TimeSignature
Time signature type
data TimeSignature Source
A time signature is a sequence of beat numbers and a note value (i.e. an expression on the
form (a1+a2...)/b
). For simple time signatures just one beat number is used.
TimeSignature is an instance of Fractional
and can be used as
follows:
timeSignature (4/4) timeSignature (6/8) timeSignature ((3+2)/4)
time :: Integer -> Integer -> TimeSignatureSource
Create a simple time signature.
compoundTime :: [Integer] -> Integer -> TimeSignatureSource
Create a compound time signature.
isSimpleTime :: TimeSignature -> BoolSource
Whether this is a simple time signature.
isCompoundTime :: TimeSignature -> BoolSource
Whether this is a compound time signature.
toSimpleTime :: TimeSignature -> TimeSignatureSource
Convert to a simple time signature by adding all numerators. If given a simple time signature, returns it.
getTimeSignature :: TimeSignature -> ([Integer], Integer)Source
Extract the components of a time signature. Semantic function.
Typically used with the ViewPatterns
extension, as in
foo (getTimeSignature -> (beats, noteValue)) = ...
Adding time signature to scores
timeSignature :: (HasMeta a, HasPart' a, HasOnset a, HasOffset a) => TimeSignature -> a -> aSource
Set the time signature of the given score.
timeSignatureDuring :: (HasMeta a, HasPart' a) => Span -> TimeSignature -> a -> aSource
Set the time signature of the given part of a score.
Extracting time signatures
withTimeSignature :: TimeSignature -> (TimeSignature -> Score a -> Score a) -> Score a -> Score aSource
Extract the time signature from the given score, using the given default time signature.
getTimeSignatureChanges :: TimeSignature -> Score a -> [(Time, TimeSignature)]Source
Utility
getBarDurations :: [(TimeSignature, Duration)] -> [Duration]Source
Given a list of time signatures and the duration between them (TODO use voice), return a list of appropriate bar durations.
getBarTimeSignatures :: [(TimeSignature, Duration)] -> [TimeSignature]Source
Given a list of time signatures and the duration between them (TODO use voice), return a list of appropriate time signatures for each bar.
standardTimeSignature :: Duration -> TimeSignatureSource
Time signature typically used for the given duration.