Safe Haskell | None |
---|

Haskell implementations of `pct`

operations.
See http://slavepianos.org/rd/?t=pct.

- cf :: Integral n => [n] -> [[a]] -> [[a]]
- cgg :: [[a]] -> [[a]]
- cg :: [a] -> [[a]]
- cg_r :: Integral n => n -> [a] -> [[a]]
- ciseg :: [Z12] -> [Z12]
- cmpl :: [Z12] -> [Z12]
- cyc :: [a] -> [a]
- d_nm :: Integral a => [a] -> Maybe Char
- dim :: [Z12] -> [(Z12, [Z12])]
- dim_nm :: [Z12] -> [(Z12, Char)]
- dis :: Integral t => [Int] -> [t]
- doi :: Int -> [Z12] -> [Z12] -> [[Z12]]
- fn :: [Z12] -> String
- has_ess :: [Z12] -> [Z12] -> Bool
- ess :: [Z12] -> [Z12] -> [[Z12]]
- has_sc_pf :: Integral a => ([a] -> [a]) -> [a] -> [a] -> Bool
- has_sc :: [Z12] -> [Z12] -> Bool
- icf :: (Num a, Eq a) => [[a]] -> [[a]]
- ici :: Num t => [Int] -> [[t]]
- ici_c :: [Int] -> [[Int]]
- icseg :: [Z12] -> [Z12]
- iseg :: [Z12] -> [Z12]
- imb :: Integral n => [n] -> [a] -> [[a]]
- issb :: [Z12] -> [Z12] -> [String]
- mxs :: [Z12] -> [Z12] -> [[Z12]]
- nrm :: Ord a => [a] -> [a]
- nrm_r :: Ord a => [a] -> [a]
- pci :: [Z12] -> [Z12] -> [[Z12]]
- rs :: [Z12] -> [Z12] -> [(SRO, [Z12])]
- rsg :: [Z12] -> [Z12] -> [SRO]
- sb :: [[Z12]] -> [[Z12]]
- spsc :: [[Z12]] -> [String]

# Documentation

cf :: Integral n => [n] -> [[a]] -> [[a]]Source

Cardinality filter

cf [0,3] (cg [1..4]) == [[1,2,3],[1,2,4],[1,3,4],[2,3,4],[]]

Combinatorial sets formed by considering each set as possible values for slot.

cgg [[0,1],[5,7],[3]] == [[0,5,3],[0,7,3],[1,5,3],[1,7,3]]

Combinations generator, ie. synonym for `powerset`

.

sort (cg [0,1,3]) == [[],[0],[0,1],[0,1,3],[0,3],[1],[1,3],[3]]

cg_r :: Integral n => n -> [a] -> [[a]]Source

Powerset filtered by cardinality.

`>>>`

015 019 059 159`cg -r3 0159`

cg_r 3 [0,1,5,9] == [[0,1,5],[0,1,9],[0,5,9],[1,5,9]]

d_nm :: Integral a => [a] -> Maybe CharSource

Diatonic set name. `d`

for diatonic set, `m`

for melodic minor
set, `o`

for octotonic set.

dim_nm :: [Z12] -> [(Z12, Char)]Source

Variant of `dim`

that is closer to the `pct`

form.

`>>>`

T1d T1m T0o`dim 016`

dim_nm [0,1,6] == [(1,'d'),(1,'m'),(0,'o')]

dis :: Integral t => [Int] -> [t]Source

Diatonic interval set to interval set.

`>>>`

1256`dis 24`

dis [2,4] == [1,2,5,6]

doi :: Int -> [Z12] -> [Z12] -> [[Z12]]Source

Degree of intersection.

`>>>`

024579A 024679B`echo 024579e | doi 6 | sort -u`

let p = [0,2,4,5,7,9,11] in doi 6 p p == [[0,2,4,5,7,9,10],[0,2,4,6,7,9,11]]

`>>>`

13568AB`echo 01234 | doi 2 7-35 | sort -u`

