hmt-0.15: Haskell Music Theory

Safe Haskell | Safe
Language | Haskell98

Music.Theory.Z.SRO

Contents

- Sequence operations

Description

Serial (ordered) pitch-class operations on `Z`.

Synopsis

- tn :: (Integral i, Functor f) => i -> i -> f i -> f i
- invert :: (Integral i, Functor f) => i -> i -> f i -> f i
- tni :: (Integral i, Functor f) => i -> i -> f i -> f i
- mn :: (Integral i, Functor f) => i -> i -> f i -> f i
- t_related :: (Integral i, Functor f) => i -> f i -> [f i]
- ti_related :: (Eq (f i), Integral i, Functor f) => i -> f i -> [f i]
- rti_related :: Integral i => i -> [i] -> [[i]]
- tn_to :: Integral a => a -> a -> [a] -> [a]
- invert_ix :: Integral i => i -> Int -> [i] -> [i]
- tmatrix :: Integral i => i -> [i] -> [[i]]

# Documentation

tn :: (Integral i, Functor f) => i -> i -> f i -> f i Source #

Transpose p by n.

    tn 5 4 [0,1,4] == [4,0,3]
    tn 12 4 [1,5,6] == [5,9,10]

invert :: (Integral i, Functor f) => i -> i -> f i -> f i Source #

Invert p about n.

    invert 5 0 [0,1,4] == [0,4,1]
    invert 12 6 [4,5,6] == [8,7,6]
    invert 12 0 [0,1,3] == [0,11,9]

tni :: (Integral i, Functor f) => i -> i -> f i -> f i Source #

Composition of `invert` about `0` and `tn`.

    tni 5 1 [0,1,3] == [1,0,3]
    tni 12 4 [1,5,6] == [3,11,10]
    (invert 12 0 . tn  12 4) [1,5,6] == [7,3,2]

mn :: (Integral i, Functor f) => i -> i -> f i -> f i Source #

Modulo multiplication.

    mn 12 11 [0,1,4,9] == tni 12 0 [0,1,4,9]

t_related :: (Integral i, Functor f) => i -> f i -> [f i] Source #

T-related sequences of p.

    length (t_related 12 [0,3,6,9]) == 12

ti_related :: (Eq (f i), Integral i, Functor f) => i -> f i -> [f i] Source #

T/I-related sequences of p.

    length (ti_related 12 [0,1,3]) == 24
    length (ti_related 12 [0,3,6,9]) == 24
    ti_related 12 [0] == map return [0..11]

rti_related :: Integral i => i -> [i] -> [[i]] Source #

R/T/I-related sequences of p.

    length (rti_related 12 [0,1,3]) == 48
    length (rti_related 12 [0,3,6,9]) == 24

# Sequence operations

tn_to :: Integral a => a -> a -> [a] -> [a] Source #

Variant of `tn`, transpose p so first element is n.

    tn_to 12 5 [0,1,3] == [5,6,8]
    map (tn_to 12 0) [[0,1,3],[1,3,0],[3,0,1]]

invert_ix :: Integral i => i -> Int -> [i] -> [i] Source #

Variant of `invert`, inverse about nth element.

    map (invert_ix 12 0) [[0,1,3],[3,4,6]] == [[0,11,9],[3,2,0]]
    map (invert_ix 12 1) [[0,1,3],[3,4,6]] == [[2,1,11],[5,4,2]]

tmatrix :: Integral i => i -> [i] -> [[i]] Source #

The standard t-matrix of p.

    tmatrix 12 [0,1,3] == [[0,1,3]
                          ,[11,0,2]
                          ,[9,10,0]]