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.Time.Aligned

Contents

Description

 

Synopsis

Alignable class

class Alignable a where Source

Methods

align :: Alignment -> a -> a Source

Instances

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.

Instances

Functor Aligned 
Foldable Aligned 
Traversable Aligned 
Eq v => Eq (Aligned v) 
Ord v => Ord (Aligned v) 
Show a => Show (Aligned a) 
Wrapped (Aligned v) 
ToJSON a => ToJSON (Aligned a) 
Transformable v => Transformable (Aligned v) 
(HasDuration v, Transformable v) => HasDuration (Aligned v) 
(HasDuration v, Transformable v) => HasPosition (Aligned v) 
Alignable (Aligned a) 
Rewrapped (Aligned a) (Aligned b) 
HasParts a b => HasParts (Aligned a) (Aligned b) 
HasPitches a b => HasPitches (Aligned a) (Aligned b) 
HasDynamics a b => HasDynamics (Aligned a) (Aligned b) 
type SetPart b (Aligned a) = Aligned (SetPart b a) 
type SetPitch b (Aligned a) = Aligned (SetPitch b a) 
type SetDynamic b (Aligned a) = Aligned (SetDynamic b a) 
type Unwrapped (Aligned v) = ((Time, Alignment), v) 
type Part (Aligned a) = Part a 
type Pitch (Aligned a) = Pitch a 
type Dynamic (Aligned a) = Dynamic a 

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

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

realign :: (HasDuration a, Transformable a) => Alignment -> 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.