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

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

Music.Score.Part

Contents

Description

Provides partwise traversal, part composition and extraction.

Synopsis

Documentation

class HasPart a whereSource

Class of types with an associated part.

The part type can be any type that is orddered.

Associated Types

type Part a :: *Source

Associated part type. Should implement Ord and Show.

Methods

getPart :: a -> Part aSource

Get the voice of the given note.

setPart :: Part a -> a -> aSource

Set the voice of the given note.

modifyPart :: (Part a -> Part a) -> a -> aSource

Modify the voice of the given note.

type HasPart' a = (Ord (Part a), HasPart a)Source

Like HasPart, but enforces the part to be ordered. This is usually required for part separation and traversal.

newtype PartT n a Source

Constructors

PartT 

Fields

getPartT :: (n, a)
 

Instances

Typeable2 PartT 
Functor (PartT n) 
(Enum v, Bounded a) => Bounded (PartT v a) 
(Enum v, Enum a) => Enum (PartT v a) 
(Eq n, Eq a) => Eq (PartT n a) 
(Enum v, Ord v, Real a, Enum a, Integral a) => Integral (PartT v a) 
(Enum v, Eq v, Num a) => Num (PartT v a) 
(Ord n, Ord a) => Ord (PartT n a) 
(Enum v, Ord v, Num a, Ord a, Real a) => Real (PartT v a) 
(Show n, Show a) => Show (PartT n a) 
(IsDynamics a, Enum n) => IsDynamics (PartT n a) 
(IsPitch a, Enum n) => IsPitch (PartT n a) 
HasPitch a => HasPitch (PartT n a) 
HasPart (PartT n a) 
Tiable a => Tiable (PartT n a) 
HasDynamic a => HasDynamic (PartT n a) 
HasArticulation a => HasArticulation (PartT n a) 
HasSlide a => HasSlide (PartT n a) 
HasHarmonic a => HasHarmonic (PartT n a) 
HasText a => HasText (PartT n a) 
HasTremolo a => HasTremolo (PartT n a) 
HasChord a => HasChord (PartT n a) 
HasMidi a => HasMidi (PartT n a) 
HasLilypond a => HasLilypond (PartT n a) 
HasMusicXml a => HasMusicXml (PartT n a) 

extract :: (HasPart' a, MonadPlus s, Performable s) => s a -> [s a]Source

Extract parts from the a score.

The parts are returned in the order defined the associated Ord instance part type. You can recompose the score with mconcat, i.e.

 mconcat . extract = id

Simple type

 Score a -> [Score a]

extractParts :: (HasPart' a, MonadPlus s, Performable s) => s a -> [(Part a, s a)]Source

Extract parts from the a score.

The parts are returned in the order defined the associated Ord instance part type.

Simple type

 Score a -> [(Part a, Score a)]

mapPart :: (Ord v, v ~ Part a, HasPart a, MonadPlus s, Performable s, Enum b) => b -> (s a -> s a) -> s a -> s aSource

Map over a single voice in the given score.

 Part -> (Score a -> Score a) -> Score a -> Score a

mapAllParts :: (HasPart' a, MonadPlus s, Performable s) => ([s a] -> [s b]) -> s a -> s bSource

Map over all parts in the given score.

 ([Score a] -> [Score a]) -> Score a -> Score a

mapParts :: (HasPart' a, MonadPlus s, Performable s) => (s a -> s b) -> s a -> s bSource

Map over all parts in the given score.

 ([Score a] -> [Score a]) -> Score a -> Score a

getParts :: (HasPart' a, Performable s) => s a -> [Part a]Source

Get all parts in the given score. Returns a list of parts.

 Score a -> [Part]

setParts :: (HasPart a, Functor s) => Part a -> s a -> s aSource

Set all parts in the given score.

 Part -> Score a -> Score a

modifyParts :: (HasPart a, Functor s) => (Part a -> Part a) -> s a -> s aSource

Modify all parts in the given score.

 (Part -> Part) -> Score a -> Score a

Part composition

(</>) :: (HasPart' a, Enum (Part a), Functor s, MonadPlus s, Performable s) => s a -> s a -> s aSource

Similar to <>, but increases parts in the second part to prevent collision.

moveParts :: (HasPart' a, Enum (Part a), Integral b, Functor s) => b -> s a -> s aSource

Move down one voice (all parts).

moveToPart :: (HasPart' a, Enum (Part a), Functor s) => Part a -> s a -> s aSource

Move top-part to the specific voice (other parts follow).