music-score-1.7.1: Musical score and part representation.

Portabilitynon-portable (TF,GNTD)
Stabilityexperimental
Maintainerhans@hanshoglund.se
Safe HaskellNone

Music.Score.Meta.Time

Contents

Description

Provides time signatures and related meta-data.

Synopsis

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, HasPosition a) => TimeSignature -> a -> aSource

Set the time signature of the given score.

timeSignatureDuring :: HasMeta 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.

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.