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

Copyright(c) Hans Hoglund 2012-2014
LicenseBSD-style
Maintainerhans@hanshoglund.se
Stabilityexperimental
Portabilitynon-portable (TF,GNTD)
Safe HaskellNone
LanguageHaskell2010

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 -> TimeSignature Source

Create a simple time signature.

compoundTime :: [Integer] -> Integer -> TimeSignature Source

Create a compound time signature.

isSimpleTime :: TimeSignature -> Bool Source

Whether this is a simple time signature.

isCompoundTime :: TimeSignature -> Bool Source

Whether this is a compound time signature.

toSimpleTime :: TimeSignature -> TimeSignature Source

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, Transformable a) => TimeSignature -> a -> a Source

Set the time signature of the given score.

timeSignatureDuring :: HasMeta a => Span -> TimeSignature -> a -> a Source

Set the time signature of the given part of a score.

Extracting time signatures

withTimeSignature :: TimeSignature -> (TimeSignature -> Score a -> Score a) -> Score a -> Score a Source

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 -> TimeSignature Source

Time signature typically used for the given duration.