mezzo-0.2.0.2: Typesafe music composition

Copyright(c) Dima Szamozvancev
LicenseMIT
Maintainerds709@cam.ac.uk
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Mezzo.Model.Music

Contents

Description

Algebraic description of music with type-level constraints.

Synopsis

Music

data Music :: forall n l. Partiture n l -> Type where Source #

A piece of music consisting of parallel and sequential composition of notes and rests, subject to constraints.

Currently enforced constraints are:

  • Height (number of voices) of two sequentially composed pieces must be equal.
  • Width (number of temporal units) of two parallelly composed pieces must be equal.
  • Sequentially composed voices cannot have any augmented, diminished or seventh leaps.
  • Parallelly composed pieces cannot have any minor second or major seventh harmonic intervals.
  • Music must not contain parallel or concealed unisons, fifths or octaves.

Constructors

Note :: NoteConstraints r d => Root r -> Dur d -> Music (FromRoot r d)

A note specified by a pitch and a duration.

Rest :: RestConstraints d => Dur d -> Music (FromSilence d)

A rest specified by a duration.

(:|:) :: MelConstraints m1 m2 => Music m1 -> Music m2 -> Music (m1 +|+ m2) infixl 4

Sequential or melodic composition of music.

(:-:) :: HarmConstraints m1 m2 => Music m1 -> Music m2 -> Music (m1 +-+ m2) infixl 4

Parallel or harmonic composition of music.

Chord :: ChordConstraints c d => Cho c -> Dur d -> Music (FromChord c d)

A chord specified by a chord type and a duration.

Instances

Show (Music n l m) Source # 

Methods

showsPrec :: Int -> Music n l m -> ShowS #

show :: Music n l m -> String #

showList :: [Music n l m] -> ShowS #

data Score Source #

A type encapsulating every Music composition.

Constructors

Score (Music m) 

Harmonic constructs

type Progression p d = Music (ChordsToPartiture (PieceToChords l p) d) Source #

A chord progression with the given scheme and chord length.

Constraints

type MelConstraints m1 m2 = IfStrict (ValidMelConcat m1 m2) Source #

Ensures that two pieces of music can be composed sequentially.

type HarmConstraints m1 m2 = IfStrict (ValidHarmConcat (Align m1 m2)) Source #

Ensures that two pieces of music can be composed in parallel.

type ChordConstraints c d = (IntListRep c, Primitive n, Primitive d) Source #

Ensures that the chord is valid.