doi 2 (sc "7-35") [0,1,2,3,4] == [[1,3,5,6,8,10,11]]

ess :: [Z12] -> [Z12] -> [[Z12]]Source

Embedded segment search.

`>>>`

2B013A9 923507A`echo 23a | ess 0164325`

ess [2,3,10] [0,1,6,4,3,2,5] == [[9,2,3,5,0,7,10],[2,11,0,1,3,10,9]]

has_sc_pf :: Integral a => ([a] -> [a]) -> [a] -> [a] -> BoolSource

Can the set-class q (under prime form algorithm pf) be drawn from the pcset p.

icf :: (Num a, Eq a) => [[a]] -> [[a]]Source

Interval cycle filter.

`>>>`

22341`echo 22341 | icf`

icf [[2,2,3,4,1]] == [[2,2,3,4,1]]

ici :: Num t => [Int] -> [[t]]Source

Interval class set to interval sets.

`>>>`

123 129 1A3 1A9`ici -c 123`

ici_c [1,2,3] == [[1,2,3],[1,2,9],[1,10,3],[1,10,9]]

ici_c :: [Int] -> [[Int]]Source

Interval class set to interval sets, concise variant.

ici_c [1,2,3] == [[1,2,3],[1,2,9],[1,10,3],[1,10,9]]

Interval-class segment.

`>>>`

12141655232`icseg 013265e497t8`

icseg [0,1,3,2,6,5,11,4,9,7,10,8] == [1,2,1,4,1,6,5,5,2,3,2]

issb :: [Z12] -> [Z12] -> [String]Source

`issb`

gives the set-classes that can append to `p`

to give `q`

.

`>>>`

3-7 3-2 3-11`issb 3-7 6-32`

issb (sc "3-7") (sc "6-32") == ["3-2","3-7","3-11"]

mxs :: [Z12] -> [Z12] -> [[Z12]]Source

Matrix search.

`>>>`

6421B9 B97642`mxs 024579 642 | sort -u`

S.set (mxs [0,2,4,5,7,9] [6,4,2]) == [[6,4,2,1,11,9],[11,9,7,6,4,2]]

nrm :: Ord a => [a] -> [a]Source

Normalize.

`>>>`

0123456`nrm 0123456543210`

nrm [0,1,2,3,4,5,6,5,4,3,2,1,0] == [0,1,2,3,4,5,6]

pci :: [Z12] -> [Z12] -> [[Z12]]Source

Pitch-class invariances (called `pi`

at `pct`

).

`>>>`

0236 6320 532B B235`pi 0236 12`

pci [0,2,3,6] [1,2] == [[0,2,3,6],[5,3,2,11],[6,3,2,0],[11,2,3,5]]

rs :: [Z12] -> [Z12] -> [(SRO, [Z12])]Source

Relate sets.

`>>>`

T1M`rs 0123 641e`

import Music.Theory.Z12.Morris_1987.Parse rs [0,1,2,3] [6,4,1,11] == [(rnrtnmi "T1M",[1,6,11,4]) ,(rnrtnmi "T4MI",[4,11,6,1])]

rsg :: [Z12] -> [Z12] -> [SRO]Source

Relate segments.

`>>>`

T4I`rsg 156 3BA`

rsg [1,5,6] [3,11,10] == [rnrtnmi "T4I",rnrtnmi "r1RT4MI"]

`>>>`

T0M`rsg 0123 05t3`

rsg [0,1,2,3] [0,5,10,3] == [rnrtnmi "T0M",rnrtnmi "RT3MI"]

`>>>`

RT1M`rsg 0123 4e61`

rsg [0,1,2,3] [4,11,6,1] == [rnrtnmi "T4MI",rnrtnmi "RT1M"]

`>>>`

r3RT1M`echo e614 | rsg 0123`

rsg [0,1,2,3] [11,6,1,4] == [rnrtnmi "r1T4MI",rnrtnmi "r1RT1M"]