hmt-0.15: Haskell Music Theory

Safe Haskell | None
Language | Haskell98

Music.Theory.Xenakis.S4

Contents

- S4 notation
- Rel
- Face
- Figures

Description

Symetric Group S4 as related to the composition "Nomos Alpha" by Iannis Xenakis. In particular in relation to the discussion in "Towards a Philosophy of Music", Formalized Music pp. 219 -- 221

Synopsis

- data Label
  - = A
  - | B
  - | C
  - | D
  - | D2
  - | E
  - | E2
  - | G
  - | G2
  - | I
  - | L
  - | L2
  - | Q1
  - | Q2
  - | Q3
  - | Q4
  - | Q5
  - | Q6
  - | Q7
  - | Q8
  - | Q9
  - | Q10
  - | Q11
  - | Q12
- type Half_Seq = [Int]
- type Seq = [Int]
- complement :: Half_Seq -> Half_Seq
- full_seq :: Half_Seq -> Seq
- lower :: Half_Seq -> Half_Seq
- l_on :: Label -> Label -> Label
- seq_of :: Label -> Seq
- half_seq_of :: Label -> Seq
- half_seq :: Seq -> Half_Seq
- reverse_lookup :: Eq a => a -> [(b, a)] -> Maybe b
- label_of :: Seq -> Label
- complementary :: Half_Seq -> Half_Seq -> Bool
- type Rel = (Bool, Permute)
- relate :: Half_Seq -> Half_Seq -> Rel
- relate_l :: Label -> Label -> Rel
- relations :: [Half_Seq] -> [Rel]
- relations_l :: [Label] -> [Rel]
- apply_relation :: Rel -> Half_Seq -> Half_Seq
- apply_relations :: [Rel] -> Half_Seq -> [Half_Seq]
- apply_relations_l :: [Rel] -> Label -> [Label]
- data Face
  - = F_Back
  - | F_Front
  - | F_Right
  - | F_Left
  - | F_Bottom
  - | F_Top
- faces :: [([Int], Face)]
- viii_6_l :: [Label]
- viii_7 :: [[Label]]
- viii_6b_l :: [Label]
- viii_6b_p' :: [Half_Seq]
- viii_6b' :: [(Label, Half_Seq)]
- viii_6b :: [(Label, Seq)]
- viii_6_relations :: [Rel]
- viii_6b_relations :: [Rel]

# S4 notation

data Label Source #

`Label`s for elements of the symmetric group P4.

Constructors

A |
B |
C |
D |
D2 |
E |
E2 |
G |
G2 |
I |
L |
L2 |
Q1 |
Q2 |
Q3 |
Q4 |
Q5 |
Q6 |
Q7 |
Q8 |
Q9 |
Q10 |
Q11 |
Q12 |

Instances

Bounded Label Source # |
Methods minBound :: Label # maxBound :: Label #
Enum Label Source # |
Methods succ :: Label -> Label # pred :: Label -> Label # toEnum :: Int -> Label # fromEnum :: Label -> Int # enumFrom :: Label -> [Label] # enumFromThen :: Label -> Label -> [Label] # enumFromTo :: Label -> Label -> [Label] # enumFromThenTo :: Label -> Label -> Label -> [Label] #
Eq Label Source # |
Methods (==) :: Label -> Label -> Bool # (/=) :: Label -> Label -> Bool #
Ord Label Source # |
Methods compare :: Label -> Label -> Ordering # (<) :: Label -> Label -> Bool # (<=) :: Label -> Label -> Bool # (>) :: Label -> Label -> Bool # (>=) :: Label -> Label -> Bool # max :: Label -> Label -> Label # min :: Label -> Label -> Label #
Show Label Source # |
Methods showsPrec :: Int -> Label -> ShowS # show :: Label -> String # showList :: [Label] -> ShowS #

type Half_Seq = [Int] Source #

