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.Phrases

Contents

Description

This module provides phrase-wise traversal.

Synopsis

HasPhrases class

class HasPhrases s t a b | s -> a, t -> b, s b -> t, t a -> s where Source

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

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

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.

type TVoice a = Track (Phrase a) Source

A sequence of phrases or rests, represented as phrases with an explicit onset.

This is only isomorphic to MVoice (and PVoice) up to onset equivalence.

Utility

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

View an MVoice as a PVoice.

mVoiceTVoice :: Lens (MVoice a) (MVoice b) (TVoice a) (TVoice b) Source

pVoiceTVoice :: Lens (PVoice a) (PVoice b) (TVoice a) (TVoice b) Source

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.

singleMVoice :: Prism (Score a) (Score b) (MVoice a) (MVoice b) Source