hmt-0.16: Haskell Music Theory

Safe Haskell Safe Haskell98

Music.Theory.Z.Forte_1973

Description

Allen Forte. The Structure of Atonal Music. Yale University Press, New Haven, 1973.

Synopsis

# Prime form

t_rotations :: Integral i => Z i -> [i] -> [[i]] Source #

T-related rotations of p.

t_rotations mod12 [0,1,3] == [[0,1,3],[0,2,11],[0,9,10]]

ti_rotations :: Integral i => Z i -> [i] -> [[i]] Source #

T/I-related rotations of p.

ti_rotations mod12 [0,1,3] == [[0,1,3],[0,2,11],[0,9,10]
,[0,9,11],[0,2,3],[0,1,10]]

minimumBy_or :: t -> (t -> t -> Ordering) -> [t] -> t Source #

Variant with default value for empty input list case.

t_cmp_prime :: Integral i => Z i -> ([i] -> [i] -> Ordering) -> [i] -> [i] Source #

Prime form rule requiring comparator, considering t_rotations.

ti_cmp_prime :: Integral i => Z i -> ([i] -> [i] -> Ordering) -> [i] -> [i] Source #

Prime form rule requiring comparator, considering ti_rotations.

forte_cmp :: Ord t => [t] -> [t] -> Ordering Source #

Forte comparison function (rightmost first then leftmost outwards).

forte_cmp [0,1,3,6,8,9] [0,2,3,6,7,9] == LT

forte_prime :: Integral i => Z i -> [i] -> [i] Source #

Forte prime form, ie. cmp_prime of forte_cmp.

forte_prime mod12 [0,1,3,6,8,9] == [0,1,3,6,8,9]
forte_prime mod5 [0,1,4] == [0,1,2]
S.set (map (forte_prime mod5) (S.powerset [0..4]))
S.set (map (forte_prime mod7) (S.powerset [0..6]))

t_prime :: Integral i => Z i -> [i] -> [i] Source #

Transpositional equivalence prime form, ie. t_cmp_prime of forte_cmp.

(forte_prime mod12 [0,2,3],t_prime mod12 [0,2,3]) == ([0,1,3],[0,2,3])

# ICV Metric

ic :: Integral i => i -> i -> i Source #

Interval class of interval i.

map (ic 12) [0..11] == [0,1,2,3,4,5,6,5,4,3,2,1]
map (ic 7) [0..6] == [0,1,2,3,3,2,1]
map (ic 5) [1,2,3,4] == [1,2,2,1]
map (ic 12) [5,6,7] == [5,6,5]
map (ic 12 . to_Z mod12) [-13,-1,0,1,13] == [1,1,0,1,1]

icv :: (Integral i, Num n) => i -> [i] -> [n] Source #

Forte notation for interval class vector.

icv 12 [0,1,2,4,7,8] == [3,2,2,3,3,2]

# BIP Metric

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

Basic interval pattern, see Allen Forte "The Basic Interval Patterns" JMT 17/2 (1973):234-272

>>> bip 0t95728e3416
11223344556

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

# Name

sc_univ :: Integral i => Z i -> [[i]] Source #

Generate SC universe, though not in order of the Forte table.

let r = [[]
,[0]
,[0,1],[0,2],[0,3]
,[0,1,2],[0,1,3],[0,1,4],[0,2,4]
,[0,1,2,3],[0,1,2,4],[0,1,3,4],[0,1,3,5]
,[0,1,2,3,4],[0,1,2,3,5],[0,1,2,4,5]
,[0,1,2,3,4,5]
,[0,1,2,3,4,5,6]]
in sc_univ mod7 == r
sort (sc_univ mod12) == sort (map snd sc_table)
zipWith (\p q -> (p == q,p,q)) (sc_univ mod12) (map snd sc_table)

type SC_Name = String Source #

Synonym for String.

sc_table :: Num n => [(SC_Name, [n])] Source #

The set-class table (Forte prime forms).

length sc_table == 224

sc_table_unicode :: Num n => [(SC_Name, [n])] Source #

Unicode (non-breaking hyphen) variant.

forte_prime_name :: (Num n, Eq n) => [n] -> (SC_Name, [n]) Source #

Lookup name of prime form of set class. It is an error for the input not to be a forte prime form.

forte_prime_name [0,1,4,6] == ("4-Z15",[0,1,4,6])

sc_tbl_lookup :: Integral i => Z i -> [(SC_Name, [i])] -> [i] -> Maybe (SC_Name, [i]) Source #

sc_tbl_lookup_err :: Integral i => Z i -> [(SC_Name, [i])] -> [i] -> (SC_Name, [i]) Source #

sc_name' :: Integral i => Z i -> [(SC_Name, [i])] -> [i] -> SC_Name Source #

sc_name :: Integral i => Z i -> [i] -> SC_Name Source #

Lookup a set-class name. The input set is subject to forte_prime before lookup.

sc_name mod12 [0,2,3,6,7] == "5-Z18"
sc_name mod12 [0,1,4,6,7,8] == "6-Z17"

sc_name_long :: Integral i => Z i -> [i] -> SC_Name Source #

Long name (ie. with enumeration of prime form).

sc_name_long mod12 [0,1,4,6,7,8] == "6-Z17[012478]"

sc_name_unicode :: Integral i => Z i -> [i] -> SC_Name Source #

Unicode (non-breaking hyphen) variant.

sc :: Num n => SC_Name -> [n] Source #

Lookup a set-class given a set-class name.

sc "6-Z17" == [0,1,2,4,7,8]

scs :: Num n => [[n]] Source #

scs_n :: (Integral i, Num n) => i -> [[n]] Source #

Cardinality n subset of scs.

map (length . scs_n) [1..11] == [1,6,12,29,38,50,38,29,12,6,1]

tics :: Integral i => Z i -> [i] -> [Int] Source #

Vector indicating degree of intersection with inversion at each transposition.

tics mod12 [0,2,4,5,7,9] == [3,2,5,0,5,2,3,4,1,6,1,4]

# Z-relation

z_relation_of :: Integral i => i -> [i] -> Maybe [i] Source #

Locate Z relation of set class.

fmap (sc_name mod12) (z_relation_of 12 (sc "7-Z12")) == Just "7-Z36"