Initial half of `Seq` (ie. #4). The complete `Seq` is formed by appending the `complement` of the `Half_Seq`.

type Seq = [Int] Source #

Complete sequence (ie. #8).

complement :: Half_Seq -> Half_Seq Source #

Complement of a `Half_Seq`.

    map complement [[4,1,3,2],[6,7,8,5]] == [[8,5,7,6],[2,3,4,1]]

full_seq :: Half_Seq -> Seq Source #

Form `Seq` from `Half_Seq`.

    full_seq [3,2,4,1] == [3,2,4,1,7,6,8,5]
    label_of (full_seq [3,2,4,1]) == G2
    label_of (full_seq [1,4,2,3]) == L

lower :: Half_Seq -> Half_Seq Source #

Lower `Half_Seq`, ie. `complement` or `id`.

    map lower [[4,1,3,2],[6,7,8,5]] == [[4,1,3,2],[2,3,4,1]]

l_on :: Label -> Label -> Label Source #

Application of `Label` p on q.

    l_on Q1 I == Q1
    l_on D A == G
    [l_on L L,l_on E D,l_on D E] == [L2,C,B]

seq_of :: Label -> Seq Source #

`Seq` of `Label`, inverse of `label_of`.

    seq_of Q1 == [8,7,5,6,4,3,1,2]

half_seq_of :: Label -> Seq Source #

`Half_Seq` of `Label`, ie. `half_seq` `.` `seq_of`.

    half_seq_of Q1 == [8,7,5,6]

half_seq :: Seq -> Half_Seq Source #

`Half_Seq` of `Seq`, ie. `take` `4`.

    complement (half_seq (seq_of Q7)) == [3,4,2,1]

reverse_lookup :: Eq a => a -> [(b, a)] -> Maybe b Source #

Reverse table `lookup`.

    reverse_lookup 'b' (zip [1..] ['a'..]) == Just 2
    lookup 2 (zip [1..] ['a'..]) == Just 'b'

label_of :: Seq -> Label Source #

`Label` of `Seq`, inverse of `seq_of`.

    label_of [8,7,5,6,4,3,1,2] == Q1
    label_of (seq_of Q4) == Q4

complementary :: Half_Seq -> Half_Seq -> Bool Source #

`True` if two `Half_Seq`s are complementary, ie. form a `Seq`.

    complementary [4,2,1,3] [8,6,5,7] == True

# Rel

type Rel = (Bool, Permute) Source #

Relation between to `Half_Seq` values as a (complementary,permutation) pair.

relate :: Half_Seq -> Half_Seq -> Rel Source #

Determine `Rel` of `Half_Seq`s.

    relate [1,4,2,3] [1,3,4,2] == (False,P.listPermute 4 [0,3,1,2])
    relate [1,4,2,3] [8,5,6,7] == (True,P.listPermute 4 [1,0,2,3])

relate_l :: Label -> Label -> Rel Source #

`Rel` from `Label` p to q.

    relate_l L L2 == (False,P.listPermute 4 [0,3,1,2])

relations :: [Half_Seq] -> [Rel] Source #

`relate` adjacent `Half_Seq`, see also `relations_l`.

relations_l :: [Label] -> [Rel] Source #

`relate` adjacent `Label`s.

    relations_l [L2,L,A] == [(False,P.listPermute 4 [0,2,3,1])
                            ,(False,P.listPermute 4 [2,0,1,3])]

apply_relation :: Rel -> Half_Seq -> Half_Seq Source #

Apply `Rel` to `Half_Seq`.

    apply_relation (False,P.listPermute 4 [0,3,1,2]) [1,4,2,3] == [1,3,4,2]

apply_relations :: [Rel] -> Half_Seq -> [Half_Seq] Source #

Apply sequence of `Rel` to initial `Half_Seq`.

apply_relations_l :: [Rel] -> Label -> [Label] Source #

Variant of `apply_relations`.

    apply_relations_l (relations_l [L2,L,A,Q1]) L2 == [L2,L,A,Q1]

# Face

data Face Source #

Enumeration of set of faces of a cube.

Constructors

F_Back |
F_Front |
F_Right |
F_Left |
F_Bottom |
F_Top |

Instances

Bounded Face Source # |
Methods minBound :: Face # maxBound :: Face #
Enum Face Source # |
Methods succ :: Face -> Face # pred :: Face -> Face # toEnum :: Int -> Face # fromEnum :: Face -> Int # enumFrom :: Face -> [Face] # enumFromThen :: Face -> Face -> [Face] # enumFromTo :: Face -> Face -> [Face] # enumFromThenTo :: Face -> Face -> Face -> [Face] #
Eq Face Source # |
Methods (==) :: Face -> Face -> Bool # (/=) :: Face -> Face -> Bool #
Ord Face Source # |
Methods compare :: Face -> Face -> Ordering # (<) :: Face -> Face -> Bool # (<=) :: Face -> Face -> Bool # (>) :: Face -> Face -> Bool # (>=) :: Face -> Face -> Bool # max :: Face -> Face -> Face # min :: Face -> Face -> Face #
Show Face Source # |
Methods showsPrec :: Int -> Face -> ShowS # show :: Face -> String # showList :: [Face] -> ShowS #

faces :: [([Int], Face)] Source #

Table indicating set of faces of cubes as drawn in Fig. VIII-6 (p.220).

    lookup [1,4,6,7] faces == Just F_Left
    reverse_lookup F_Right faces == Just [2,3,5,8]

# Figures

viii_6_l :: [Label] Source #

Fig. VIII-6. Hexahedral (Octahedral) Group (p. 220)

    length viii_6_l == 24
    take 7 viii_6_l == [L2,L,A,Q1,Q7,Q3,Q9]

viii_7 :: [[Label]] Source #

Fig. VIII-7 (p.221)

    map (take 4) (take 4 viii_7) == [[I,A,B,C]
                                    ,[A,I,C,B]
                                    ,[B,C,I,A]
                                    ,[C,B,A,I]]

viii_6b_l :: [Label] Source #

Fig. VIII-6/b `Labels` (p.221)

    length viii_6b_l == length viii_6_l
    take 8 viii_6b_l == [I,A,B,C,D2,D,E2,E]

viii_6b_p' :: [Half_Seq] Source #

Fig. VIII-6/b `Half_Seq`.

    viii_6b_p' == map half_seq_of viii_6b_l
    nub (map (length . nub) viii_6b_p') == [4]

viii_6b' :: [(Label, Half_Seq)] Source #

Variant of `viii_6b` with `Half_Seq`.

viii_6b :: [(Label, Seq)] Source #

Fig. VIII-6/b.

    map (viii_6b !!) [0,8,16] == [(I,[1,2,3,4,5,6,7,8])
                                 ,(G2,[3,2,4,1,7,6,8,5])
                                 ,(Q8,[6,8,5,7,2,4,1,3])]

viii_6_relations :: [Rel] Source #

The sequence of `Rel` to give `viii_6_l` from `L2`.

    apply_relations_l viii_6_relations L2 == viii_6_l
    length (nub viii_6_relations) == 14

viii_6b_relations :: [Rel] Source #

The sequence of `Rel` to give `viii_6b_l` from `I`.

    apply_relations_l viii_6b_relations I == viii_6b_l
    length (nub viii_6b_relations) == 10