mezzo-0.3.1.0: Typesafe music composition

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

Mezzo.Model.Rules.Classical

Description

Types and constraints encoding the rules of classical music.

Synopsis

Documentation

class ValidMelConcat ps1 ps2 Source #

Ensures that two partitures can be horizontally concatenated.

Two part lists can be horizontally concatenated if

  • both of them are empty or
  • all of the voices can be appended.

Instances

ValidMelConcat l2 0 l1 (None (OptVector PitchType l1)) (None (OptVector PitchType l2)) Source # 
(ValidMelAppend l2 l1 v1 v2, ValidMelConcat l2 ((-) n 1) l1 vs1 vs2) => ValidMelConcat l2 n l1 ((:--) (Voice l1) n v1 vs1) ((:--) (Voice l2) n v2 vs2) Source # 

class ValidHarmConcat ps Source #

Ensures that two partitures can be vertically concatenated.

Two partitures can be vertically concatenated if

  • the top one is empty or
  • all but the first voice can be concatenated, and the first voice forms valid harmonic dyads with every other voice and follows the rules of valid harmonic motion.

Instances

(ValidHarmConcat ((-) n1 1) n2 l ((,) (Partiture ((-) n1 1) l) (Partiture n2 l) vs us), AllSatisfyAll n2 (Voice l) ((:) (Voice l -> Constraint) (ValidHarmDyadsInVectors l v) ((:) (Voice l -> Constraint) (ValidHarmMotionInVectors l l v) ([] (Voice l -> Constraint)))) us) => ValidHarmConcat n1 n2 l ((,) (Vector (Voice l) n1) (Partiture n2 l) ((:--) (Voice l) n1 v vs) us) Source # 
ValidHarmConcat 0 n2 l ((,) (Vector (OptVector PitchType l) 0) (Partiture n2 l) (None (OptVector PitchType l)) vs) Source # 

class ValidHomConcat ps Source #

Ensures that two partitures can be vertically concatenated.

Two partitures can be vertically concatenated if

  • the top one is empty or
  • all but the first voice can be concatenated, and the first voice forms valid harmonic dyads with every other voice and follows the rules of valid harmonic motion.

Instances

(ValidHomConcat ((-) n1 1) n2 l ((,) (Partiture ((-) n1 1) l) (Partiture n2 l) vs us), AllSatisfyAll n2 (Voice l) ((:) (Voice l -> Constraint) (ValidHarmDyadsInVectors l v) ([] (Voice l -> Constraint))) us) => ValidHomConcat n1 n2 l ((,) (Vector (Voice l) n1) (Partiture n2 l) ((:--) (Voice l) n1 v vs) us) Source # 
ValidHomConcat 0 n2 l ((,) (Vector (OptVector PitchType l) 0) (Partiture n2 l) (None (OptVector PitchType l)) vs) Source # 

class ValidPitch p Source #

Instances

ValidPitch p Source # 
PitchError Constraint "Note can't be lower than C natural of octave -1: " (Pitch C Flat Oct_1) => ValidPitch (Pitch C Flat Oct_1) Source # 
PitchError Constraint "Note can't be higher than B natural of octave 8: " (Pitch B Sharp Oct8) => ValidPitch (Pitch B Sharp Oct8) Source # 

type family ValidMotion (p1 :: PitchType) (p2 :: PitchType) (q1 :: PitchType) (q2 :: PitchType) :: Constraint where ... Source #

Ensures that four pitches (representing two consequent intervals) follow the rules for valid harmonic motion.

Harmonic motion is not permitted if

  • it is direct motion into a perfect interval (this covers parallel and concealed fifths, octaves and unisons).

Equations

ValidMotion Silence _ _ _ = Valid 
ValidMotion _ Silence _ _ = Valid 
ValidMotion _ _ Silence _ = Valid 
ValidMotion _ _ _ Silence = Valid 
ValidMotion p1 p2 q1 q2 = If ((p1 .~. q1) .||. (p2 .~. q2)) (ObliqueMotion (MakeInterval p1 p2) (MakeInterval q1 q2)) (If (p1 <<? q1) (If (p2 <<? q2) (DirectMotion (DyPair p1 p2 q1 q2) (MakeInterval p1 p2) (MakeInterval q1 q2)) (ContraryMotion (MakeInterval p1 p2) (MakeInterval q1 q2))) (If (p2 <<? q2) (ContraryMotion (MakeInterval p1 p2) (MakeInterval q1 q2)) (DirectMotion (DyPair p1 p2 q1 q2) (MakeInterval p1 p2) (MakeInterval q1 q2))))