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

Copyright(c) Hans Hoglund 2012-2014
Portabilitynon-portable (TF,GNTD)
Safe HaskellNone






Alignable class

class Alignable a where Source


align :: LocalDuration -> a -> a Source


Aligned values

data Aligned v Source

Aligned places a vector-like object in space, by fixing a local duration interpolating the vector to a specific point in time. The aligned value must be an instance of HasDuration, with view duration providing the size of the vector.

This is analogous to alignment in a graphical program. To align something at onset, midpoint or offset, use 0, 0.5 or 1 as the local duration value.

aligned :: Time -> LocalDuration -> v -> Aligned v Source

Align the given value so that its local duration occurs at the given time.

realign :: (HasDuration a, Transformable a) => LocalDuration -> Aligned a -> Aligned a Source

 Change the alignment of a value without moving it.

x^.era = (realign l x)^.era

renderAligned :: (HasDuration a, Transformable a) => (Span -> a -> b) -> Aligned a -> b Source

Render an aligned value. The given span represents the actual span of the aligned value.

renderAlignedVoice :: Aligned (Voice a) -> Score a Source

Convert an aligned voice to a score.

renderAlignedNote :: Aligned (Note a) -> Event a Source

Convert an aligned note to an event.

renderAlignedDuration :: Aligned Duration -> Span Source

Convert an aligned duration to a span.