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

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

Music.Score.Phrases

Contents

Description

This module provides phrase-wise traversal.

Warning This module is experimental.

Synopsis

HasPhrases class

class HasPhrases s t a b | s -> a, t -> b, s b -> t, t a -> s whereSource

Classes that provide a phrase traversal.

Methods

mvoices :: Traversal s t (MVoice a) (MVoice b)Source

Instances

(HasPart' a, Ord (Part a)) => HasPhrases (Score a) (Score b) a b

Traverses all phrases in each voice, using extracted.

HasPhrases (PVoice a) (PVoice b) a b 
HasPhrases (MVoice a) (MVoice b) a b

Traverses all phrases in a voice.

type HasPhrases' s a = HasPhrases s s a aSource

phrases :: HasPhrases s t a b => Traversal s t (Phrase a) (Phrase b)Source

A generic phrase-traversal.

phrases' :: HasPhrases' s a => Traversal' s (Phrase a)Source

A simple generic phrase-traversal.

Phrase types etc

type Phrase a = Voice aSource

For a phrase, we simply use a voice without rests.

To represent a sequence of phrases we provide two equivalent representations:

  • MVoice is a sequence of notes/chords or rests. All consecutive non-rests consitute a phrase.
  • PVoice is a sequence of phrases or durations.

type MVoice a = Voice (Maybe a)Source

A sequence of phrases or rests, represented as notes or rests.

Each consecutive sequence of non-rest elements is considered to be a phrase. For a more explicit representation of the phrase structure, see PVoice.

type PVoice a = [Either Duration (Phrase a)]Source

A sequence of phrases or rests, represented with explicit phrase structure.

Utility

mvoicePVoice :: Lens (MVoice a) (MVoice b) (PVoice a) (PVoice b)Source

View an MVoice as a PVoice.

unsafeMvoicePVoice :: Iso (MVoice a) (MVoice b) (PVoice a) (PVoice b)Source

View an MVoice as a PVoice and vice versa.

This a valid Iso up to meta-data equivalence.