R [F      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ A B C D E!F!G!H!I!J!K!L!M!N!O!P!Q!R"S"T"U"V"W"X"Y"Z"["\"]"^"_"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z#{#|#}#~##########$$%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''(((((((((( ( ( ( ( )))))))))))******** *!*"*#*$*%*&*'*(*)***+*,*-*.*/*0*1*2*3*4*5*6*7*8*9*:*;*<*=*>*?*@*A*B*C*D*E*F*G*H*I*J*K*L*M*N*O+P+Q+R+S+T+U+V+W+X+Y+Z+[+\+]+^+_+`+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p,q,r,s,t,u,v,w,x,y,z,{,|,},~,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------......................//////////////00000000000000001111111111111111111111122333333333333333334445566 6 6 6 6 6666777777777777777 7!7"7#7$7%7&7'7(7)7*7+7,7-7.7/70718283949596:7:8:9:::;:<:=:>:?:@:A:B;C;D;E;; Safe-InferredF G H I. ( observeAll (fromList [1..7]) == [1..7] J all-interval series. C [0,1,3,2,9,5,10,4,7,11,8,6] `elem` observeAll (all_interval_m 12) 1 length (observeAll (all_interval_m 12)) == 3856 G map (length . observeAll . all_interval_m) [4,6,8,10] == [2,4,24,288] K of . C let r = [[0,1,5,2,4,3],[0,2,1,4,5,3],[0,4,5,2,1,3],[0,5,1,4,2,3]]  in all_interval 6 == r  Safe-Inferred9Set class database with descriptors for historically and ? theoretically significant set classes, indexed by Forte name. 7 lookup "6-Z17" sc_db == Just "All-Trichord Hexachord" 7 lookup "7-35" sc_db == Just "diatonic collection (d)"  Safe-Inferred5A tuning specified L& as a sequence of exact ratios, or as  a sequence of possibly inexact . 9A real valued division of a tone into one hundred parts. An approximation of a ratio. Maybe M of L. Maybe N of L. Divisions of octave.  divisions ditone == 12 O exact ratios of . Possibly inexact  of tuning. H P G . 1Convert from cents invterval to frequency ratio. < map cents_to_ratio [0,701.9550008653874,1200] == [1,3/2,2] 0Convert from frequency ratio to cents interval. A map ratio_to_cents [1,4/3,2] == [0.0,498.04499913461245,1200.0] Possibly inexact   s of tuning. O3 exact ratios reconstructued from possibly inexact   of . @ let r = [1,17/16,9/8,13/11,5/4,4/3,7/5,3/2,11/7,5/3,16/9,15/8] 9 in reconstructed_ratios 1e-2 werckmeister_iii == Just r Convert from an   to .  round (to_cents (3/2)) == 702  Convert from Q to  , ie. R.  G . Construct an exact Q that approximates  to within  epsilon.  > map (reconstructed_ratio 1e-5) [0,700,1200] == [1,442/295,2] + to_cents_r (442/295) == 699.9976981706735  Frequency n cents from f. I map (cps_shift_cents 440) [-100,100] == map octpc_to_cps [(4,8),(4,10)]  Interval in cents from p to q, ie.  of p  S q.  6 cps_difference_cents 440 (octpc_to_cps (5,2)) == 500  let abs_dif i j = abs (i - j) D in cps_difference_cents 440 (fmidi_to_cps 69.1) `abs_dif` 10 < 1e9 The Syntonic comma.  syntonic_comma == 81/80 The Pythagorean comma. " pythagorean_comma == 3^12 / 2^19 Mercators comma.  mercators_comma == 3^53 / 2^84  Calculate n th root of x. 9 12 `nth_root` 2 == twelve_tone_equal_temperament_comma 612-tone equal temperament comma (ie. 12th root of 2). ; twelve_tone_equal_temperament_comma == 1.0594630943592953 Ditone/pythagorean tuning,  see  7http://www.billalves.com/porgitaro/ditonesettuning.html D cents_i ditone == [0,114,204,294,408,498,612,702,816,906,996,1110] "Pythagorean tuning. H cents_i pythagorean == [0,90,204,294,408,498,612,702,792,906,996,1110] %3Werckmeister III, Andreas Werckmeister (1645-1706) M cents_i werckmeister_iii == [0,90,192,294,390,498,588,696,792,888,996,1092] (2Werckmeister IV, Andreas Werckmeister (1645-1706) M cents_i werckmeister_iv == [0,82,196,294,392,498,588,694,784,890,1004,1086] +1Werckmeister V, Andreas Werckmeister (1645-1706) L cents_i werckmeister_v == [0,96,204,300,396,504,600,702,792,900,1002,1098] -2Werckmeister VI, Andreas Werckmeister (1645-1706) M cents_i werckmeister_vi == [0,91,196,298,395,498,595,698,793,893,1000,1097] /.Pietro Aaron (1523) meantone temperament, see   $http://www.kylegann.com/histune.html O cents_i pietro_aaron_1523 == [0,76,193,310,386,503,580,697,773,890,1007,1083] 1'Thomas Young (1799) - Well Temperament O cents_i thomas_young_1799 == [0,94,196,298,392,500,592,698,796,894,1000,1092] 30Five-limit tuning (five limit just intonation). O cents_i five_limit_tuning == [0,112,204,316,386,498,590,702,814,884,996,1088] 5Equal temperament. * cents equal_temperament == [0,100..1100] ALa Monte Young's "The Well-Tuned Piano", see   #http://www.kylegann.com/tuning.html. L cents_i la_monte_young == [0,177,204,240,471,444,675,702,738,969,942,1173] C Ben Johnston's "Suite for Microtonal Piano" (1977), see   #http://www.kylegann.com/tuning.html J cents_i ben_johnston == [0,105,204,298,386,471,551,702,841,906,969,1088] E0Lou Harrison 16 tone Just Intonation scale, see   :http://www.microtonal-synthesis.com/scale_harrison_16.html ^ cents_i lou_harrison_16 == [0,112,182,231,267,316,386,498,603,702,814,884,933,969,1018,1088] G Harry Partch 43 tone scale, see   5http://www.microtonal-synthesis.com/scale_partch.html . cents_i partch_43 == [0,22,53,84,112,151,165 / ,182,204,231,267,294,316 ' ,347,386,418,435 3 ,471,498,520,551,583,617,649 ? ,680,702,729,765,782,814,853,884,906,933 C ,969,996,1018,1035,1049,1088,1116,1147,1178] H"Construct an isomorphic layout of r rows and c columns with  an upper left value of (i,j). I"A minimal isomorphic note layout. / let [i,j,k] = mk_isomorphic_layout 3 5 (3,-4) C in [i,take 4 j,(2,-4):take 4 k] == minimal_isomorphic_note_layout J3Make a rank two regular temperament from a list of (i,j) # positions by applying the scalars a and b. K Syntonic tuning system based on H of 5  rows and 7 columns starting at (3,-4) and a  J with a of 1200 and indicated  b. LK of 697.  divisions syntonic_697 == 17 _ cents_i syntonic_697 == [0,79,194,273,309,388,467,503,582,697,776,812,891,970,1006,1085,1164] MK of 702.  divisions syntonic_702 == 17 ^ cents_i syntonic_702 == [0,24,114,204,294,318,408,498,522,612,702,792,816,906,996,1020,1110] NRaise or lower the frequency q by octaves until it is in the  octave starting at p.  fold_to_octave_of 55 392 == 98 OHarmonic series on n. Pn elements of O. Y harmonic_series_cps_n 14 55 == [55,110,165,220,275,330,385,440,495,550,605,660,715,770] Qnth partial of f1, ie. one indexed. * map (partial 55) [1,5,3] == [55,275,165] R'Fold ratio until within an octave, ie. 1 T n U 2. S%Derivative harmonic series, based on kth partial of f1. G let {r = [52,103,155,206,258,309,361,412,464,515,567,618,670,721,773] > ;d = harmonic_series_cps_derived 5 (octpc_to_cps (1,4))}  in map round (take 15 d) == r THarmonic series to nth harmonic (folded). G harmonic_series_folded 17 == [1,17/16,9/8,5/4,11/8,3/2,13/8,7/4,15/8] U variant of T. Y map round (harmonic_series_folded_c 21) == [0,105,204,298,386,471,551,702,841,969,1088] V12-tone tuning of first 21" elements of the harmonic series. S cents_i harmonic_series_folded_21 == [0,105,204,298,386,471,551,702,841,969,1088] S  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVS  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVS   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVP  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV Safe-InferredXHMC slendro tuning. . cents_i alves_slendro == [0,231,498,765,996] ZHMC  pelog bem tuning. 0 cents_i alves_pelog_bem == [0,231,316,702,814] \HMC pelog 2,3,4,6,7 tuning. 3 cents_i alves_pelog_barang == [0,386,471,857,969] ^HMC  pelog barang tuning. 2 cents_i alves_pelog_23467 == [0,386,471,702,969] WXYZ[\]^WXYZ[\]^WXYZ[\]^WXYZ[\]^ Safe-Inferred _Odd numbers to n.  odd_to 7 == [1,3,5,7] `Generate initial row for n.  row 7 == [1,5/4,3/2,7/4] aGenerate initial column for n.  column 7 == [1,8/5,4/3,8/7] b<= G V. cGiven row and column generate matrix value at (i,j). % inner (row 7,column 7) (1,2) == 6/5 eMeyer table in form (r,c,n). C meyer_table_indices 7 == [(0,0,1/1),(0,1,5/4),(0,2,3/2),(0,3,7/4) C ,(1,0,8/5),(1,1,1/1),(1,2,6/5),(1,3,7/5) C ,(2,0,4/3),(2,1,5/3),(2,2,1/1),(2,3,7/6) F ,(3,0,8/7),(3,1,10/7),(3,2,12/7),(3,3,1/1)] fMeyer table as set of rows.  , meyer_table_rows 7 == [[1/1, 5/4, 3/2,7/4] , ,[8/5, 1/1, 6/5,7/5] , ,[4/3, 5/3, 1/1,7/6] - ,[8/7,10/7,12/7,1/1]] B let r = [[ 1/1, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8] B ,[16/9, 1/1, 10/9, 11/9, 4/3, 13/9, 14/9, 5/3] B ,[ 8/5, 9/5, 1/1, 11/10, 6/5, 13/10, 7/5, 3/2] C ,[16/11, 18/11, 20/11, 1/1, 12/11, 13/11, 14/11, 15/11] B ,[ 4/3, 3/2, 5/3, 11/6, 1/1, 13/12, 7/6, 5/4] C ,[16/13, 18/13, 20/13, 22/13, 24/13, 1/1, 14/13, 15/13] C ,[ 8/7, 9/7, 10/7, 11/7, 12/7, 13/7, 1/1, 15/14] C ,[16/15, 6/5, 4/3, 22/15, 8/5, 26/15, 28/15, 1/1]]  in meyer_table_rows 15 == r gThird element of three-tuple. hSet of unique ratios in n table.  E elements 7 == [1,8/7,7/6,6/5,5/4,4/3,7/5,10/7,3/2,8/5,5/3,12/7,7/4] < elements 9 == [1,10/9,9/8,8/7,7/6,6/5,5/4,9/7,4/3,7/5,10/7 4 ,3/2,14/9,8/5,5/3,12/7,7/4,16/9,9/5] iNumber of unique elements at n table. / map degree [7,9,11,13,15] == [13,19,29,41,49] j +http://en.wikipedia.org/wiki/Farey_sequence  let r = [[0,1/2,1]  ,[0,1/3,1/2,2/3,1] $ ,[0,1/4,1/3,1/2,2/3,3/4,1] 4 ,[0,1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5,1] = ,[0,1/6,1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5,5/6,1]] # in map farey_sequence [2..6] == r _`abcdefghij _`abcdefghij _`abcdefghij _`abcdefghij Safe-InferredkBThree interlocking harmonic series on 1:5:3, by Larry Polansky in  "Psaltery". 1 import qualified Music.Theory.Tuning.Scala as T 6 let fn = "/home/rohan/opt/scala/scl/polansky_ps.scl"  s <- T.load fn + T.scale_pitch_representations s == (0,50) 8 1 : Data.Either.rights (T.scale_pitches s) == psaltery lR of k. 2 length psaltery == 51 && length psaltery_o == 21 : psaltery_o == [1,65/64,33/32,17/16,35/32,9/8,75/64,39/32 + ,5/4,21/16,85/64,11/8,45/32 ; ,3/2,25/16,51/32,13/8,27/16,55/32,7/4,15/8] klklklkl Safe-Inferred u The set of K slendro tunings. 0 map length k_set == replicate (length k_set) 5  minimum (concat k_set) == 206 ! maximum (concat k_set) == 268.5 vAGiven a set of equal length lists calculate the average value of  each position. 1 calculate_averages [[1,2,3],[3,2,1]] == [2,2,2] w Averages of K set, p. 10. : k_averages == [233.8125,245.0625,234.0,240.8125,251.875]  The set of GM* (Gadja Mada University) slendro tunings. 2 map length gm_set == replicate (length gm_set) 5  minimum (concat gm_set) == 218  maximum (concat gm_set) == 262  Averages of GM set, p. 10. 8 gm_averages == [234.0,240.25,247.625,243.125,254.0625] ?Association list giving interval boundaries for interval class  categories (pp.10-11). Categorise an interval. Pad W% to right with spaces until at least n characters. * map (pad 3) ["S","E-L"] == ["S ","E-L"] ,Pretty interval category table (pp. 10-11).   i_category_table k_set ==  ["S L S S L "  ,"S L S S L "  ,"L L S S S "  ,"L S S S L "  ,"S S L S L "  ,"S E-L S L L "  ,"L E E S S "  ,"S S S-E L L "]  i_category_table gm_set ==  ["S L E-L E L "  ,"L S-E E S L "  ,"S S-E S L S-E"  ,"S L L S L "  ,"S S-E E-L S L "  ,"S S-E E E L "  ,"S-E S L E L "  ,"S S E-L L L "] Rational tuning derived from , p.11.  ) polansky_1984_r == sort polansky_1984_r 7 polansky_1984_r == [1/1,8/7,21/16,512/343,12/7,96/49]  import Music.Theory.List < d_dx polansky_1984_r == [1/7,19/112,989/5488,76/343,12/49]  of .  import Music.Theory.List ; map round (d_dx polansky_1984_c) == [231,240,223,240,231] mnopqrstuvwxyz{|}~mnopqrstuvwxyz{|}~mnopqrstuvwx~}|{zymnopqrstuvwxyz{|}~ Safe-Inferred3A scale has a description, a degree, and a list of es. A .scl pitch is either in Cents or is a X. Text description of scale. #The degree of the scale (number of es). The es at .  The last  element of the scale (ie. the ocatve). Is  perfect, ie. X of 2 or Cents of  1200. A pair giving the number of Cents and number of X pitches  at .  Pitch as , conversion by  if necessary.  Pitch as Q, conversion by  if  necessary, hence epsilon. ?Make scale pitches uniform, conforming to the most promininent  pitch type. Scale as list of  (ie. ) with 0 prefix. Scale as list of Q (ie. ) with 1 prefix. Comment lines being with !. Remove r. Logical or of list of predicates. Remove to end of line ! comments.  Remove comments and null lines. 0 filter_comments ["!a","b","","c"] == ["b","c"] Delete trailing ., Y fails for 700.. >Pitches are either cents (with decimal point) or ratios (with /). A map pitch ["700.0","3/2","2"] == [Left 700,Right (3/2),Right 2] $Pitch lines may contain commentary. Parse .scl file. Load .scl file. 9 s <- load "/home/rohan/opt/scala/scl/xenakis_chrom.scl" ( scale_pitch_representations s == (6,1) F scale_ratios 1e-3 s == [1,21/20,29/23,179/134,280/187,11/7,100/53,2] Subset of files in dir with an extension in ext.  Load all .scl files at dir.  , db <- load_dir "/home/rohan/opt/scala/scl"  length db == 4115 1 length (filter ((== 0) . scale_degree) db) == 1 C length (filter (== Just (Right 2)) (map scale_octave db)) == 3562  I let r = [0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 F ,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44 C ,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64 @ ,65,66,67,68,69,70,71,72,74,75,77,78,79,80,81,84,87,88 D ,90,91,92,95,96,99,100,101,105,110,112,117,118,130,140,171 ' ,180,271,311,342,366,441,612] * in nub (sort (map scale_degree db)) == r  B let r = ["Xenakis's Byzantine Liturgical mode, 5 + 19 + 6 parts" C ,"Xenakis's Byzantine Liturgical mode, 12 + 11 + 7 parts" C ,"Xenakis's Byzantine Liturgical mode, 7 + 16 + 7 parts"] A in filter (isInfixOf "Xenakis") (map scale_description db) == r  2 length (filter (not . perfect_octave) db) == 544 G mapM_ (putStrLn.scale_description) (filter (not . perfect_octave) db)   Safe-Inferred Element of "(sequence,multiplier,displacement). Tiling (sequence) Voice.  Canon of +(period,sequence,multipliers,displacements).  Sequence.  Cycle at period. : take 9 (p_cycle 18 [0,2,5]) == [0,2,5,18,20,23,36,38,41] Resolve sequence from . $ e_to_seq ([0,2,5],2,1) == [1,5,11]  e_to_seq ([0,1],3,4) == [4,7]  e_to_seq ([0],1,2) == [2] Infer  from sequence. & e_from_seq [1,5,11] == ([0,2,5],2,1) ! e_from_seq [4,7] == ([0,1],3,4)  e_from_seq [2] == ([0],1,2) Set of  from . Z of . Retrograde of  , the result  is sorted. 8 let r = [[0,7,14],[1,5,9],[2,4,6],[3,8,13],[10,11,12]] E in t_retrograde [[0,7,14],[1,6,11],[2,3,4],[5,9,13],[8,10,12]] == r The normal form of  is the [ of t and it's . 8 let r = [[0,7,14],[1,5,9],[2,4,6],[3,8,13],[10,11,12]] A in t_normal [[0,7,14],[1,6,11],[2,3,4],[5,9,13],[8,10,12]] == r Derive set of  from . ; let {r = [(21,[0,1,2],[10,8,2,4,7,5,1],[0,1,2,3,5,8,14])] P ;t = [[0,10,20],[1,9,17],[2,4,6],[3,7,11],[5,12,19],[8,13,18],[14,15,16]]}  in r_from_t t == r F G H I. ( observeAll (fromList [1..7]) == [1..7]  Search for perfect tilings of the sequence  using  multipliers from m to degree n with k parts.  of K of .  * perfect_tilings [[0,1]] [1..3] 6 3 == []  : let r = [[[0,7,14],[1,5,9],[2,4,6],[3,8,13],[10,11,12]]] 4 in perfect_tilings [[0,1,2]] [1,2,4,5,7] 15 5 == r  6 length (perfect_tilings [[0,1,2]] [1..12] 15 5) == 1  $ let r = [[[0,1],[2,5],[3,7],[4,6]] $ ,[[0,1],[2,6],[3,5],[4,7]] % ,[[0,2],[1,4],[3,7],[5,6]]] , in perfect_tilings [[0,1]] [1..4] 8 4 == r  * let r = [[[0,1],[2,5],[3,7],[4,9],[6,8]] * ,[[0,1],[2,7],[3,5],[4,8],[6,9]] * ,[[0,2],[1,4],[3,8],[5,9],[6,7]] * ,[[0,2],[1,5],[3,6],[4,9],[7,8]] + ,[[0,3],[1,6],[2,4],[5,9],[7,8]]] - in perfect_tilings [[0,1]] [1..5] 10 5 == r Johnson 2004, p.2  N let r = [[0,6,12],[1,8,15],[2,11,20],[3,5,7],[4,9,14],[10,13,16],[17,18,19]] : in perfect_tilings [[0,1,2]] [1,2,3,5,6,7,9] 21 7 == [r] N let r = [[0,10,20],[1,9,17],[2,4,6],[3,7,11],[5,12,19],[8,13,18],[14,15,16]] H in perfect_tilings [[0,1,2]] [1,2,4,5,7,8,10] 21 7 == [t_retrograde r]  Variant of \, for ordered sequences, which can therefore  return ]$ when searching infinite sequences. > 5 `elemOrd` [0,2..] == False && 10 `elemOrd` [0,2..] == True A .* diagram of n places of . / v_dot_star 18 [0,2..] == "*.*.*.*.*.*.*.*.*." #A white space and index diagram of n places of . 1mapM_ (putStrLn . v_space_ix 9) [[0,2..],[1,3..]]>> 0 2 4 6 8> 1 3 5 7Insert | every n places. ? with_bars 6 (v_dot_star 18 [0,2..]) == "*.*.*.|*.*.*.|*.*.*." Variant with measure length m and number of measures n. 4 v_dot_star_m 6 3 [0,2..] == "*.*.*.|*.*.*.|*.*.*." Print .* diagram. Variant to print | at measures. Variant that discards first k measures.   Safe-Inferred{0,1,2} order 5, p.1 v_print 15 (r_voices p1)>> ..***..........> ........*.*.*..> .....*...*...*.> .*....*....*...> *......*......*{0,1,2} order 7, p.2 v_print 21 (r_voices p2)>> ..............***....> ..*.*.*..............> ...*...*...*.........> ........*....*....*..> .....*......*......*.> .*.......*.......*...> *.........*.........*{0,1} order 4, p.3 v_print 8 (r_voices p3)> > *...*... > .**..... > ...*..*. > .....*.*{0,1} order 5, p.4  mapM_ (v_print 10 . r_voices) p4> > *...*..... > .**....... > ...*....*. > .....*.*.. > ......*..*> > *....*.... > .**....... > ...*..*... > ....*...*. > .......*.*> > *...*..... > .*....*... > ..**...... > .....*..*. > .......*.*Open {1,2,3} order 5, p.4 v_print 18 (r_voices p4_b)>> ...***............> ........*.*.*.....> .........*...*...*> .*....*....*......> *......*......*...  Safe-InferredTilework for Clarinet, p.3 v_print 36 (rr_voices p3)>&> *.*..*............*.*..*............&> .*.*..*............*.*..*...........&> ........*.*..*............*.*..*....&> ....*..*.*............*..*.*........&> ...........*..*.*............*..*.*.&> ............*..*.*............*..*.*!Tilework for String Quartet, p.5  mapM_ (v_print 24 . r_voices) p5 >> ******......******......> ......******......******>> *.****.*....*.****.*....> ......*.****.*....*.****>> **.***..*...**.***..*...> ......**.***..*...**.***>> *..***.**...*..***.**...> ......*..***.**...*..***Extra Perfect (p.7) #v_print_m_from 18 6 6 (r_voices p7) >+> **.*..|......|......|......|......|......+> ......|.*.*..|.*....|......|......|......+> ......|......|......|......|.*..*.|....*.+> ......|......|...*..|.*....|...*..|......+> ......|......|....*.|...*..|......|.*....+> ......|*.....|*.....|......|*.....|......+> ....*.|......|......|*.....|......|...*..+> ......|......|......|....*.|......|*.....$Tilework for Log Drums (2005), p.10 v_print 18 (r_voices p10)>> *.*.*.............> .*...*...*........> ...*...*...*......> ......*...*...*...> ........*...*...*.> .............*.*.*#Self-Similar Melodies (1996), p.11 v_print_m 20 5 (r_voices p11)>j> *.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*.....|*.....*.....*..*..*.|....*.....*.....*...j> ....................|*.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*.....|*.....*.....*..*..*.j> ....................|....................|*.....*.....*..*..*.|....*.....*.....*...|..*..*..*.....*..... NoneZ12 not in set. - complement [0,2,4,5,7,9,11] == [1,3,6,8,10] ^_^_ None&Map to pitch-class and reduce to set.  pcset [1,13] == [1] Transpose by n.  tn 4 [1,5,6] == [5,9,10]  tn 4 [0,4,8] == [0,4,8] Invert about n.  invert 6 [4,5,6] == [6,7,8]  invert 0 [0,1,3] == [0,9,11] Composition of  about 0 and .  tni 4 [1,5,6] == [3,10,11] ' (invert 0 . tn 4) [1,5,6] == [2,3,7] Modulo 12 multiplication ' mn 11 [0,1,4,9] == invert 0 [0,1,4,9] M5, ie.  5.  m5 [0,1,3] == [0,3,5] T-related sets of p. " length (t_related [0,1,3]) == 12 : t_related [0,3,6,9] == [[0,3,6,9],[1,4,7,10],[2,5,8,11]] T/I-related set of p. # length (ti_related [0,1,3]) == 24 ; ti_related [0,3,6,9] == [[0,3,6,9],[1,4,7,10],[2,5,8,11]]  Safe-Inferred+Type pairing a stratification and a tempo. 5A stratification is a tree of integral subdivisions.  Alias for ` (quieten compiler). One indexed variant of a. ( map (at [11..13]) [1..3] == [11,12,13]  Variant of 2 with boundary rules and specified error message. 1 map (at' 'x' [11..13]) [0..4] == [1,11,12,13,1]  at' 'x' [0] 3 == undefined  Variant of b with input constraints.  mod' (-1) 2 == 1 Specialised variant of c.  Variant on d with input constraints. (Indispensibilities from stratification. ; indispensibilities [3,2,2] == [11,0,6,3,9,1,7,4,10,2,8,5] ; indispensibilities [2,3,2] == [11,0,6,2,8,4,10,1,7,3,9,5] ; indispensibilities [2,2,3] == [11,0,4,8,2,6,10,1,5,9,3,7] B indispensibilities [3,5] == [14,0,9,3,6,12,1,10,4,7,13,2,11,5,8] "The indispensibility measure (). ' map (lower_psi [2] 1) [1..2] == [1,0] ) map (lower_psi [3] 1) [1..3] == [2,0,1] - map (lower_psi [2,2] 2) [1..4] == [3,0,2,1] - map (lower_psi [5] 1) [1..5] == [4,0,3,1,2] 1 map (lower_psi [3,2] 2) [1..6] == [5,0,3,1,4,2] 1 map (lower_psi [2,3] 2) [1..6] == [5,0,2,4,1,3]  The first nth primes, reversed. > reverse_primes 14 == [43,41,37,31,29,23,19,17,13,11,7,5,3,2] "Generate prime stratification for n. A map prime_stratification [2,3,5,7,11] == [[2],[3],[5],[7],[11]] F map prime_stratification [6,8,9,12] == [[3,2],[2,2,2],[3,3],[3,2,2]] A map prime_stratification [22,10,4,1] == [[11,2],[5,2],[2,2],[]] D map prime_stratification [18,16,12] == [[3,3,2],[2,2,2,2],[3,2,2]] 6Fundamental indispensibilities for prime numbers (). # map (upper_psi 2) [1..2] == [1,0] % map (upper_psi 3) [1..3] == [2,0,1] ) map (upper_psi 5) [1..5] == [4,0,3,1,2] - map (upper_psi 7) [1..7] == [6,0,4,2,5,1,3] 8 map (upper_psi 11) [1..11] == [10,0,6,4,9,1,7,3,8,2,5] > map (upper_psi 13) [1..13] == [12,0,7,4,10,1,8,5,11,2,9,3,6] 6Table such that each subsequent row deletes the least  indispensibile pulse. : thinning_table [3,2] == [[True,True,True,True,True,True] ; ,[True,False,True,True,True,True] < ,[True,False,True,False,True,True] = ,[True,False,True,False,True,False] > ,[True,False,False,False,True,False] @ ,[True,False,False,False,False,False]] Trivial pretty printer for .  $ putStrLn (thinning_table_pp [3,2]) $ putStrLn (thinning_table_pp [2,3])  ****** ******  *.**** *.****  *.*.** *.**.*  *.*.*. *..*.*  *...*. *..*..  *..... *..... /Scale values against length of list minus one. 8 relative_to_length [0..5] == [0.0,0.2,0.4,0.6,0.8,1.0]  Variant of  that scales value to lie in  (0,1).  relative_indispensibilities [3,2] == [1,0,0.6,0.2,0.8,0.4] <Align two meters (given as stratifications) to least common ! multiple of their degrees. The  function is D given as an argument so that it may be relative if required. This  generates Table 7 (p.58).  / let r = [(5,5),(0,0),(2,3),(4,1),(1,4),(3,2)] 5 in align_meters indispensibilities [2,3] [3,2] == r  ? let r = [(1,1),(0,0),(0.4,0.6),(0.8,0.2),(0.2,0.8),(0.6,0.4)] > in align_meters relative_indispensibilities [2,3] [3,2] == r / align_meters indispensibilities [2,2,3] [3,5] 8 align_meters relative_indispensibilities [2,2,3] [3,5]  Variant of d that requires b be 0.  Variant of e that requires f be 0. &Rule to prolong stratification of two  values such that = pulse at the deeper level are aligned. (Paragraph 2, p.58)   let x = ([2,2,2],1) 1 in prolong_stratifications x x == (fst x,fst x)  ! let r = ([2,5,3,3,2],[3,2,5,5]) 7 in prolong_stratifications ([2,5],50) ([3,2],60) == r B prolong_stratifications ([2,2,3],5) ([3,5],4) == ([2,2,3],[3,5]) %Arithmetic mean (average) of a list.  mean [0..5] == 2.5  Square of n.  square 5 == 25 Composition of  and . 5 align_s_mm indispensibilities ([2,2,3],5) ([3,5],4)  An attempt at Equation 5 of the CMJ paper. When n is h-1 B the output is incorrect (it is the product of the correct values  for n at h-1 and h). * map (upper_psi' 5) [1..5] /= [4,0,3,1,2] . map (upper_psi' 7) [1..7] /= [6,0,4,2,5,1,3] 9 map (upper_psi' 11) [1..11] /= [10,0,6,4,9,1,7,3,8,2,5] ? map (upper_psi' 13) [1..13] /= [12,0,7,4,10,1,8,5,11,2,9,3,6] The MPS limit equation given on p.58.  mps_limit 3 == 21 + 7/9 @The square of the product of the input sequence is summed, then / divided by the square of the sequence length. 8 mean_square_product [(0,0),(1,1),(2,2),(3,3)] == 6.125 9 mean_square_product [(2,3),(4,5)] == (6^2 + 20^2) / 2^2 AAn incorrect attempt at the description in paragraph two of p.58  of the CMJ paper. ! let p ~= q = abs (p - q) < 1e-4 - metrical_affinity [2,3] 1 [3,2] 1 ~= 0.0324 1 metrical_affinity [2,2,3] 20 [3,5] 16 ~= 0.0028 *An incorrect attempt at Equation 6 of the CMJ paper, see  omega_z.  ! let p ~= q = abs (p - q) < 1e-4 3 metrical_affinity' [2,2,2] 1 [2,2,2] 1 ~= 1.06735 3 metrical_affinity' [2,2,2] 1 [2,2,3] 1 ~= 0.57185 3 metrical_affinity' [2,2,2] 1 [2,3,2] 1 ~= 0.48575 3 metrical_affinity' [2,2,2] 1 [3,2,2] 1 ~= 0.45872 3 metrical_affinity' [3,2,2] 3 [2,2,3] 2 ~= 0.10282  Safe-Inferred<Set of 1. interval size (cents), 2. intervals as product of @ powers of primes, 3. frequency ratio and 4. harmonicity value. Barlow's indigestibility function for prime numbers. C map barlow [1,2,3,5,7,11,13] == [0,1,8/3,32/5,72/7,200/11,288/13] Generate list of factors of n from x.  factor primes 315 == [3,3,5,7]  n from g.  prime_factors 315 == [3,3,5,7] ?Collect number of occurences of each element of a sorted list. 5 multiplicities [1,1,1,2,2,3] == [(1,3),(2,2),(3,1)]  G . , prime_factors_m 315 == [(3,2),(5,1),(7,1)] Merging function for . :Collect the prime factors in a rational number given as a  numerator/5 denominator pair (n,m). Prime factors are listed in A ascending order with their positive or negative multiplicities, B depending on whether the prime factor occurs in the numerator or 8 the denominator (after cancelling out common factors). ; rational_prime_factors_m (16,15) == [(2,4),(3,-1),(5,-1)] 9 rational_prime_factors_m (10,9) == [(2,1),(3,-2),(5,1)] 4 rational_prime_factors_m (81,64) == [(2,-6),(3,4)] 4 rational_prime_factors_m (27,16) == [(2,-4),(3,3)] 9 rational_prime_factors_m (12,7) == [(2,2),(3,1),(7,-1)]  Variant of  giving results in a table  up to the n th prime. 5 rational_prime_factors_t 6 (12,7) == [2,1,0,-1,0,0] +Compute the disharmonicity of the interval (p,q) using the  prime valuation function pv. D map (disharmonicity barlow) [(9,10),(8,9)] ~= [12.733333,8.333333] The reciprocal of . @ map (harmonicity barlow) [(9,10),(8,9)] ~= [0.078534,0.120000]  Variant of  with X input. Interval ratio to cents. B map cents [16%15,16%9] == [111.73128526977776,996.0899982692251] h (i). Make j k pair of n. Table 2 (p.45)  length (table_2 0.06) == 24 Pretty printer for  values.  . mapM_ (putStrLn . table_2_pp) (table_2 0.06) 1 0.000 | 0 0 0 0 0 0 | 1:1 | Infinity 1 111.731 | 4 -1 -1 0 0 0 | 15:16 | 0.076531 1 182.404 | 1 -2 1 0 0 0 | 9:10 | 0.078534 1 203.910 | -3 2 0 0 0 0 | 8:9 | 0.120000 1 231.174 | 3 0 0 -1 0 0 | 7:8 | 0.075269 1 266.871 | -1 -1 0 1 0 0 | 6:7 | 0.071672 1 294.135 | 5 -3 0 0 0 0 | 27:32 | 0.076923 1 315.641 | 1 1 -1 0 0 0 | 5:6 | 0.099338 1 386.314 | -2 0 1 0 0 0 | 4:5 | 0.119048 1 407.820 | -6 4 0 0 0 0 | 64:81 | 0.060000 1 435.084 | 0 2 0 -1 0 0 | 7:9 | 0.064024 1 498.045 | 2 -1 0 0 0 0 | 3:4 | 0.214286 1 519.551 | -2 3 -1 0 0 0 | 20:27 | 0.060976 1 701.955 | -1 1 0 0 0 0 | 2:3 | 0.272727 1 764.916 | 1 -2 0 1 0 0 | 9:14 | 0.060172 1 813.686 | 3 0 -1 0 0 0 | 5:8 | 0.106383 1 884.359 | 0 -1 1 0 0 0 | 3:5 | 0.110294 1 905.865 | -4 3 0 0 0 0 | 16:27 | 0.083333 1 933.129 | 2 1 0 -1 0 0 | 7:12 | 0.066879 1 968.826 | -2 0 0 1 0 0 | 4:7 | 0.081395 1 996.090 | 4 -2 0 0 0 0 | 9:16 | 0.107143 1 1017.596 | 0 2 -1 0 0 0 | 5:9 | 0.085227 1 1088.269 | -3 1 1 0 0 0 | 8:15 | 0.082873 1 1200.000 | 1 0 0 0 0 0 | 1:2 | 1.000000  Safe-Inferred'Common music notation durational model division of whole note number of dots tuplet modifier Are multipliers equal? *Compare durations with equal multipliers.  Erroring variant of .  BSort a pair of equal type values using given comparison function. * sort_pair compare ('b','a') == ('a','b')  $True if neither duration is dotted. 8Sum undotted divisions, input is required to be sorted. 6Sum dotted divisions, input is required to be sorted. 3 sum_dur_dotted (4,1,4,1) == Just (Duration 2 1 1) 3 sum_dur_dotted (4,0,2,1) == Just (Duration 1 0 1) 3 sum_dur_dotted (8,1,4,0) == Just (Duration 4 2 1) 4 sum_dur_dotted (16,0,4,2) == Just (Duration 2 0 1) ASum durations. Not all durations can be summed, and the present  algorithm is not exhaustive. # import Music.Theory.Duration.Name > sum_dur quarter_note eighth_note == Just dotted_quarter_note ; sum_dur dotted_quarter_note eighth_note == Just half_note L sum_dur quarter_note dotted_eighth_note == Just double_dotted_quarter_note Erroring variant of . Give MusicXML type for division. F map whole_note_division_to_musicxml_type [2,4] == ["half","quarter"]  Variant of  extracting   from . 5 duration_to_musicxml_type quarter_note == "quarter" Give Lilypond notation for . Note that the duration  multiplier is not written. # import Music.Theory.Duration.Name M map duration_to_lilypond_type [half_note,dotted_quarter_note] == ["2","4."] /Calculate number of beams at notated division. 0 whole_note_division_to_beam_count 32 == Just 3 Calculate number of beams at . = map duration_beam_count [half_note,sixteenth_note] == [0,2] lm instance in terms of  .      l               l Safe-Inferred !"#$%&'()*+,- !"#$%&'()*+,- &%$#"!'-,+*)( !"#$%&'()*+,- Safe-Inferred.Rational Quarter-Note /BRational quarter note to duration value. It is a mistake to hope ; this could handle tuplets directly since, for instance, a 3:2 D dotted note will be of the same duration as a plain undotted note. 1 rq_to_duration (3/4) == Just dotted_eighth_note 0Is . a cmn duration. 2 map rq_is_cmn [1/4,1/5,1/8] == [True,False,True] 1 Variant of / with error message. 2,Convert a whole note division integer to an . value. 8 map whole_note_division_to_rq [1,2,4,8] == [4,2,1,1/2] 3Apply dots to an . duration. * map (rq_apply_dots 1) [1,2] == [3/2,7/4] 4Convert  to . value, see / for  partial inverse. ? map duration_to_rq [half_note,dotted_quarter_note] == [2,3/2] 5n function for  via 4. 4 half_note `duration_compare_rq` quarter_note == GT 6. modulo. / map (rq_mod (5/2)) [3/2,3/4,5/2] == [1,1/4,0] 7Is p divisible by q , ie. is the k of p/q o 1. 7 map (rq_divisible_by (3%2)) [1%2,1%3] == [True,False] 8Is . a whole number (ie. is k o 1. 3 map rq_is_integral [1,3/2,2] == [True,False,True] 9Return j of . if k o 1. 6 map rq_integral [1,3/2,2] == [Just 1,Nothing,Just 2] :(Derive the tuplet structure of a set of . values.  ) rq_derive_tuplet_plain [1/2] == Nothing - rq_derive_tuplet_plain [1/2,1/2] == Nothing - rq_derive_tuplet_plain [1/4,1/4] == Nothing 0 rq_derive_tuplet_plain [1/3,2/3] == Just (3,2) 4 rq_derive_tuplet_plain [1/2,1/3,1/6] == Just (6,4) 0 rq_derive_tuplet_plain [1/3,1/6] == Just (6,4) 0 rq_derive_tuplet_plain [2/5,3/5] == Just (5,4) ; rq_derive_tuplet_plain [1/3,1/6,2/5,1/10] == Just (30,16) B map rq_derive_tuplet_plain [[1/3,1/6],[2/5,1/10]] == [Just (6,4) D ,Just (10,8)] ;(Derive the tuplet structure of a set of . values. + rq_derive_tuplet [1/4,1/8,1/8] == Nothing * rq_derive_tuplet [1/3,2/3] == Just (3,2) . rq_derive_tuplet [1/2,1/3,1/6] == Just (3,2) * rq_derive_tuplet [2/5,3/5] == Just (5,4) 4 rq_derive_tuplet [1/3,1/6,2/5,1/10] == Just (15,8) <9Remove tuplet multiplier from value, ie. to give notated A duration. This seems odd but is neccessary to avoid ambiguity.  Ie. is 1 a quarter note or a 3:2! tuplet dotted-quarter-note etc. = map (rq_un_tuplet (3,2)) [1,2/3,1/2,1/3] == [3/2,1,3/4,1/2] =If an .* duration is un-representable by a single cmn  duration, give tied notation.  9 catMaybes (map rq_to_cmn [1..9]) == [(4,1),(4,3),(8,1)] : map rq_to_cmn [5/4,5/8] == [Just (1,1/4),Just (1/2,1/8)] >BPredicate to determine if a segment can be notated either without # a tuplet or with a single tuplet. % rq_can_notate [1/2,1/4,1/4] == True ! rq_can_notate [1/3,1/6] == True " rq_can_notate [2/5,1/10] == True + rq_can_notate [1/3,1/6,2/5,1/10] == False ) rq_can_notate [4/7,1/7,6/7,3/7] == True ./0123456789:;<=>./0123456789:;<=>./0123456789:;<=>./0123456789:;<=> Safe-Inferred? Annotated . @5Standard music notation durational model annotations HDoes ? being a tuplet? IDoes ? end a tuplet? JIs ? tied to the the right? KAnnotate a sequence of ? as a tuplet. # import Music.Theory.Duration.Name G da_tuplet (3,2) [(quarter_note,[Tie_Left]),(eighth_note,[Tie_Right])] LTransform predicates into p predicate such that if f  holds then q, if g holds then r else s. ; map (begin_end_cmp (== '{') (== '}')) "{a}" == [LT,EQ,GT] M Variant of L , predicates are constructed by o. 4 map (begin_end_cmp_eq '{' '}') "{a}" == [LT,EQ,GT] N Given an p predicate where q opens a group, r  closes a group, and s) continues current group, construct tree  from list.  " let {l = "a {b {c d} e f} g h i" 3 ;t = group_tree (begin_end_cmp_eq '{' '}') l}  in catMaybes (flatten t) == l ) let d = putStrLn . drawTree . fmap show > in d (group_tree (begin_end_cmp_eq '(' ')') "a(b(cd)ef)ghi") OGroup tuplets into a t. Branch nodes have label u,  leaf nodes label v ?.  0 import Music.Theory.Duration.Name.Abbreviation  let d = [(q,[]) % ,(e,[Begin_Tuplet (3,2,e)]) = ,(s,[Begin_Tuplet (3,2,s)]),(s,[]),(s,[End_Tuplet])  ,(e,[End_Tuplet])  ,(q,[])] 2 in catMaybes (flatten (da_group_tuplets d)) == d P Variant of w that places separator at left. - break_left (== 3) [1..6] == ([1..3],[4..6]) ) break_left (== 3) [1..3] == ([1..3],[]) Q Variant of P that balances begin & end predicates. . break_left (== ')') "test (sep) _) balanced" > sep_balanced True (== '(') (== ')') "test (sep) _) balanced" @ sep_balanced False (== '(') (== ')') "(test (sep) _) balanced" RBGroup non-nested tuplets, ie. groups nested tuplets at one level. SKeep right variant of x", unused rhs values are returned. G zip_with_kr (,) [1..3] ['a'..'e'] == ([(1,'a'),(2,'b'),(3,'c')],"de") TKeep right variant of y", unused rhs values are returned. F zip_kr [1..4] ['a'..'f'] == ([(1,'a'),(2,'b'),(3,'c'),(4,'d')],"ef") Ux+ variant that adopts the shape of the lhs. & let {p = [Left 1,Right [2,3],Left 4]  ;q = "abcd"} N in nn_reshape (,) p q == [Left (1,'a'),Right [(2,'b'),(3,'c')],Left (4,'d')] VReplace elements at  Traversable with result of joining with  elements from list. W Variant of V that considers only v elements at   Traversable.  let {s = "a(b(cd)ef)ghi" 3 ;t = group_tree (begin_end_cmp_eq '(' ')') s}  in adopt_shape_m (,) [1..13] t XDoes a have C and D? YDoes d have C and D? ?@ABCDEFGHIJKLMNOPQRSTUVWXY?@ABCDEFGHIJKLMNOPQRSTUVWXY@DCBA?EFGHIJKLMNOPQRSTUVWXY?@DCBAEFGHIJKLMNOPQRSTUVWXY Safe-Inferred!Z[\]^_`abcdefghijklmnopqrstuvwxyz!Z[\]^_`abcdefghijklmnopqrstuvwxyz!Z^]\[_cba`dhgfeinmlkjotsrqpuzyxwv!Z[\]^_`abcdefghijklmnopqrstuvwxyz Safe-Inferred{A Time Signature is a (numerator,denominator) pair. |8Tied, non-multiplied durations to fill a whole measure. . ts_whole_note (3,8) == [dotted_quarter_note] % ts_whole_note (2,2) == [whole_note] }Duration of measure in .. / map ts_whole_note_rq [(3,8),(2,2)] == [3/2,4] ~ Duration, in ., of a measure of indicated {. $ map ts_rq [(3,4),(5,8)] == [3,5/2] $Uniform division of time signature.  ts_divisions (3,4) == [1,1,1] % ts_divisions (3,8) == [1/2,1/2,1/2]  ts_divisions (2,2) == [2,2]  ts_divisions (1,1) == [4] AConvert a duration to a pulse count in relation to the indicated  time signature. , ts_duration_pulses (3,8) quarter_note == 2 1Rewrite time signature to indicated denominator.  ts_rewrite 8 (3,4) == (6,8) Sum time signatures. " ts_sum [(3,16),(1,2)] == (11,16) {|}~{|}~{|}~{|}~ Safe-Inferred7A tempo marking is in terms of a common music notation . ;Duration of a RQ value, in seconds, given indicated tempo. , rq_to_seconds (quarter_note,90) 1 == 60/90 ;The duration, in seconds, of a pulse at the indicated time  signature and tempo marking. # import Music.Theory.Duration.Name / pulse_duration (6,8) (quarter_note,60) == 1/2 =The duration, in seconds, of a measure at the indicated time  signaure and tempo marking. / measure_duration (3,4) (quarter_note,90) == 2 2 measure_duration (6,8) (quarter_note,120) == 3/2 z variant of .  Safe-InferredRemove duplicate elements with { and then |.  set_l [3,3,3,2,2,1] == [1,2,3] 'Size of powerset of set of cardinality n, ie. 2 } n. + map n_powerset [6..9] == [64,128,256,512] "Powerset, ie. set of all subsets. - sort (powerset [1,2]) == [[],[1],[1,2],[2]] E map length (map (\n -> powerset [1..n]) [6..9]) == [64,128,256,512] Two element subsets. & pairs [1,2,3] == [(1,2),(1,3),(2,3)] Three element subsets.  5 triples [1..4] == [(1,2,3),(1,2,4),(1,3,4),(2,3,4)] A let f n = genericLength (triples [1..n]) == nk_combinations n 3  in all f [1..15] )Set expansion (ie. to multiset of degree n). 9 expand_set 4 [1,2,3] == [[1,1,2,3],[1,2,2,3],[1,2,3,3]] &All distinct multiset partitions, see ~.  C partitions "aab" == [["aab"],["a","ab"],["b","aa"],["b","a","a"]]  partitions "abc" == [["abc"] 7 ,["bc","a"],["b","ac"],["c","ab"] % ,["c","b","a"]] Cartesian product of two sets. ; let r = [('a',1),('a',2),('b',1),('b',2),('c',1),('c',2)] ' in cartesian_product "abc" [1,2] == r  Safe-Inferred Safe-Inferred+Function to spell a . #Common music notation pitch value. 7Enumeration of common music notation note alterations. 1Enumeration of common music notation note names (C to B).  and  duple.  Octaves are s, the octave of middle C is 4. *Pitch classes are modulo twelve integers. Pretty printer for  (unicode, see ). $ pitch_pp (Pitch E Flat 4) == "E&m4" 0 pitch_pp (Pitch F QuarterToneSharp 3) == "F23" Pretty printer for  (ASCII, see ). + pitch_pp_ascii (Pitch E Flat 4) == "ees4" 7 pitch_pp_ascii (Pitch F QuarterToneSharp 3) == "fih3"  Transform  to pitch-class number. # map note_to_pc [C,E,G] == [0,4,7]  Transform " to semitone alteration. Returns  u for non-semitone alterations. G map alteration_to_diff [Flat,QuarterToneSharp] == [Just (-1),Nothing]  Transform  to semitone alteration. 3 map alteration_to_diff_err [Flat,Sharp] == [-1,1]  Transform $ to fractional semitone alteration,  ie. allow quarter tones. - alteration_to_fdiff QuarterToneSharp == 0.5 ,Transform fractional semitone alteration to ,  ie. allow quarter tones. = map fdiff_to_alteration [-0.5,0.5] == [Just QuarterToneFlat ? ,Just QuarterToneSharp] Unicode has entries for Musical Symbols in the range U+1D100  through U+1D1FF. The 3/4% symbols are non-standard, here they  correspond to MUSICAL SYMBOL FLAT DOWN and MUSICAL SYMBOL SHARP  UP. = map alteration_symbol [minBound .. maxBound] == "+-&m3&n2&o0*" The Lilypond" ASCII spellings for alterations. D map alteration_ly_name [Flat .. Sharp] == ["es","eh","","ih","is"] Raise # by a quarter tone where possible. < alteration_raise_quarter_tone Flat == Just QuarterToneFlat 6 alteration_raise_quarter_tone DoubleSharp == Nothing Lower # by a quarter tone where possible. > alteration_lower_quarter_tone Sharp == Just QuarterToneSharp 5 alteration_lower_quarter_tone DoubleFlat == Nothing Edit # by a quarter tone where possible, -0.5  lowers, 0 retains, 0.5 raises.  Simplify - to standard 12ET by deleting quarter tones. H Data.List.nub (map alteration_clear_quarter_tone [minBound..maxBound])  Simplify - to standard 12ET by deleting quarter tones. $ let p = Pitch A QuarterToneSharp 4 5 in alteration (pitch_clear_quarter_tone p) == Sharp  to  and  notation. + pitch_to_octpc (Pitch F Sharp 4) == (4,6)  to midi note number notation. ) pitch_to_midi (Pitch A Natural 4) == 69 * to fractional midi note number notation. 5 pitch_to_fmidi (Pitch A QuarterToneSharp 4) == 69.5 Extract  of  & pitch_to_pc (Pitch A Natural 4) == 9 $ pitch_to_pc (Pitch F Sharp 4) == 6  comparison, implemented via . F pitch_compare (Pitch A Natural 4) (Pitch A QuarterToneSharp 4) == LT Given  function translate from  notation to  .  Normalise  value, ie. ensure  is in (0,11).  octpc_nrm (4,16) == (5,4)  Transpose  value.  octpc_trs 7 (4,9) == (5,4) ! octpc_trs (-11) (4,9) == (3,10)  value to integral midi note number.  octpc_to_midi (4,9) == 69  Inverse of .  midi_to_octpc 69 == (4,9) Midi note number to .  let r = ["C4","E&m4","F&o4"] ? in map (pitch_pp . midi_to_pitch pc_spell_ks) [60,63,66] == r Fractional midi note number to . $ import Music.Theory.Pitch.Spelling 5 pitch_pp (fmidi_to_pitch pc_spell_ks 65.5) == "F24" 5 pitch_pp (fmidi_to_pitch pc_spell_ks 66.5) == "F04" 5 pitch_pp (fmidi_to_pitch pc_spell_ks 67.5) == "A-4" 5 pitch_pp (fmidi_to_pitch pc_spell_ks 69.5) == "B-4" Raise  of $, account for octave transposition. ; pitch_note_raise (Pitch B Natural 3) == Pitch C Natural 4 Lower  of $, account for octave transposition. 5 pitch_note_lower (Pitch C Flat 4) == Pitch B Flat 3 Rewrite  to not use 3/4 tone alterations, ie. re-spell  to 1/4 alteration. ) let {p = Pitch A ThreeQuarterToneFlat 4 & ;q = Pitch G QuarterToneSharp 4} 1 in pitch_rewrite_threequarter_alteration p == q Apply function to  of . B pitch_edit_octave (+ 1) (Pitch A Natural 4) == Pitch A Natural 5 Modal transposition of  value.  note_t_transpose C 2 == E Midi# note number to cycles per second. 6 map midi_to_cps [60,69] == [261.6255653005986,440.0]  Fractional midi# note number to cycles per second. 9 map fmidi_to_cps [69,69.1] == [440.0,442.5488940698553] !Frequency (cycles per second) to midi note number. ( map cps_to_midi [261.6,440] == [60,69] ,Frequency (cycles per second) to fractional midi note number.  cps_to_fmidi 440 == 69 , cps_to_fmidi (fmidi_to_cps 60.25) == 60.25  of .  octpc_to_cps (4,9) == 440 A@@-  Safe-Inferred<      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     <      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     <     $#"! %+*)('&,210/.-3987654:@?>=<;AGFEDCBHNMLKJIOUTSRQPV\[ZYXW]cba`_^djihgfekqponmlrxwvutsy~}|{z     <      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      Safe-Inferred$Common music notation interval. An p of q indicates  an ascending interval, r a descending interval, and s a  unison. Interval quality. Interval type or degree. #Interval type between  values. . map (interval_ty C) [E,B] == [Third,Seventh] $'Table of interval qualities. For each  gives 6 directed semitone interval counts for each allowable .  For lookup function see %, for reverse lookup see  &. %Lookup  for given  and semitone count. ) interval_q Unison 11 == Just Diminished & interval_q Third 5 == Just Augmented % interval_q Fourth 5 == Just Perfect  interval_q Unison 3 == Nothing &Lookup semitone difference of  with . * interval_q_reverse Third Minor == Just 3 1 interval_q_reverse Unison Diminished == Just 11 'Semitone difference of . I interval_semitones (interval (Pitch C Sharp 4) (Pitch E Sharp 5)) == 16 K interval_semitones (interval (Pitch C Natural 4) (Pitch D Sharp 3)) == -9 (Inclusive set of ) within indicated interval. This is not  equal to  which is not circular.  note_span E B == [E,F,G,A,B]  note_span B D == [B,C,D]  enumFromTo B D == [] )Invert p, ie. r becomes q and vice versa. . map invert_ordering [LT,EQ,GT] == [GT,EQ,LT] * Determine  between two es. P interval (Pitch C Sharp 4) (Pitch D Flat 4) == Interval Second Diminished EQ 0 K interval (Pitch C Sharp 4) (Pitch E Sharp 5) == Interval Third Major LT 1 +Apply ) to  of . J invert_interval (Interval Third Major LT 1) == Interval Third Major GT 1 ,/The signed difference in semitones between two  ! values when applied to the same . Can this be written + correctly without knowing the Interval_T? 0 quality_difference_m Minor Augmented == Just 2 8 quality_difference_m Augmented Diminished == Just (-3) / quality_difference_m Major Perfect == Nothing -Erroring variant of ,. . Transpose a  by an . P transpose (Interval Third Diminished LT 0) (Pitch C Sharp 4) == Pitch E Flat 4 /<Make leftwards (perfect fourth) and and rightwards (perfect  fifth) circles from . , let c = circle_of_fifths (Pitch F Sharp 4) < in map pitch_to_pc (snd c) == [6,1,8,3,10,5,12,7,2,9,4,11] ! !"#$%&'()*+,-./! !"#$%&'()*+,-./!"! #$%&'()*+,-./"! #$%&'()*+,-./ Safe-Inferred012012021012 Safe-Inferred3ASimplest spelling for semitone intervals. This is ambiguous for  6 which could be either aug.4 or dim.5. 3 i_to_interval 6 == Interval Fourth Augmented LT 0  map i_to_interval [0..11] 4APerform some interval simplifications. For non-tonal music some  spellings are poor, ie. (f,g#). Q interval_simplify (Interval Second Augmented LT 0) == Interval Third Minor LT 0 34343434 Safe-Inferred5 Variant of  for incomplete functions. 6%Spelling for natural (&n) notes only. < map pc_spell_natural_m [0,1] == [Just (C,Natural),Nothing] 7Erroring variant of 6. G map pc_spell_natural [0,5,7] == [(C,Natural),(F,Natural),(G,Natural)] 8=Use spelling from simplest key-signature. Note that this is  ambiguous for 8', which could be either G Sharp (&o) in A Major  or A Flat (&m) in E Flat (&m) Major. / map pc_spell_ks [6,8] == [(F,Sharp),(A,Flat)] 9Use always sharp (&o) spelling. 3 map pc_spell_sharp [6,8] == [(F,Sharp),(G,Sharp)] D Data.List.nub (map (snd . pc_spell_sharp) [1,3,6,8,10]) == [Sharp] 8 octpc_to_pitch pc_spell_sharp (4,6) == Pitch F Sharp 4 :Use always flat (&m) spelling. 1 map pc_spell_flat [6,8] == [(G,Flat),(A,Flat)] C Data.List.nub (map (snd . pc_spell_flat) [1,3,6,8,10]) == [Flat] 56789:56789:56789:56789: Safe-Inferred;'Spelling table for chromatic clusters. 8 let f (p,q) = p == sort (map (snd . pitch_to_octpc) q) ) in all f spell_cluster_c4_table == True <>Spelling for chromatic clusters. Sequence must be ascending.  Pitch class 0 maps to H, if there is no 0 then all notes are  in octave 4.  0 let f = fmap (map pitch_pp) . spell_cluster_c4 : in map f [[11,0],[11]] == [Just ["B3","C4"],Just ["B4"]] E fmap (map pitch_pp) (spell_cluster_c4 [10,11]) == Just ["A&o4","B4"] = Variant of < that runs . An  octave of 4 is the identitiy, 3 an octave below, 5 an octave  above. D fmap (map pitch_pp) (spell_cluster_c 3 [11,0]) == Just ["B2","C3"] F fmap (map pitch_pp) (spell_cluster_c 3 [10,11]) == Just ["A&o3","B3"] > Variant of < that runs  so 3 that the left-most note is in the octave given by f.   import Data.Maybe % let {f n = if n >= 11 then 3 else 4 5 ;g = map pitch_pp .fromJust . spell_cluster_f f 4 ;r = [["B3","C4"],["B3"],["C4"],["A&o4","B4"]]} ) in map g [[11,0],[11],[0],[10,11]] == r ? Variant of < that runs  so & that the left-most note is in octave o. G fmap (map pitch_pp) (spell_cluster_left 3 [11,0]) == Just ["B3","C4"] I fmap (map pitch_pp) (spell_cluster_left 3 [10,11]) == Just ["A&o3","B3"] ;<=>?;<=>?;<=>?;<=>?  Safe-Inferred@!A common music notation key is a , ,  A triple. A,Enumeration of common music notation modes. D2Distance along circle of fifths path of indicated @. A C positive number indicates the number of sharps, a negative number  the number of flats. ( key_fifths (A,Natural,Minor_Mode) == 0 ( key_fifths (A,Natural,Major_Mode) == 3 ) key_fifths (C,Natural,Minor_Mode) == -3 @ABCD@ABCDACB@D@ACBD! Safe-InferredEClef with octave offset. IClef enumeration type. OGive clef range as a % pair indicating the notes below and  above the staff. = map clef_range [Treble,Bass] == [Just (d4,g5),Just (f2,b3)] " clef_range Percussion == Nothing P Suggest a E given a . < map clef_suggest [c2,c4] == [Clef Bass (-1),Clef Treble 0] QSet H to 0. EFGHIJKLMNOPQ EFGHIJKLMNOPQ INMLKJEFGHOPQEFGHINMLKJOPQ" Safe-Inferred#R-Bracket sequence with left and right values. ( bracket ('<','>') "1,2,3" == "<1,2,3>" TLeft rotation. ! rotate_left 1 [1..3] == [2,3,1] % rotate_left 3 [1..5] == [4,5,1,2,3] VRight rotation. " rotate_right 1 [1..3] == [3,1,2] WRotate left by n b #p places.  rotate 8 [1..5] == [4,5,1,2,3] XRotate right by n places. " rotate_r 8 [1..5] == [3,4,5,1,2] YAll rotations. 0 rotations [0,1,3] == [[0,1,3],[1,3,0],[3,0,1]] [<Adjacent elements of list, at indicated distance, as pairs. , adj2 1 [1..5] == [(1,2),(2,3),(3,4),(4,5)]  adj2 2 [1..4] == [(1,2),(3,4)]  adj2 3 [1..5] == [(1,2),(4,5)] \%Append first element to end of list.  close [1..3] == [1,2,3,1] ][ G \. - adj2_cyclic 1 [1..3] == [(1,2),(2,3),(3,1)] ^Interleave elements of p and q. + interleave [1..3] [4..6] == [1,4,2,5,3,6] _^ of T by i and j. c interleave_rotations 9 3 [1..13] == [10,4,11,5,12,6,13,7,1,8,2,9,3,10,4,11,5,12,6,13,7,1,8,2,9,3] `&Count occurences of elements in list. ( histogram "hohoh" == [('h',3),('o',2)] aList segments of length i at distance j. 2 segments 2 1 [1..5] == [[1,2],[2,3],[3,4],[4,5]] & segments 2 2 [1..5] == [[1,2],[3,4]] b . 0 intersect_l [[1,2],[1,2,3],[1,2,3,4]] == [1,2] c . - sort (union_l [[1,3],[2,3],[3]]) == [1,2,3] d6Intersection of adjacent elements of list at distance n. > adj_intersect 1 [[1,2],[1,2,3],[1,2,3,4]] == [[1,2],[1,2,3]] eList of cycles at distance n. & cycles 2 [1..6] == [[1,3,5],[2,4,6]] . cycles 3 [1..9] == [[1,4,7],[2,5,8],[3,6,9]] . cycles 4 [1..8] == [[1,5],[2,6],[3,7],[4,8]] f Collate values of equal keys at assoc list. 9 collate [(1,'a'),(2,'b'),(1,'c')] == [(1,"ac"),(2,"b")] gMake assoc list with given key. 2 with_key 'a' [1..3] == [('a',1),('a',2),('a',3)] hIntervals to values, zero is n.  dx_d 5 [1,2,3] == [5,6,8,11] i9Integrate, ie. pitch class segment to interval sequence.  d_dx [5,6,8,11] == [1,2,3] j Elements of p not in q. # [1,2,3] `difference` [1,2] == [3] kIs p a subset of q , ie. is  of p and q o p. ! is_subset [1,2] [1,2,3] == True lIs p a superset of q, ie.  k. # is_superset [1,2,3] [1,2] == True mIs p a subsequence of q, ie. synonym for . # subsequence [1,2] [1,2,3] == True n Variant of  that requires e to be unique in p. , elem_index_unique 'a' "abcda" == undefined o>Find adjacent elements of list that bound element under given  comparator. * let f = find_bounds compare (adj [1..5]) 7 in map f [1,3.5,5] == [Just (1,2),Just (3,4),Nothing] p Variant of  from right of list.  dropRight 1 [1..9] == [1..8] qApply f at first element, and g at all other elements. * at_head negate id [1..5] == [-1,2,3,4,5] rApply f at all but last element, and g at last element. + at_last (* 2) negate [1..4] == [2,4,6,-4] s=Separate list into an initial list and a last element tuple. $ separate_last [1..5] == ([1..4],5) t(Replace directly repeated elements with u. E indicate_repetitions "abba" == [Just 'a',Just 'b',Nothing,Just 'a'] w8Given a comparison function, merge two ascending lists. ) mergeBy compare [1,3,5] [2,4] == [1..5] xw n. yx a set of ordered sequences. / merge_set [[1,3..9],[2,4..8],[10]] == [1..10] (RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy(RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy(RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy(RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy#NonezFactorial function.  (factorial 13,maxBound::Int) { Number of k" element permutations of a set of n elements. 9 (nk_permutations 4 3,nk_permutations 13 3) == (24,1716) | Number of nk permutations where n o k. < map n_permutations [1..8] == [1,2,6,24,120,720,5040,40320] - n_permutations 16 `div` 1000000 == 20922789 }Generate the permutation from p to q, ie. the permutation  that, when applied to p, gives q. D apply_permutation (permutation [0,1,3] [1,0,3]) [0,1,3] == [1,0,3] ~Apply permutation f to p. & let p = permutation [1..4] [4,3,2,1] , in apply_permutation p [1..4] == [4,3,2,1] Composition of ~ and . 7 apply_permutation_c [[0,3],[1,2]] [1..4] == [4,3,2,1] = apply_permutation_c [[0,2],[1],[3,4]] [1..5] == [3,2,1,5,4] ; apply_permutation_c [[0,1,4],[2,3]] [1..5] == [2,5,4,3,1] ; apply_permutation_c [[0,1,3],[2,4]] [1..5] == [2,4,5,1,3] True if the inverse of p is p.  6 non_invertible (permutation [0,1,3] [1,0,3]) == True & let p = permutation [1..4] [4,3,2,1] < in non_invertible p == True && P.cycles p == [[0,3],[1,2]] 'Generate a permutation from the cycles c. A apply_permutation (from_cycles [[0,1,2,3]]) [1..4] == [2,3,4,1] "Generate all permutations of size n. 5 map one_line (permutations_n 3) == [[1,2,3],[1,3,2] 5 ,[2,1,3],[2,3,1] 6 ,[3,1,2],[3,2,1]] Composition of q then p. ( let {p = from_cycles [[0,2],[1],[3,4]] & ;q = from_cycles [[0,1,4],[2,3]]  ;r = p `compose` q} 3 in apply_permutation r [1,2,3,4,5] == [2,4,5,1,3] Two line notation of p. = two_line (permutation [0,1,3] [1,0,3]) == ([1,2,3],[2,1,3]) One line notation of p.  3 one_line (permutation [0,1,3] [1,0,3]) == [2,1,3] 5 map one_line (permutations_n 3) == [[1,2,3],[1,3,2] 5 ,[2,1,3],[2,3,1] 6 ,[3,1,2],[3,2,1]]  Variant of ! that produces a compact string.  9 one_line_compact (permutation [0,1,3] [1,0,3]) == "213"  let p = permutations_n 3 B in unwords (map one_line_compact p) == "123 132 213 231 312 321" (Multiplication table of symmetric group n.  I unlines (map (unwords . map one_line_compact) (multiplication_table 3))   ==> 123 132 213 231 312 321  132 123 312 321 213 231  213 231 123 132 321 312  231 213 321 312 123 132  312 321 132 123 231 213  321 312 231 213 132 123 z{|}~z{|}~z{|}~z{|}~$None Number of k" element combinations of a set of n elements. 8 (nk_combinations 6 3,nk_combinations 13 3) == (20,286) k element subsets of s. < combinations 3 [1..4] == [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] 7 length (combinations 3 [1..5]) == nk_combinations 5 3 %NoneGenerate all permutations. % permutations [0,3] == [[0,3],[3,0]] 4 length (permutations [1..5]) == P.n_permutations 5 3Generate all distinct permutations of a multi-set. < multiset_permutations [0,1,1] == [[0,1,1],[1,1,0],[1,0,1]] &None0>Function to test is a partial sequence conforms to the target  sequence. @Function to perhaps generate an element and a new state from an 2 initial state. This is the function provided to .  Description notation of contour. "Half matrix notation for contour. A list notation for matrices.  Replace the i th value at ns with x.  replace "test" 2 'n' == "tent" Are all elements equal.  all_equal "aaa" == True 1Compare adjacent elements (p.262) left to right. * compare_adjacent [0,1,3,2] == [LT,LT,GT] Construct set of n  1% adjacent indices, left right order. 1 adjacent_indices 5 == [(0,1),(1,2),(2,3),(3,4)] All (i,j) indices, in half matrix order. 8 all_indices 4 == [(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)] Generic variant of  (p.263). Generic variant of  (p.263).  Specialised .  Specialised . Invert p. ) map ord_invert [LT,EQ,GT] == [GT,EQ,LT] Apply f to construct  from sequence. - matrix_f (,) [1..3] == [[(1,1),(1,2),(1,3)] - ,[(2,1),(2,2),(2,3)] . ,[(3,1),(3,2),(3,3)]]  Construct  with n (p.263). = contour_matrix [1..3] == [[EQ,LT,LT],[GT,EQ,LT],[GT,GT,EQ]] Half & of contour given comparison function f. > half_matrix_f (flip (-)) [2,10,6,7] == [[8,4,5],[-4,-3],[1]] ? half_matrix_f (flip (-)) [5,0,3,2] == [[-5,-2,-3],[3,2],[-1]] > half_matrix_f compare [5,0,3,2] == [[GT,GT,GT],[LT,LT],[GT]]  Construct  (p.264)  function for .  Construct  of contour (p.264).  let c = [[3,2,4,1],[3,2,1,4]] @ in map (show.contour_description) c == ["202 02 2","220 20 0"]  function for  (p.264).  Convert from  notation to . Ordering from ith to j$th element of sequence described at d. A contour_description_ix (contour_description "abdc") (0,3) == LT 3 if contour is all descending, equal or ascending.  let c = ["abc","bbb","cba"] < in map (uniform.contour_description) c == [True,True,True] " if contour does not containt any s elements.  let c = ["abc","bbb","cba"] @ map (no_equalities.contour_description) c == [True,False,True] !Set of all contour descriptions. 5 map (length.all_contours) [3,4,5] == [27,729,59049] A sequence of orderings (i,j) and (j,k) may imply ordering  for (i,k). H map implication [(LT,EQ),(EQ,EQ),(EQ,GT)] == [Just LT,Just EQ,Just GT] List of all violations at a  (p.266). Is the number of  zero. "All possible contour descriptions 7 map (length.possible_contours) [3,4,5] == [13,75,541] $All impossible contour descriptions < map (length.impossible_contours) [3,4,5] == [14,654,58508] :Calculate number of contours of indicated degree (p.263).  7 map contour_description_lm [2..7] == [1,3,6,10,15,21] # let r = [3,27,729,59049,14348907] ? in map (\n -> 3 ^ n) (map contour_description_lm [2..6]) == r  Truncate a  to have at most n elements. ' let c = contour_description [3,2,4,1] 8 in contour_truncate c 3 == contour_description [3,2,4] Is  p a prefix of q. ( let {c = contour_description [3,2,4,1] ' ;d = contour_description [3,2,4]} ' in d `contour_is_prefix_of` c == True Are s p and q equal at column n. * let {c = contour_description [3,2,4,1,5] ) ;d = contour_description [3,2,4,1]} B in map (contour_eq_at c d) [0..4] == [True,True,True,True,False]  Derive an $ contour that would be described by  %. Diverges for impossible contours. 8 draw_contour (contour_description "abdc") == [0,1,3,2] Invert . $ let c = contour_description "abdc" = in draw_contour (contour_description_invert c) == [3,2,0,1]  Transform a  to produce at most n elements.  let f i = Just (i,succ i) - in unfoldr (build_f_n f) (5,'a') == "abcde" #Attempt to construct a sequence of n elements given a  " to generate possible elements, a  that the result + sequence must conform to at each step, an  to specify the = maximum number of elements to generate when searching for a ! solution, and an initial state.  let {b_f i = Just (i,i+1) % ;c_f i x = odd (sum x `div` i)} @ in build_sequence 6 b_f c_f 20 0 == (Just [1,2,6,11,15,19],20) >Attempt to construct a sequence that has a specified contour.  The arguments are a " to generate possible elements, a  . that the result sequence must conform to, an  < to specify the maximum number of elements to generate when 1 searching for a solution, and an initial state.   import System.Random # let {f = Just . randomR ('a','z') & ;c = contour_description "atdez"  ;st = mkStdGen 2347} 4 in fst (build_contour f c 1024 st) == Just "nvruy"  A variant on $ that retries a specified number of D times using the final state of the failed attempt as the state for  the next try. # let {f = Just . randomR ('a','z') ( ;c = contour_description "atdezjh"  ;st = mkStdGen 2347} < in fst (build_contour_retry f c 64 8 st) == Just "nystzvu"  A variant on  that returns the set of all  sequences constructed. # let {f = Just . randomR ('a','z') ( ;c = contour_description "atdezjh"  ;st = mkStdGen 2347} 2 in length (build_contour_set f c 64 64 st) == 60  Variant of  that halts when an generated ; sequence is a duplicate of an already generated sequence.  let {f = randomR ('a','f') % ;c = contour_description "cafe"  ;st = mkStdGen 2346836 0 ;r = build_contour_set_nodup f c 64 64 st} : in filter ("c" `isPrefixOf`) r == ["cafe","cbed","caed"] ,Example from p.262 (quarter-note durations)   ex_1 == [2,3/2,1/2,1,2] ( compare_adjacent ex_1 == [GT,GT,LT,LT] 4 show (contour_half_matrix ex_1) == "2221 220 00 0" 8 draw_contour (contour_description ex_1) == [3,2,0,1,3] ? let d = contour_description_invert (contour_description ex_1) 5 in (show d,is_possible d) == ("0001 002 22 2",True) Example on p.265 (pitch)  ex_2 == [0,5,3] + show (contour_description ex_2) == "00 2" Example on p.265 (pitch)  ex_3 == [12,7,6,7,8,7] : show (contour_description ex_3) == "22222 2101 000 01 2" ? contour_description_ix (contour_description ex_3) (0,5) == GT 0 is_possible (contour_description ex_3) == True Example on p.266 (impossible)  show ex_4 == "2221 220 00 1"  is_possible ex_4 == False , violations ex_4 == [(0,3,4,GT),(1,3,4,GT)] 8662'NoneEnumeration of set of faces of a cube. Relation between to  values as a  (complementary,permutation) pair. Complete sequence (ie. #8). Initial half of  (ie. #4). The complete  is formed by  appending the  of the . *s for elements of the symmetric group P4. Complement of a . ? map complement [[4,1,3,2],[6,7,8,5]] == [[8,5,7,6],[2,3,4,1]] Form  from . ) 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 , ie.  or . : map lower [[4,1,3,2],[6,7,8,5]] == [[4,1,3,2],[2,3,4,1]] Application of  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]  of  , inverse of .  seq_of Q1 == [8,7,5,6,4,3,1,2]  of , ie.  G .  half_seq_of Q1 == [8,7,5,6]  of , ie.  4. 0 complement (half_seq (seq_of Q7)) == [3,4,2,1] Reverse table . 2 reverse_lookup 'b' (zip [1..] ['a'..]) == Just 2 * lookup 2 (zip [1..] ['a'..]) == Just 'b'  of  , inverse of . " label_of [8,7,5,6,4,3,1,2] == Q1  label_of (seq_of Q4) == Q4  if two  s are complementary, ie. form a . + complementary [4,2,1,3] [8,6,5,7] == True  Determine  of s. A 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])  from  p to q. 4 relate_l L L2 == (False,P.listPermute 4 [0,3,1,2])  adjacent  , see also .  adjacent s. < relations_l [L2,L,A] == [(False,P.listPermute 4 [0,2,3,1]) = ,(False,P.listPermute 4 [2,0,1,3])] Apply  to . I apply_relation (False,P.listPermute 4 [0,3,1,2]) [1,4,2,3] == [1,3,4,2] Apply sequence of  to initial .  Variant of . ? apply_relations_l (relations_l [L2,L,A,Q1]) L2 == [L2,L,A,Q1] ?Table indicating set of faces of cubes as drawn in Fig. VIII-6  (p.220). ' lookup [1,4,6,7] faces == Just F_Left 0 reverse_lookup F_Right faces == Just [2,3,5,8] 4Fig. VIII-6. Hexahedral (Octahedral) Group (p. 220)  length viii_6_l == 24 ) take 7 viii_6_l == [L2,L,A,Q1,Q7,Q3,Q9] 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]]  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]  Fig. VIII-6/b . ) viii_6b_p' == map half_seq_of viii_6b_l , nub (map (length . nub) viii_6b_p') == [4]  Variant of  with .  Fig. VIII-6/b. 5 map (viii_6b !!) [0,8,16] == [(I,[1,2,3,4,5,6,7,8]) 6 ,(G2,[3,2,4,1,7,6,8,5]) 7 ,(Q8,[6,8,5,7,2,4,1,3])] The sequence of  to give  from . 3 apply_relations_l viii_6_relations L2 == viii_6_l % length (nub viii_6_relations) == 14 The sequence of  to give  from . 4 apply_relations_l viii_6b_relations I == viii_6b_l & length (nub viii_6b_relations) == 10 ===( Safe-Inferred. with  tie right.  Boolean.  Construct . . field of . Tied field of . Is  tied right.  variant of <.  & rqt_un_tuplet (3,2) (1,T) == (3/2,T)  let f = rqt_un_tuplet (7,4) ? in map f [(2/7,F),(4/7,T),(1/7,F)] == [(1/2,F),(1,T),(1/4,F)]  Transform . to untied .  rq_rqt 3 == (3,F) !Tie last element only of list of .. , rq_tie_last [1,2,3] == [(1,F),(2,F),(3,T)] Transform a list of  to a list of ? . The flag . indicates if the initial value is tied left. 1 rqt_to_duration_a False [(1,T),(1/4,T),(3/4,F)]   variant of >.   variant of =. ( rqt_to_cmn (5,T) == Just ((4,T),(1,T)) , rqt_to_cmn (5/4,T) == Just ((1,T),(1/4,T)) . rqt_to_cmn (5/7,F) == Just ((4/7,T),(1/7,F))  List variant of  . % rqt_to_cmn_l (5,T) == [(4,T),(1,T)]  Z  .  9 rqt_set_to_cmn [(1,T),(5/4,F)] == [(1,T),(1,T),(1/4,F)] A rqt_set_to_cmn [(1/5,True),(1/20,False),(1/2,False),(1/4,True)]                 )None   Variant of  where n is 1.  Divisions of n . into i equal parts grouped as j. . A quarter and eighth note triplet is written  (1,1,[2,1],False). Lift   to . Verify that grouping j sums to the divisor i. Translate from  to a sequence of . values. ? rq_div_to_rq_set_t (1,5,[1,3,1],True) == ([1/5,3/5,1/5],True) D rq_div_to_rq_set_t (1/2,6,[3,1,2],False) == ([1/4,1/12,1/6],False) Translate from result of  to seqeunce of . F rq_set_t_to_rqt ([1/5,3/5,1/5],True) == [(1/5,_f),(3/5,_f),(1/5,_t)] Transform sequence of  into sequence of . , discarding  any final tie. 3 let q = [(1,5,[1,3,1],True),(1/2,6,[3,1,2],True)] / in rq_div_seq_rq q == [1/5,3/5,9/20,1/12,1/6] Partitions of an  that sum to n. This includes the  two 'trivial paritions, into a set n 1, and a set of 1 n.  9 partitions_sum 4 == [[1,1,1,1],[2,1,1],[2,2],[3,1],[4]] D map (length . partitions_sum) [9..15] == [30,42,56,77,101,135,176] The  of . @ map (length . partitions_sum_p) [9..12] == [256,512,1024,2048] The set of all   that sum to n, a variant on  . 1 map (length . rq1_div_univ) [3..5] == [8,16,32] = map (length . rq1_div_univ) [9..12] == [512,1024,2048,4096]        * Safe-Inferred5 Variant of  allowing multiple rules. Predicate function at . Structure given to  to decide simplification. The  structure is  (ts,start-rq,(left-rq,right-rq)).  Variant of  catMaybes#. If all elements of the list are Just  a , then gives Just [a] else gives u. + all_just (map Just [1..3]) == Just [1..3] - all_just [Just 1,Nothing,Just 3] == Nothing  Variant of >? that preserves first M. . all_right (map Right [1..3]) == Right [1..3] 3 all_right [Right 1,Left 'a',Left 'b'] == Left 'a'  Applies a join1 function to the first two elements of the list.  If the join4 function succeeds the joined element is considered  for further coalescing.  0 coalesce (\p q -> Just (p + q)) [1..5] == [15] 7 let jn p q = if even p then Just (p + q) else Nothing 4 in coalesce jn [1..5] == map sum [[1],[2,3],[4,5]]  Variant of  with accumulation parameter.  > coalesce_accum (\i p q -> Left (p + q)) 0 [1..5] == [(0,15)]  ? let jn i p q = if even p then Left (p + q) else Right (p + i) > in coalesce_accum jn 0 [1..7] == [(0,1),(1,5),(6,9),(15,13)] = let jn i p q = if even p then Left (p + q) else Right [p,q] @ in coalesce_accum jn [] [1..5] == [([],1),([1,2],5),([5,4],9)]  Variant of  that accumulates running sum. 8 let f i p q = if i == 1 then Just (p + q) else Nothing 2 in coalesce_sum (+) 0 f [1,1/2,1/4,1/4] == [1,1]  Lower L to O by discarding M. !@Take elements while the sum of the prefix is less than or equal B to the indicated value. Returns also the difference between the E prefix sum and the requested sum. Note that zero elements are kept  left. ( take_sum_by id 3 [2,1] == ([2,1],0,[]) ' take_sum_by id 3 [2,2] == ([2],1,[2]) / take_sum_by id 3 [2,1,0,1] == ([2,1,0],0,[1]) $ take_sum_by id 3 [4] == ([],3,[4]) * take_sum_by id 0 [1..5] == ([],0,[1..5]) " Variant of ! with  function. # Variant of "+ that requires the prefix to sum to value. 5 take_sum_by_eq id 3 [2,1,0,1] == Just ([2,1,0],[1]) & take_sum_by_eq id 3 [2,2] == Nothing $Recursive variant of #. : split_sum_by_eq id [3,3] [2,1,0,3] == Just [[2,1,0],[3]] - split_sum_by_eq id [3,3] [2,2,2] == Nothing %6Split sequence such that the prefix sums to precisely m. The D third element of the result indicates if it was required to divide E an element. Not that zero elements are kept left. If the required E sum is non positive, or the input list does not sum to at least the  required sum, gives nothing. 1 split_sum 5 [2,3,1] == Just ([2,3],[1],Nothing) 6 split_sum 5 [2,1,3] == Just ([2,1,2],[1],Just (2,1)) D split_sum 2 [3/2,3/2,3/2] == Just ([3/2,1/2],[1,3/2],Just (1/2,1)) 6 split_sum 6 [1..10] == Just ([1..3],[4..10],Nothing) I fmap (\(a,_,c)->(a,c)) (split_sum 5 [1..]) == Just ([1,2,2],Just (2,1))  split_sum 0 [1..] == Nothing  split_sum 3 [1,1] == Nothing 2 split_sum 3 [2,1,0] == Just ([2,1,0],[],Nothing) 5 split_sum 3 [2,1,0,1] == Just ([2,1,0],[1],Nothing) & Alias for ", used locally for documentation. ' Alias for ]", used locally for documentation. ( Variant of % that operates at  sequences.  ) let r = Just ([(3,_f),(2,_t)],[(1,_f)]) 0 in rqt_split_sum 5 [(3,_f),(2,_t),(1,_f)] == r 0 let r = Just ([(3,_f),(1,_t)],[(1,_t),(1,_f)]) 0 in rqt_split_sum 4 [(3,_f),(2,_t),(1,_f)] == r ) Separate  values in sequences summing to . values. This  is a recursive variant of (. Note that is does not  ensure cmn notation of values.   let d = [(2,_f),(2,_f),(2,_f)] 3 in rqt_separate [3,3] d == Right [[(2,_f),(1,_t)] 3 ,[(1,_f),(2,_f)]]  $ let d = [(5/8,_f),(1,_f),(3/8,_f)] 7 in rqt_separate [1,1] d == Right [[(5/8,_f),(3/8,_t)] 7 ,[(5/8,_f),(3/8,_f)]] 6 let d = [(4/7,_t),(1/7,_f),(1,_f),(6/7,_f),(3/7,_f)] B in rqt_separate [1,1,1] d == Right [[(4/7,_t),(1/7,_f),(2/7,_t)] 9 ,[(5/7,_f),(2/7,_t)] : ,[(4/7,_f),(3/7,_f)]] + If the input ! sequence cannot be notated (see   2) separate into equal parts, so long as each part  is not less than i.  3 rqt_separate_tuplet undefined [(1/3,_f),(1/6,_f)] < rqt_separate_tuplet undefined [(4/7,_t),(1/7,_f),(2/7,_f)]  ' let d = map rq_rqt [1/3,1/6,2/5,1/10] > in rqt_separate_tuplet (1/8) d == Right [[(1/3,_f),(1/6,_f)] @ ,[(2/5,_f),(1/10,_f)]]  : let d = [(1/5,True),(1/20,False),(1/2,False),(1/4,True)] ! in rqt_separate_tuplet (1/16) d  A let d = [(2/5,_f),(1/5,_f),(1/5,_f),(1/5,_t),(1/2,_f),(1/2,_f)]  in rqt_separate_tuplet (1/2) d / let d = [(4/10,True),(1/10,False),(1/2,True)]  in rqt_separate_tuplet (1/2) d ,Recursive variant of +. ) let d = map rq_rqt [1,1/3,1/6,2/5,1/10] 0 in rqt_tuplet_subdivide (1/8) d == [[(1/1,_f)] 9 ,[(1/3,_f),(1/6,_f)] ; ,[(2/5,_f),(1/10,_f)]] -Sequence variant of ,. : let d = [(1/5,True),(1/20,False),(1/2,False),(1/4,True)] ' in rqt_tuplet_subdivide_seq (1/2) [d] .8If a tuplet is all tied, it ought to be a plain value?! 8 rqt_tuplet_sanity_ [(4/10,_t),(1/10,_f)] == [(1/2,_f)] 0 Separate .! sequence into measures given by . length.  I to_measures_rq [3,3] [2,2,2] == Right [[(2,_f),(1,_t)],[(1,_f),(2,_f)]] 7 to_measures_rq [3,3] [6] == Right [[(3,_t)],[(3,_f)]] B to_measures_rq [1,1,1] [3] == Right [[(1,_t)],[(1,_t)],[(1,_f)]]  to_measures_rq [3,3] [2,2,1]  to_measures_rq [3,2] [2,2,2]  let d = [4/7,33/28,9/20,4/5] M in to_measures_rq [3] d == Right [[(4/7,_f),(33/28,_f),(9/20,_f),(4/5,_f)]] 1 Variant of 0 that ensures  are cmn - durations. This is not a good composition.  C to_measures_rq_cmn [6,6] [5,5,2] == Right [[(4,_t),(1,_f),(1,_t)] = ,[(4,_f),(2,_f)]]  8 let r = [[(4/7,_t),(1/7,_f),(1,_f),(6/7,_f),(3/7,_f)]] 6 in to_measures_rq_cmn [3] [5/7,1,6/7,3/7] == Right r S to_measures_rq_cmn [1,1,1] [5/7,1,6/7,3/7] == Right [[(4/7,_t),(1/7,_f),(2/7,_t)] S ,[(4/7,_t),(1/7,_f),(2/7,_t)] K ,[(4/7,_f),(3/7,_f)]] 2 Variant of 0 with measures given by  { values. Does not ensure  are cmn  durations.  J to_measures_ts [(1,4)] [5/8,3/8] /= Right [[(1/2,_t),(1/8,_f),(3/8,_f)]] J to_measures_ts [(1,4)] [5/7,2/7] /= Right [[(4/7,_t),(1/7,_f),(2/7,_f)]]   let {m = replicate 18 (1,4) : ;x = [3/4,2,5/4,9/4,1/4,3/2,1/2,7/4,1,5/2,11/4,3/2]} @ in to_measures_ts m x == Right [[(3/4,_f),(1/4,_t)],[(1/1,_t)] @ ,[(3/4,_f),(1/4,_t)],[(1/1,_f)] 7 ,[(1/1,_t)],[(1/1,_t)] I ,[(1/4,_f),(1/4,_f),(1/2,_t)],[(1/1,_f)] @ ,[(1/2,_f),(1/2,_t)],[(1/1,_t)] I ,[(1/4,_f),(3/4,_t)],[(1/4,_f),(3/4,_t)] @ ,[(1/1,_t)],[(3/4,_f),(1/4,_t)] 7 ,[(1/1,_t)],[(1/1,_t)] A ,[(1/2,_f),(1/2,_t)],[(1/1,_f)]] - to_measures_ts [(3,4)] [4/7,33/28,9/20,4/5] 9 to_measures_ts (replicate 3 (1,4)) [4/7,33/28,9/20,4/5] 3 Variant of 2 that allows for duration field ? operation but requires that measures be well formed. This is @ useful for re-grouping measures after notation and ascription. 4(Divide measure into pulses of indicated . durations. Measure 5 must be of correct length but need not contain only cmn A durations. Pulses are further subdivided if required to notate  tuplets correctly, see -.  B let d = [(1/4,_f),(1/4,_f),(2/3,_t),(1/6,_f),(16/15,_f),(1/5,_f) 9 ,(1/5,_f),(2/5,_t),(1/20,_f),(1/2,_f),(1/4,_t)]  in m_divisions_rq [1,1,1,1] d A m_divisions_rq [1,1,1] [(4/7,_f),(33/28,_f),(9/20,_f),(4/5,_f)] 5 Variant of 4& that determines pulse divisions from  {.  & let d = [(4/7,_t),(1/7,_f),(2/7,_f)] ' in m_divisions_ts (1,4) d == Just [d]  ' let d = map rq_rqt [1/3,1/6,2/5,1/10] 8 in m_divisions_ts (1,4) d == Just [[(1/3,_f),(1/6,_f)] : ,[(2/5,_f),(1/10,_f)]] ) let d = map rq_rqt [4/7,33/28,9/20,4/5] 8 in m_divisions_ts (3,4) d == Just [[(4/7,_f),(3/7,_t)] 8 ,[(3/4,_f),(1/4,_t)] 9 ,[(1/5,_f),(4/5,_f)]] 6Composition of 0 and 4, where 4 measures are initially given as sets of divisions.   let m = [[1,1,1],[1,1,1]] D in to_divisions_rq m [2,2,2] == Just [[[(1,_t)],[(1,_f)],[(1,_t)]] E ,[[(1,_f)],[(1,_t)],[(1,_f)]]]  % let d = [2/7,1/7,4/7,5/7,8/7,1,1/7] I in to_divisions_rq [[1,1,1,1]] d == Just [[[(2/7,_f),(1/7,_f),(4/7,_f)] I ,[(4/7,_t),(1/7,_f),(2/7,_t)] @ ,[(6/7,_f),(1/7,_t)] B ,[(6/7,_f),(1/7,_f)]]]   let d = [5/7,1,6/7,3/7] G in to_divisions_rq [[1,1,1]] d == Just [[[(4/7,_t),(1/7,_f),(2/7,_t)] G ,[(4/7,_t),(1/7,_f),(2/7,_t)] @ ,[(4/7,_f),(3/7,_f)]]]  % let d = [2/7,1/7,4/7,5/7,1,6/7,3/7] I in to_divisions_rq [[1,1,1,1]] d == Just [[[(2/7,_f),(1/7,_f),(4/7,_f)] I ,[(4/7,_t),(1/7,_f),(2/7,_t)] I ,[(4/7,_t),(1/7,_f),(2/7,_t)] B ,[(4/7,_f),(3/7,_f)]]]  let d = [4/7,33/28,9/20,4/5] > in to_divisions_rq [[1,1,1]] d == Just [[[(4/7,_f),(3/7,_t)] > ,[(3/4,_f),(1/4,_t)] @ ,[(1/5,_f),(4/5,_f)]]] 7 Variant of 6 with measures given as set of  {.  . let d = [3/5,2/5,1/3,1/6,7/10,17/15,1/2,1/6] < in to_divisions_ts [(4,4)] d == Just [[[(3/5,_f),(2/5,_f)] E ,[(1/3,_f),(1/6,_f),(1/2,_t)] < ,[(1/5,_f),(4/5,_t)] G ,[(1/3,_f),(1/2,_f),(1/6,_f)]]]  . let d = [3/5,2/5,1/3,1/6,7/10,29/30,1/2,1/3] < in to_divisions_ts [(4,4)] d == Just [[[(3/5,_f),(2/5,_f)] E ,[(1/3,_f),(1/6,_f),(1/2,_t)] < ,[(1/5,_f),(4/5,_t)] G ,[(1/6,_f),(1/2,_f),(1/3,_f)]]]  , let d = [3/5,2/5,1/3,1/6,7/10,4/5,1/2,1/2] < in to_divisions_ts [(4,4)] d == Just [[[(3/5,_f),(2/5,_f)] E ,[(1/3,_f),(1/6,_f),(1/2,_t)] < ,[(1/5,_f),(4/5,_f)] > ,[(1/2,_f),(1/2,_f)]]]  let d = [4/7,33/28,9/20,4/5] < in to_divisions_ts [(3,4)] d == Just [[[(4/7,_f),(3/7,_t)] < ,[(3/4,_f),(1/4,_t)] > ,[(1/5,_f),(4/5,_f)]]] 8Pulse tuplet derivation. D p_tuplet_rqt [(2/3,_f),(1/3,_t)] == Just ((3,2),[(1,_f),(1/2,_t)]) I p_tuplet_rqt (map rq_rqt [1/3,1/6]) == Just ((3,2),[(1/2,_f),(1/4,_f)]) J p_tuplet_rqt (map rq_rqt [2/5,1/10]) == Just ((5,4),[(1/2,_f),(1/8,_f)]) . p_tuplet_rqt (map rq_rqt [1/3,1/6,2/5,1/10]) 9ANotate pulse, ie. derive tuplet if neccesary. The flag indicates $ if the initial value is tied left. $ p_notate False [(2/3,_f),(1/3,_t)] % p_notate False [(2/5,_f),(1/10,_t)] - p_notate False [(1/4,_t),(1/8,_f),(1/8,_f)] ' p_notate False (map rq_rqt [1/3,1/6]) ( p_notate False (map rq_rqt [2/5,1/10]) ; p_notate False (map rq_rqt [1/3,1/6,2/5,1/10]) == Nothing :Notate measure.  7 m_notate True [[(2/3,_f),(1/3,_t)],[(1,_t)],[(1,_f)]]  ! let f = m_notate False . concat G fmap f (to_divisions_ts [(4,4)] [3/5,2/5,1/3,1/6,7/10,17/15,1/2,1/6]) G fmap f (to_divisions_ts [(4,4)] [3/5,2/5,1/3,1/6,7/10,29/30,1/2,1/3]) ;Multiple measure notation.  % let d = [2/7,1/7,4/7,5/7,8/7,1,1/7] / in fmap mm_notate (to_divisions_ts [(4,4)] d)  % let d = [2/7,1/7,4/7,5/7,1,6/7,3/7] / in fmap mm_notate (to_divisions_ts [(4,4)] d) , let d = [3/5,2/5,1/3,1/6,7/10,4/5,1/2,1/2] / in fmap mm_notate (to_divisions_ts [(4,4)] d) < Transform  to . = Transform  to set of . >"The default table of simplifiers. ' default_table ((3,4),1,(1,1)) == True ?/The default eighth-note pulse simplifier rule. , default_8_rule ((3,8),0,(1/2,1/2)) == True . default_8_rule ((3,8),1/2,(1/2,1/2)) == True , default_8_rule ((3,8),1,(1/2,1/2)) == True , default_8_rule ((2,8),0,(1/2,1/2)) == True * default_8_rule ((5,8),0,(1,1/2)) == True * default_8_rule ((5,8),0,(2,1/2)) == True @0The default quarter note pulse simplifier rule. * default_4_rule ((3,4),0,(1,1/2)) == True * default_4_rule ((3,4),0,(1,3/4)) == True ) default_4_rule ((4,4),1,(1,1)) == False ( default_4_rule ((4,4),2,(1,1)) == True ( default_4_rule ((4,4),2,(1,2)) == True ( default_4_rule ((4,4),0,(2,1)) == True ) default_4_rule ((3,4),1,(1,1)) == False A:The default simplifier rule. To extend provide a list of  . B!Measure simplifier. Apply given . C%Pulse simplifier predicate, which is  . DPulse simplifier.  0 import Music.Theory.Duration.Name.Abbreviation : p_simplify [(q,[Tie_Right]),(e,[Tie_Left])] == [(q',[])] : p_simplify [(e,[Tie_Right]),(q,[Tie_Left])] == [(q',[])] < p_simplify [(q,[Tie_Right]),(e',[Tie_Left])] == [(q'',[])] ; p_simplify [(q'',[Tie_Right]),(s,[Tie_Left])] == [(h,[])] J p_simplify [(e,[Tie_Right]),(s,[Tie_Left]),(e',[])] == [(e',[]),(e',[])] ! let f = rqt_to_duration_a False @ in p_simplify (f [(1/8,_t),(1/4,_t),(1/8,_f)]) == f [(1/2,_f)] EComposition of 7, ; B. F Variant of y/ that retains elements of the right hand (rhs) D list where elements of the left hand (lhs) list meet the given lhs E predicate. If the right hand side is longer the remaining elements D to be processed are given. It is an error for the right hand side  to be short. ; zip_hold_lhs even [1..5] "abc" == ([],zip [1..6] "abbcc") ; zip_hold_lhs odd [1..6] "abc" == ([],zip [1..6] "aabbcc") / zip_hold_lhs even [1] "ab" == ("b",[(1,'a')]) * zip_hold_lhs even [1,2] "a" == undefined G Variant of H) that requires the right hand side to be  precisely the required length. : zip_hold_lhs_err even [1..5] "abc" == zip [1..6] "abbcc" : zip_hold_lhs_err odd [1..6] "abc" == zip [1..6] "aabbcc" 4 zip_hold_lhs_err id [False,False] "a" == undefined / zip_hold_lhs_err id [False] "ab" == undefined H Variant of y/ that retains elements of the right hand (rhs) D list where elements of the left hand (lhs) list meet the given lhs C predicate, and elements of the lhs list where elements of the ths ? meet the rhs predicate. If the right hand side is longer the C remaining elements to be processed are given. It is an error for " the right hand side to be short.  E zip_hold even (const False) [1..5] "abc" == ([],zip [1..6] "abbcc") E zip_hold odd (const False) [1..6] "abc" == ([],zip [1..6] "aabbcc") 9 zip_hold even (const False) [1] "ab" == ("b",[(1,'a')]) 4 zip_hold even (const False) [1,2] "a" == undefined G zip_hold odd even [1,2,6] [1..5] == ([4,5],[(1,1),(2,1),(6,2),(6,3)]) IZip a list of ?& elements duplicating elements of the ) right hand sequence for tied durations. 5 let {Just d = to_divisions_ts [(4,4),(4,4)] [3,3,2] 0 ;f = map snd . snd . flip m_ascribe "xyz"} ) in fmap f (notate d) == Just "xxxyyyzz" J G I. K Variant of I for a set of measures. LGroup elements as chords( where a chord element is inidicated by  the given predicate. ? group_chd even [1,2,3,4,4,5,7,8] == [[1,2],[3,4,4],[5],[7,8]] M Variant of J that groups the rhs elements using  L and with the indicated chord function, then rejoins  the resulting sequence. N Variant of K using L 7 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN7 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN7 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN7 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN+ Safe-Inferred OA node in a dynamic sequence. P#Enumeration of hairpin indicators. T%Enumeration of dynamic mark symbols. hLookup MIDI velocity for T. The range is linear  in 0-127. 3 let r = [0,6,17,28,39,50,61,72,83,94,105,116,127] 6 in mapMaybe dynamic_mark_midi [Niente .. FFFFF] == r i Translate fixed Ts to db amplitude over given  range. G mapMaybe (dynamic_mark_db 120) [Niente,P,F,FFFFF] == [-120,-70,-40,0] E mapMaybe (dynamic_mark_db 60) [Niente,P,F,FFFFF] == [-60,-35,-20,0] jThe P implied by a ordered pair of Ts. E map (implied_hairpin MF) [MP,F] == [Just Diminuendo,Just Crescendo] k The empty O. l Calculate a O sequence from a sequence of  Ts. = dynamic_sequence [PP,MP,MP,PP] == [(Just PP,Just Crescendo) ? ,(Just MP,Just End_Hairpin) > ,(Nothing,Just Diminuendo) @ ,(Just PP,Just End_Hairpin)] m,Delete redundant (unaltered) dynamic marks. / let s = [Just P,Nothing,Just P,Just P,Just F] H in delete_redundant_marks s == [Just P,Nothing,Nothing,Nothing,Just F] n Variant of l for sequences of T  with holes (ie. rests). Runs m.  F let r = [Just (Just P,Just Crescendo),Just (Just F,Just End_Hairpin) ) ,Nothing,Just (Just P,Nothing)] > in dynamic_sequence_sets [Just P,Just F,Nothing,Just P] == r ! let s = [Just P,Nothing,Just P] F in dynamic_sequence_sets s = [Just (Just P,Nothing),Nothing,Nothing] oApply P and T functions in that order as  required by O.  let f _ x = show x > in apply_dynamic_node f f (Nothing,Just Crescendo) undefined !OPQRSTUVWXYZ[\]^_`abcdefghijklmno!OPQRSTUVWXYZ[\]^_`abcdefghijklmno!Tgfedcba`_^]\[ZYXWVUhiPSRQjOklmno OPSRQTgfedcba`_^]\[ZYXWVUhijklmno,None%pp () joins q( equivalent intervals from morphologies m and n. qq; () determines an interval given a sequence and an index. rDistance function, ordinarily n below is in , z  or . sc G . t G . u G f. vSquare. wv G f. xv G  G f. y G  G f. zCity block metric, p.296 * city_block_metric (-) (1,2) (3,5) == 2+3 {)Two-dimensional euclidean metric, p.297. 2 euclidean_metric_2 (-) (1,2) (3,5) == sqrt (4+9) |n-dimensional euclidean metric 2 euclidean_metric_l (-) [1,2] [3,5] == sqrt (4+9) 8 euclidean_metric_l (-) [1,2,3] [2,4,6] == sqrt (1+4+9) } Cube root.  map cbrt [1,8,27] == [1,2,3] ~n -th root $ map (nthrt 4) [1,16,81] == [1,2,3] (Two-dimensional Minkowski metric, p.297 + minkowski_metric_2 (-) 1 (1,2) (3,5) == 5 4 minkowski_metric_2 (-) 2 (1,2) (3,5) == sqrt (4+9) 5 minkowski_metric_2 (-) 3 (1,2) (3,5) == cbrt (8+27) n-dimensional Minkowski metric : minkowski_metric_l (-) 2 [1,2,3] [2,4,6] == sqrt (1+4+9) ; minkowski_metric_l (-) 3 [1,2,3] [2,4,6] == cbrt (1+8+27) Integration with f. % d_dx (-) [0,2,4,1,0] == [2,2,-3,-1] % d_dx (-) [2,3,0,4,1] == [1,-3,4,-3] H  G . ' d_dx_abs (-) [0,2,4,1,0] == [2,2,3,1] ' d_dx_abs (-) [2,3,0,4,1] == [1,3,4,3] +Ordered linear magnitude (no delta), p.300 / olm_no_delta' [0,2,4,1,0] [2,3,0,4,1] == 1.25 .Ordered linear magintude (general form) p.302 ; olm_general (abs_dif (-)) [0,2,4,1,0] [2,3,0,4,1] == 1.25 ? olm_general (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 4.6 f at indices i and i+1 of x. 7 map (ix_dif (-) [0,1,3,6,10]) [0..3] == [-1,-2,-3,-4]  G  6 map (abs_ix_dif (-) [0,2,4,1,0]) [0..3] == [2,2,3,1] v G  : map (sqr_abs_ix_dif (-) [0,2,4,1,0]) [0..3] == [4,4,9,1] ; map (sqr_abs_ix_dif (-) [2,3,0,4,1]) [0..3] == [1,9,16,9] ;Ordered linear magintude (generalised-interval form) p.305 V olm (abs_dif dif_r) (abs_ix_dif dif_r) (const 1) [1,5,12,2,9,6] [7,6,4,9,8,1] == 4.6 U olm (abs_dif dif_r) (abs_ix_dif dif_r) maximum [1,5,12,2,9,6] [7,6,4,9,8,1] == 0.46 )Second order binomial coefficient, p.307 L map second_order_binonial_coefficient [2..10] == [1,3,6,10,15,21,28,36,45]  of  n. , direction_interval [5,9,3,2] == [LT,GT,GT] , direction_interval [2,5,6,6] == [LT,LT,EQ] Histogram of list of ps.  ord_hist [LT,GT,GT] == (1,0,2)  Histogram of  directions of adjacent elements, p.312. ' direction_vector [5,9,3,2] == (1,0,2) ' direction_vector [2,5,6,6] == (2,1,0) +Unordered linear direction, p.311 (Fig. 5)  uld [5,9,3,2] [2,5,6,6] == 2/3 " uld [5,3,6,1,4] [3,6,1,4,2] == 0  Ordered linear direction, p.312 1 direction_interval [5,3,6,1,4] == [GT,LT,GT,LT] 1 direction_interval [3,6,1,4,2] == [LT,GT,LT,GT] " old [5,3,6,1,4] [3,6,1,4,2] == 1 'Ordered combinatorial direction, p.314  ocd [5,9,3,2] [2,5,6,6] == 5/6 $ ocd [5,3,6,1,4] [3,6,1,4,2] == 4/5 )Unordered combinatorial direction, p.314  ucd [5,9,3,2] [2,5,6,6] == 5/6 " ucd [5,3,6,1,4] [3,6,1,4,2] == 0  ucd [5,3,7,6] [2,1,2,1] == 1/2  ucd [2,1,2,1] [8,3,5,4] == 1/3  ucd [5,3,7,6] [8,3,5,4] == 1/3 , Fig.9, p.318  let r = [[2,3,1,4]  ,[1,3,6]  ,[4,7]  ,[3]] B in combinatorial_magnitude_matrix (abs_dif (-)) [5,3,2,6,9] == r 3Unordered linear magnitude (simplified), p.320-321  3 let r = abs (sum [5,4,3,6] - sum [12,2,11,7]) / 4 A in ulm_simplified (abs_dif (-)) [1,6,2,5,11] [3,15,13,2,9] == r @ ulm_simplified (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 3 -Ordered combinatorial magnitude (OCM), p.323 5 ocm (abs_dif (-)) [1,6,2,5,11] [3,15,13,2,9] == 5.2 7 ocm (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 3.6 -Ordered combinatorial magnitude (OCM), p.323 E ocm_absolute_scaled (abs_dif (-)) [1,6,2,5,11] [3,15,13,2,9] == 0.4 N ocm_absolute_scaled (abs_dif (-)) [1,5,12,2,9,6] [7,6,4,9,8,1] == 54/(15*11) +pqrstuvwxyz{|}~+pqrstuvwxyz{|}~+rstuvwxyz{|}~qp+pqrstuvwxyz{|}~- Safe-Inferred &Kanjutmesem Slendro (S1,S2,S3,S5,S6,S1') / L.d_dx kanjutmesem_s == [252,238,241,236,253] *Kanjutmesem Pelog (P1,P2,P3,P4,P5,P6,P7,P1') 7 L.d_dx kanjutmesem_p == [141,141,272,140,115,172,246] !Darius Slendro (S1,S2,S3,S5,S6,S1') * L.d_dx darius_s == [204,231,267,231,267] ( ax_r darius_s == [9/8,8/7,7/6,8/7,7/6] (Madeleine Pelog (P1,P2,P3,P4,P5,P6,P7,P1') 3 L.d_dx madeleine_p == [139,128,336,99,94,173,231] ? ax_r madeleine_p == [13/12,14/13,17/14,18/17,19/18,21/19,8/7] $Lipur Sih Slendro (S1,S2,S3,S5,S6,S1') - L.d_dx lipur_sih_s == [273,236,224,258,256] (Lipur Sih Pelog (P1,P2,P3,P4,P5,P6,P7,P1') 1 L.d_dx lipur_sih_p == [110,153,253,146,113,179] 6Idealized ET Slendro, 5-tone equal temperament (p.17) 0 L.d_dx idealized_et_s == [240,240,240,240,240] >Idealized ET Pelog, subset of 9-tone equal temperament (p.17) F L.d_dx idealized_et_p == [400/3,800/3,400/3,400/3,400/3,400/3,800/3] )Reconstruct approximate ratios to within 1e-3 from intervals.    . Safe-Inferred A Sieve.  of two s  of two s  Primitive  of modulo and index    Synonym for  The  of a list of s, ie.  . The  of a list of s, ie.  . Unicode synonym for . Unicode synonym for .  Variant of , ie.  .  l 15 19 == L (15,19) unicode synonym for . In a normal  m is  i. # normalise (L (15,19)) == L (15,4) Predicate to test if a  is normal.  is_normal (L (15,4)) == True Predicate to determine if an  is an element of the . ; map (element (L (3,1))) [1..4] == [True,False,False,True] @ map (element (L (15,4))) [4,19 .. 49] == [True,True,True,True] $Construct the sequence defined by a . Note that building C a sieve that contains an intersection clause that has no elements  gives _|_.  let d = [0,2,4,5,7,9,11] / in take 7 (build (union (map (l 12) d))) == d  Variant of  that gives the first n places of the   of .  9 buildn 6 (union (map (l 8) [0,3,6])) == [0,3,6,8,11,14] ; buildn 12 (L (3,2)) == [2,5,8,11,14,17,20,23,26,29,32,35] 2 buildn 9 (L (8,0)) == [0,8,16,24,32,40,48,56,64] + buildn 3 (L (3,2) ") L (8,0)) == [8,32,56] C buildn 12 (L (3,1) "* L (4,0)) == [0,1,4,7,8,10,12,13,16,19,20,22] F buildn 14 (5"4 "* 3"2 "* 7"3) == [2,3,4,5,8,9,10,11,14,17,19,20,23,24] ' buildn 6 (3"0 "* 4"0) == [0,3,4,6,8,9] 7 buildn 8 (5"2 ") 2"0 "* 7"3) == [2,3,10,12,17,22,24,31] < buildn 12 (5"1 "* 7"2) == [1,2,6,9,11,16,21,23,26,30,31,36]  G buildn 10 (3"2 ") 4"7 "* 6"9 ") 15"18) == [3,11,23,33,35,47,59,63,71,83]  A let s = 3"2")4"7")6"11")8"7 "* 6"9")15"18 "* 13"5")8"6")4"2 "* 6"9")15"19 5 in buildn 16 s == buildn 16 (24"23 "* 30"3 "* 104"70) F buildn 10 (24"23 "* 30"3 "* 104"70) == [3,23,33,47,63,70,71,93,95,119] #Standard differentiation function. % differentiate [1,3,6,10] == [2,3,4] 6 differentiate [0,2,4,5,7,9,11,12] == [2,2,1,2,2,2,1] Euclid'7s algorithm for computing the greatest common divisor.  euclid 1989 867 == 51 Bachet De Mziriac' s algorithm. + de_meziriac 15 4 == 3 && euclid 15 4 == 1 Attempt to reduce the  of two  nodes to a  singular  node. 1 reduce_intersection (3,2) (4,7) == Just (12,11) 4 reduce_intersection (12,11) (6,11) == Just (12,11) 3 reduce_intersection (12,11) (8,7) == Just (24,23)  Reduce the number of nodes at a .  % reduce (L (3,2) "* Empty) == L (3,2) % reduce (L (3,2) ") Empty) == L (3,2) ) reduce (L (3,2) ") L (4,7)) == L (12,11) * reduce (L (6,9) ") L (15,18)) == L (30,3)  A let s = 3"2")4"7")6"11")8"7 "* 6"9")15"18 "* 13"5")8"6")4"2 "* 6"9")15"19 ( in reduce s == (24"23 "* 30"3 "* 104"70) A let s = 3"2")4"7")6"11")8"7 "* 6"9")15"18 "* 13"5")8"6")4"2 "* 6"9")15"19 ( in reduce s == (24"23 "* 30"3 "* 104"70) /None Transpose p by n.  tn 4 [1,5,6] == [5,9,10] Invert p about n.  invert 6 [4,5,6] == [8,7,6]  invert 0 [0,1,3] == [0,11,9] Composition of  about 0 and .  tni 4 [1,5,6] == [3,11,10] ' (invert 0 . tn 4) [1,5,6] == [7,3,2] Modulo 12 multiplication $ mn 11 [0,1,4,9] == tni 0 [0,1,4,9] M5, ie.  5.  m5 [0,1,3] == [0,5,3] T-related sequences of p. $ length (t_related [0,3,6,9]) == 12 T/I-related sequences of p. # length (ti_related [0,1,3]) == 24 % length (ti_related [0,3,6,9]) == 24 & ti_related [0] == map return [0..11] R/T/I-related sequences of p. $ length (rti_related [0,1,3]) == 48 & length (rti_related [0,3,6,9]) == 24 T/M/I-related sequences of p. R/T/M/I-related sequences of p. r/R/T/M/I-related sequences of p.  Variant of  , transpose p so first element is n.  tn_to 5 [0,1,3] == [5,6,8]  Variant of , inverse about n th element. ; map (invert_ix 0) [[0,1,3],[3,4,6]] == [[0,11,9],[3,2,0]] ; map (invert_ix 1) [[0,1,3],[3,4,6]] == [[2,1,11],[5,4,2]] The standard t-matrix of p.  tmatrix [0,1,3] == [[0,1,3]  ,[11,0,2]  ,[9,10,0]] 0None Synonym for W. T-related rotations of p. 4 t_rotations [0,1,3] == [[0,1,3],[0,2,11],[0,9,10]] T/I-related rotations of p. 4 ti_rotations [0,1,3] == [[0,1,3],[0,2,11],[0,9,10] 5 ,[0,9,11],[0,2,3],[0,1,10]] 6Variant with default value for empty input list case. 2Prime form rule requiring comparator, considering . 2Prime form rule requiring comparator, considering . DForte comparison function (rightmost first then leftmost outwards). - forte_cmp [0,1,3,6,8,9] [0,2,3,6,7,9] == LT Forte prime form, ie.  cmp_prime of . , forte_prime [0,1,3,6,8,9] == [0,1,3,6,8,9] )The set-class table (Forte prime forms). 6Lookup a set-class name. The input set is subject to   before lookup.  sc_name [0,2,3,6,7] == "5-Z18" " sc_name [0,1,4,6,7,8] == "6-Z17" +Lookup a set-class given a set-class name.  sc "6-Z17" == [0,1,2,4,7,8] List of set classes.  Cardinality n subset of . < map (length . scs_n) [2..10] == [6,12,29,38,50,38,29,12,6] (Basic interval pattern, see Allen Forte "The Basic Interval Patterns"  JMT 17/2 (1973):234-272 bip 0t95728e3416 11223344556 < bip [0,10,9,5,7,2,8,11,3,4,1,6] == [1,1,2,2,3,3,4,4,5,5,6] 5 bip (pco "0t95728e3416") == [1,1,2,2,3,3,4,4,5,5,6] Interval class of Z12 interval i.  map ic [5,6,7] == [5,6,5] *Forte notation for interval class vector. $ icv [0,1,2,4,7,8] == [3,2,2,3,3,2] 1None$Predicate for list with cardinality n. Set classes of cardinality n. 7 sc_table_n 2 == [[0,1],[0,2],[0,3],[0,4],[0,5],[0,6]] /Minima and maxima of ICV of SCs of cardinality n. / icv_minmax 5 == ([0,0,0,1,0,0],[4,4,4,4,4,2]) Pretty printer for . ! map r_pp [MIN,MAX] == ["+","-"] % element measure with given funtion. !Pretty printer for SATV element. ; satv_e_pp (satv_a [0,1,2,6,7,8]) == "<-1,+2,+0,+0,-1,-0>" Pretty printer for . SATVa measure. ; satv_e_pp (satv_a [0,1,2,6,7,8]) == "<-1,+2,+0,+0,-1,-0>" 9 satv_e_pp (satv_a [0,1,2,3,4]) == "<-0,-1,-2,+0,+0,+0>" SATVb measure. ; satv_e_pp (satv_b [0,1,2,6,7,8]) == "<+4,-4,-5,-4,+4,+3>" 9 satv_e_pp (satv_b [0,1,2,3,4]) == "<+4,+3,+2,-3,-4,-2>"  measure. I satv_pp (satv [0,3,6,9]) == "(<+0,+0,-0,+0,+0,-0>,<-3,-3,+4,-3,-3,+2>)" K satv_pp (satv [0,1,3,4,8]) == "(<-2,+1,-2,-1,-2,+0>,<+2,-3,+2,+2,+2,-2>)" M satv_pp (satv [0,1,2,6,7,8]) == "(<-1,+2,+0,+0,-1,-0>,<+4,-4,-5,-4,+4,+3>)" E satv_pp (satv [0,4]) == "(<+0,+0,+0,-0,+0,+0>,<-1,-1,-1,+1,-1,-1>)" M satv_pp (satv [0,1,3,4,6,9]) == "(<+2,+2,-0,+0,+2,-1>,<-3,-4,+5,-4,-3,+2>)" M satv_pp (satv [0,1,3,6,7,9]) == "(<+2,+2,-1,+0,+2,-0>,<-3,-4,+4,-4,-3,+3>)" K satv_pp (satv [0,1,2,3,6]) == "(<-1,-2,-2,+0,+1,-1>,<+3,+2,+2,-3,-3,+1>)" M satv_pp (satv [0,1,2,3,4,6]) == "(<-1,-2,-2,+0,+1,+1>,<+4,+4,+3,-4,-4,-2>)" K satv_pp (satv [0,1,3,6,8]) == "(<+1,-2,-2,+0,-1,-1>,<-3,+2,+2,-3,+3,+1>)" M satv_pp (satv [0,2,3,5,7,9]) == "(<+1,-2,-2,+0,-1,+1>,<-4,+4,+3,-4,+4,-2>)"  reorganised by . C satv_minmax (satv [0,1,2,6,7,8]) == ([4,2,0,0,4,3],[1,4,5,4,1,0]) Absolute difference. Sum of numerical components of a and b parts of . 2 satv_n_sum (satv [0,1,2,6,7,8]) == [5,6,5,4,5,3] - satv_n_sum (satv [0,3,6,9]) = [3,3,4,3,3,2] SATSIM metric. ) satsim [0,1,2,6,7,8] [0,3,6,9] == 25/46 % satsim [0,4] [0,1,3,4,6,9] == 25/34 % satsim [0,4] [0,1,3,6,7,9] == 25/34 * satsim [0,1,2,3,6] [0,1,2,3,4,6] == 1/49 * satsim [0,1,3,6,8] [0,2,3,5,7,9] == 1/49 ( satsim [0,1,2,3,4] [0,1,4,5,7] == 8/21 ' satsim [0,1,2,3,4] [0,2,4,6,8] == 4/7 ' satsim [0,1,4,5,7] [0,2,4,6,8] == 4/7  Table of  measures for all SC pairs.  length satsim_table == 24310 Histogram of values at . > satsim_table_histogram == L.histogram (map snd satsim_table) 2NoneSIM B icv [0,1,3,6] == [1,1,2,0,1,1] && icv [0,2,4,7] == [0,2,1,1,2,0]  sim [0,1,3,6] [0,2,4,7] == 6 " sim [0,1,2,4,5,8] [0,1,3,7] == 9 ASIM " asim [0,1,3,6] [0,2,4,7] == 6/12 & asim [0,1,2,4,5,8] [0,1,3,7] == 9/21 % asim [0,1,2,3,4] [0,1,4,5,7] == 2/5 % asim [0,1,2,3,4] [0,2,4,6,8] == 3/5 % asim [0,1,4,5,7] [0,2,4,6,8] == 3/5 3None,Transpositional equivalence prime form, ie.  of  . < (forte_prime [0,2,3],t_prime [0,2,3]) == ([0,1,3],[0,2,3]) Is p symmetrical under inversion. : map inv_sym (scs_n 2) == [True,True,True,True,True,True] ? map (fromEnum.inv_sym) (scs_n 3) == [1,0,0,0,0,1,0,0,1,1,0,1] If p is not  then (p,invert 0 p) else u.  sc_t_ti [0,2,4] == Nothing + sc_t_ti [0,1,3] == Just ([0,1,3],[0,2,3]) ,Transpositional equivalence variant of Forte's . The ; inversionally related classes are distinguished by labels A and  B; the class providing the best normal order (Forte 1973) is  always the A class. If neither A nor B appears in the name of / a set-class, it is inversionally symmetrical. 2 (length sc_table,length t_sc_table) == (224,352) 0 lookup "5-Z18B" t_sc_table == Just [0,2,3,6,7] 6Lookup a set-class name. The input set is subject to   before lookup. # t_sc_name [0,2,3,6,7] == "5-Z18B" % t_sc_name [0,1,4,6,7,8] == "6-Z17B" +Lookup a set-class given a set-class name.  t_sc "6-Z17A" == [0,1,2,4,7,8] List of set classes.  Cardinality n subset of . > map (length . t_scs_n) [2..10] == [6,19,43,66,80,66,43,19,6]  T-related q that are subsets of p. ; t_subsets [0,1,2,3,4] [0,1] == [[0,1],[1,2],[2,3],[3,4]] , t_subsets [0,1,2,3,4] [0,1,4] == [[0,1,4]] , t_subsets [0,2,3,6,7] [0,1,4] == [[2,3,6]] T/ I-related q that are subsets of p. < ti_subsets [0,1,2,3,4] [0,1] == [[0,1],[1,2],[2,3],[3,4]] 5 ti_subsets [0,1,2,3,4] [0,1,4] == [[0,1,4],[0,3,4]] 5 ti_subsets [0,2,3,6,7] [0,1,4] == [[2,3,6],[3,6,7]] Trivial run length encoder. > rle "abbcccdde" == [(1,'a'),(2,'b'),(3,'c'),(2,'d'),(1,'e')]  Inverse of . - rle_decode [(5,'a'),(4,'b')] == "aaaaabbbb"  Length of rle encoded sequence. # rle_length [(5,'a'),(4,'b')] == 9 T-equivalence n*-class vector (subset-class vector, nCV). , t_n_class_vector 2 [0..4] == [4,3,2,1,0,0] J rle (t_n_class_vector 3 [0..4]) == [(1,3),(2,2),(2,1),(4,0),(1,1),(9,0)] 9 rle (t_n_class_vector 4 [0..4]) == [(1,2),(3,1),(39,0)] T/I-equivalence n*-class vector (subset-class vector, nCV). - ti_n_class_vector 2 [0..4] == [4,3,2,1,0,0] > ti_n_class_vector 3 [0,1,2,3,4] == [3,4,2,0,0,1,0,0,0,0,0,0] ? rle (ti_n_class_vector 4 [0,1,2,3,4]) == [(2,2),(1,1),(26,0)]  scaled by sum of icv. ? dyad_class_percentage_vector [0,1,2,3,4] == [40,30,20,10,0,0] A dyad_class_percentage_vector [0,1,4,5,7] == [20,10,20,20,20,10] rel metric. # rel [0,1,2,3,4] [0,1,4,5,7] == 40 # rel [0,1,2,3,4] [0,2,4,6,8] == 60 # rel [0,1,4,5,7] [0,2,4,6,8] == 60 4NoneREL function with given ncv function (see  and ). T-equivalence REL function. Kuusi 2001, 7.5.2 # let (~=) p q = abs (p - q) < 1e-2 ' t_rel [0,1,2,3,4] [0,2,3,6,7] ~= 0.44 ' t_rel [0,1,2,3,4] [0,2,4,6,8] ~= 0.28 ' t_rel [0,2,3,6,7] [0,2,4,6,8] ~= 0.31 T/I-equivalence REL function. Buchler 1998, Fig. 3.38 # let (~=) p q = abs (p - q) < 1e-3  let a = [0,2,3,5,7]::[Z12]  let b = [0,2,3,4,5,8]::[Z12] # let g = [0,1,2,3,5,6,8,10]::[Z12]  let j = [0,2,3,4,5,6,8]::[Z12]  ti_rel a b ~= 0.593  ti_rel a g ~= 0.648  ti_rel a j ~= 0.509  ti_rel b g ~= 0.712  ti_rel b j ~= 0.892  ti_rel g j ~= 0.707 5None3Rahn prime form (comparison is rightmost inwards). , rahn_cmp [0,1,3,6,8,9] [0,2,3,6,7,9] == GT Rahn prime form, ie.  of .  + rahn_prime [0,1,3,6,8,9] == [0,2,3,6,7,9]  let s = [[0,1,3,7,8] & ,[0,1,3,6,8,9],[0,1,3,5,8,9]  ,[0,1,2,4,7,8,9]  ,[0,1,2,4,5,7,9,10]] 8 in all (\p -> forte_prime p /= rahn_prime p) s == True 6None #Serial Operator,of the form rRTMI.  INT operator.  int [0,1,3,6,10] == [1,2,3,4]  Serial operation.  sro T4 15659A , sro (rnrtnmi "T4") (pco "156") == [5,9,10] echo 024579 | sro RT4I79B024 ? sro (SRO 0 True 4 False True) [0,2,4,5,7,9] == [7,9,11,0,2,4]  sro T4I 1563BA . sro (rnrtnmi "T4I") (pco "156") == [3,11,10] 5 sro (SRO 0 False 4 False True) [1,5,6] == [3,11,10] echo 156 | sro T4 | sro T0I732 C (sro (rnrtnmi "T0I") . sro (rnrtnmi "T4")) (pco "156") == [7,3,2] echo 024579 | sro RT4I79B024 7 sro (rnrtnmi "RT4I") (pco "024579") == [7,9,11,0,2,4] 7 sro (SRO 1 True 1 True False) [0,1,2,3] == [11,6,1,4] 7 sro (SRO 1 False 4 True True) [0,1,2,3] == [11,6,1,4]  $The total set of serial operations.  The set of transposition s.  'The set of transposition and inversion s. 6The set of retrograde and transposition and inversion s. The set of transposition,M5 and inversion s. $The set of retrograde,transposition,M5 and inversion s.                        7None 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 . A sort (cg [0,1,3]) == [[],[0],[0,1],[0,1,3],[0,3],[1],[1,3],[3]] "Powerset filtered by cardinality.  cg -r3 0159015019059159 7 cg_r 3 [0,1,5,9] == [[0,1,5],[0,1,9],[0,5,9],[1,5,9]] Cyclic interval segment.  Synonynm for .  cmpl 02468t13579B ' cmpl [0,2,4,6,8,10] == [1,3,5,7,9,11]  Form cycle. cyc 0560560  cyc [0,5,6] == [0,5,6,0] Diatonic set name. d for diatonic set, m for melodic minor  set, o for octotonic set. Diatonic implications.  Variant of  that is closer to the pct form. dim 016T1dT1mT0o - dim_nm [0,1,6] == [(1,'d'),(1,'m'),(0,'o')] 'Diatonic interval set to interval set. dis 241256  dis [2,4] == [1,2,5,6] Degree of intersection. echo 024579e | doi 6 | sort -u024579A024679B  let p = [0,2,4,5,7,9,11] 5 in doi 6 p p == [[0,2,4,5,7,9,10],[0,2,4,6,7,9,11]] !echo 01234 | doi 2 7-35 | sort -u13568AB 6 doi 2 (sc "7-35") [0,1,2,3,4] == [[1,3,5,6,8,10,11]]  Forte name. p * q is true iff p can embed q in sequence. Embedded segment search. echo 23a | ess 01643252B013A9923507A F 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]]  7Can the set-class q (under prime form algorithm pf) be  drawn from the pcset p. !/Can the set-class q be drawn from the pcset p. "Interval cycle filter. echo 22341 | icf22341 $ icf [[2,2,3,4,1]] == [[2,2,3,4,1]] #%Interval class set to interval sets.  ici -c 1231231291A31A9 6 ici_c [1,2,3] == [[1,2,3],[1,2,9],[1,10,3],[1,10,9]] $6Interval class set to interval sets, concise variant. 6 ici_c [1,2,3] == [[1,2,3],[1,2,9],[1,10,3],[1,10,9]] %Interval-class segment. icseg 013265e497t8 12141655232 > icseg [0,1,3,2,6,5,11,4,9,7,10,8] == [1,2,1,4,1,6,5,5,2,3,2] &Interval segment (INT). 'Imbrications. ((* gives the set-classes that can append to p to give q.  issb 3-7 6-323-73-23-11 5 issb (sc "3-7") (sc "6-32") == ["3-2","3-7","3-11"] )Matrix search. mxs 024579 642 | sort -u6421B9B97642 F S.set (mxs [0,2,4,5,7,9] [6,4,2]) == [[6,4,2,1,11,9],[11,9,7,6,4,2]] * Normalize. nrm 01234565432100123456 4 nrm [0,1,2,3,4,5,6,5,4,3,2,1,0] == [0,1,2,3,4,5,6] +&Normalize, retain duplicate elements. , Pitch-class invariances (called pi at pct).  pi 0236 1202366320532BB235 D pci [0,2,3,6] [1,2] == [[0,2,3,6],[5,3,2,11],[6,3,2,0],[11,2,3,5]] - Relate sets.  rs 0123 641eT1M + import Music.Theory.Z12.Morris_1987.Parse 8 rs [0,1,2,3] [6,4,1,11] == [(rnrtnmi "T1M",[1,6,11,4]) : ,(rnrtnmi "T4MI",[4,11,6,1])] .Relate segments.  rsg 156 3BAT4I < rsg [1,5,6] [3,11,10] == [rnrtnmi "T4I",rnrtnmi "r1RT4MI"]  rsg 0123 05t3T0M = rsg [0,1,2,3] [0,5,10,3] == [rnrtnmi "T0M",rnrtnmi "RT3MI"]  rsg 0123 4e61RT1M = rsg [0,1,2,3] [4,11,6,1] == [rnrtnmi "T4MI",rnrtnmi "RT1M"] echo e614 | rsg 0123r3RT1M A rsg [0,1,2,3] [11,6,1,4] == [rnrtnmi "r1T4MI",rnrtnmi "r1RT1M"] / Subsets. 0Super set-class. spsc 4-11 4-12 5-26[02458] ) spsc [sc "4-11", sc "4-12"] == ["5-26"]  spsc 3-11 3-8 4-27[0258] 4-Z29[0137] 0 spsc [sc "3-11", sc "3-8"] == ["4-27","4-Z29"]  spsc `fl 3` 6-Z17[012478]  spsc (cf [3] scs) == ["6-Z17"]  !"#$%&'()*+,-./0  !"#$%&'()*+,-./0  !"#$%&'()*+,-./0  !"#$%&'()*+,-./08NoneA  parser. Boolean  for given . Parse . 12Parse a Morris format serial operator descriptor. - rnrtnmi "r2RT3MI" == SRO 2 True 3 True True 2Parse a pitch class object string. Each  is either a D number, a space which is ignored, or a letter name for the numbers  10 (t or a or A ) or 11 (e or B or b).  pco "13te" == [1,3,10,11]  pco "13te" == pco "13ab" 121212129None3 Encoder for 5.  encode [0,1,3,6,8,9] == 843 4 Decoder for 5.  decode 843 == [0,1,3,6,8,9] 5<Binary encoding prime form algorithm, equalivalent to Rahn. 8 encode_prime [0,1,3,6,8,9] == rahn_prime [0,1,3,6,8,9] 345345345345: Safe-Inferred 6789:;<=>?@A 6789:;<=>?@A 6789:;<=>?@A 6789:;<=>?@A; Safe-InferredB Bjorklund'.s algorithm to construct a binary sequence of n bits  with k ones such that the k# ones are distributed as evenly as  possible among the (n - k ) zeroes.  G bjorklund (5,9) == [True,False,True,False,True,False,True,False,True] ' xdot (bjorklund (5,9)) == "x.x.x.x.x"   let es = [(2,3),(2,5)  ,(3,4),(3,5),(3,8) % ,(4,7),(4,9),(4,12),(4,15) ? ,(5,6),(5,7),(5,8),(5,9),(5,11),(5,12),(5,13),(5,16)  ,(6,7),(6,13) A ,(7,8),(7,9),(7,10),(7,12),(7,15),(7,16),(7,17),(7,18)  ,(8,17),(8,19) ' ,(9,14),(9,16),(9,22),(9,23)  ,(11,12),(11,24)  ,(13,24)  ,(15,34)] C in map (\e -> let e' = bjorklund e in (e,xdot e',iseq_str e')) es  [((2,3),"xx.","(12)")  ,((2,5),"x.x..","(23)")  ,((3,4),"xxx.","(112)")  ,((3,5),"x.x.x","(221)")  ,((3,8),"x..x..x.","(332)")  ,((4,7),"x.x.x.x","(2221)")  ,((4,9),"x.x.x.x..","(2223)") # ,((4,12),"x..x..x..x..","(3333)") & ,((4,15),"x...x...x...x..","(4443)")  ,((5,6),"xxxxx.","(11112)")  ,((5,7),"x.xx.xx","(21211)")  ,((5,8),"x.xx.xx.","(21212)")  ,((5,9),"x.x.x.x.x","(22221)") # ,((5,11),"x.x.x.x.x..","(22223)") $ ,((5,12),"x..x.x..x.x.","(32322)") % ,((5,13),"x..x.x..x.x..","(32323)") ( ,((5,16),"x..x..x..x..x...","(33334)")  ,((6,7),"xxxxxx.","(111112)") & ,((6,13),"x.x.x.x.x.x..","(222223)") ! ,((7,8),"xxxxxxx.","(1111112)") " ,((7,9),"x.xxx.xxx","(2112111)") $ ,((7,10),"x.xx.xx.xx","(2121211)") & ,((7,12),"x.xx.x.xx.x.","(2122122)") ) ,((7,15),"x.x.x.x.x.x.x..","(2222223)") * ,((7,16),"x..x.x.x..x.x.x.","(3223222)") + ,((7,17),"x..x.x..x.x..x.x.","(3232322)") , ,((7,18),"x..x.x..x.x..x.x..","(3232323)") , ,((8,17),"x.x.x.x.x.x.x.x..","(22222223)") . ,((8,19),"x..x.x.x..x.x.x..x.","(32232232)") * ,((9,14),"x.xx.xx.xx.xx.","(212121212)") , ,((9,16),"x.xx.x.x.xx.x.x.","(212221222)") 2 ,((9,22),"x..x.x..x.x..x.x..x.x.","(323232322)") 3 ,((9,23),"x..x.x..x.x..x.x..x.x..","(323232323)") + ,((11,12),"xxxxxxxxxxx.","(11111111112)") 7 ,((11,24),"x..x.x.x.x.x..x.x.x.x.x.","(32222322222)") 9 ,((13,24),"x.xx.x.x.x.x.xx.x.x.x.x.","(2122222122222)") F ,((15,34),"x..x.x.x.x..x.x.x.x..x.x.x.x..x.x.","(322232223222322)")] Cxdot notation for pattern. ' xdot (bjorklund (5,9)) == "x.x.x.x.x" DThe D& of a pattern is the distance between  values. ' iseq (bjorklund (5,9)) == [2,2,2,2,1] ED of pattern as compact string. ) iseq_str (bjorklund (5,9)) == "(22221)" BCDEBCDEBCDEBCDE@ABCDDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  <    @                 !"#$%&'()*+,-./0123456M789:;;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@AABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop q r s t u!v!v!w!x!y!z!{!|!}!~!!!"""""""""""""""""""""""""""""""""""""""1"##############$$%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&''''''''''''''''''''''''''' '' '' '''''' ' ''''''''''''''''''' '!'"'#'$(%(&('((()(*(+(,(-(.(/(0(1(2)3)4)5)6)7)8)9):);)<)=*>*?*@*A*B*C*D*E*F*G*H*I*J*K*L*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*[*\*]*^*_*`*a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t+u+v+w+x+y+z+{+|+}+~+++++++++++++++++++++++,,,A,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------....................../// / / / / ///////0000000000000000111111111111111111111112233 3 3 3 3 333333333334445566666 6!6"6#6$6%7&7'7(7)7*7+7,7-7.7/707172737475767778797:7;7<7=7>7?7@7A7B7C7D7E8F8G9H9I9J:K:K:L:M:N:O:P:Q:R:S:T:U;V;W;X;YZ[\Z]^Z]_Z]`Z[abcdZ>eZ>fZ>gZhiZjkZjlZjmZjnopqoprZstZ]uZjvZwxZyzop{Zy|o}~  o}ZZjZjZjZjZjZZjZjZjopopopo}o}o}o}ZhZhZyZyZyZjZZZjZZZZZ]ZZZyZZsZZZo}Zjo}&&Z]ZyZyZ]ZZsZjZjZsZZop8o}88;;;;hmt-0.14Music.Theory.Z12.Morris_1974Music.Theory.Z12.LiteratureMusic.Theory.TuningMusic.Theory.Tuning.Alves_1997Music.Theory.Tuning.Meyer_1929!Music.Theory.Tuning.Polansky_1978!Music.Theory.Tuning.Polansky_1984Music.Theory.Tuning.ScalaMusic.Theory.Tiling.Canon Music.Theory.Tiling.Johnson_2004 Music.Theory.Tiling.Johnson_2009Music.Theory.Z12Music.Theory.Z12.TTOMusic.Theory.Meter.Barlow_1987!Music.Theory.Interval.Barlow_1987Music.Theory.DurationMusic.Theory.Duration.NameMusic.Theory.Duration.RQ Music.Theory.Duration.Annotation'Music.Theory.Duration.Name.AbbreviationMusic.Theory.Time_SignatureMusic.Theory.Tempo_MarkingMusic.Theory.Set.ListMusic.Theory.Set.SetMusic.Theory.PitchMusic.Theory.Pitch.NameMusic.Theory.IntervalMusic.Theory.Interval.NameMusic.Theory.Interval.SpellingMusic.Theory.Pitch.Spelling#Music.Theory.Pitch.Spelling.ClusterMusic.Theory.KeyMusic.Theory.ClefMusic.Theory.ListMusic.Theory.PermutationsMusic.Theory.CombinationsMusic.Theory.Permutations.List"Music.Theory.Contour.Polansky_1992Music.Theory.Xenakis.S4Music.Theory.Duration.RQ.Tied!Music.Theory.Duration.RQ.Division%Music.Theory.Duration.Sequence.NotateMusic.Theory.Dynamic_Mark!Music.Theory.Metric.Polansky_1996!Music.Theory.Tuning.Polansky_1990Music.Theory.Xenakis.SieveMusic.Theory.Z12.SROMusic.Theory.Z12.Forte_1973 Music.Theory.Metric.Buchler_1998Music.Theory.Metric.Morris_1980Music.Theory.Z12.Castren_1994Music.Theory.Z12.Lewin_1980Music.Theory.Z12.Rahn_1980Music.Theory.Z12.Morris_1987Music.Theory.Z12.Drape_1999"Music.Theory.Z12.Morris_1987.ParseMusic.Theory.Z12.Read_1978&Music.Theory.Block_Design.Johnson_2007Music.Theory.BjorklundTfold_to_octave Data.EitherrightsfromListall_interval_m all_intervalsc_dbTuningratios_or_cents octave_ratioCentsApproximate_RatiofromLeft fromRight divisionsratioscentscents_icents_to_ratioratio_to_centsapproximate_ratiosreconstructed_ratiosto_centsapproximate_ratio to_cents_rreconstructed_ratiocps_shift_centscps_difference_centssyntonic_commapythagorean_commamercators_commanth_root#twelve_tone_equal_temperament_commaditone_rditone pythagorean_r pythagoreanwerckmeister_iii_arwerckmeister_iii_cwerckmeister_iiiwerckmeister_iv_arwerckmeister_iv_cwerckmeister_ivwerckmeister_v_arwerckmeister_v_cwerckmeister_vwerckmeister_vi_rwerckmeister_vipietro_aaron_1523_cpietro_aaron_1523thomas_young_1799_cthomas_young_1799five_limit_tuning_rfive_limit_tuningequal_temperament_cequal_temperament"septimal_tritone_just_intonation_r septimal_tritone_just_intonationseven_limit_just_intonation_rseven_limit_just_intonationkirnberger_iii_arkirnberger_iii vallotti_cvallottimayumi_reinhard_rmayumi_reinhardla_monte_young_rla_monte_youngben_johnston_r ben_johnstonlou_harrison_16_rlou_harrison_16 partch_43_r partch_43mk_isomorphic_layoutminimal_isomorphic_note_layoutrank_two_regular_temperamentmk_syntonic_tuning syntonic_697 syntonic_702fold_cps_to_octave_ofharmonic_series_cpsharmonic_series_cps_npartialfold_ratio_to_octaveharmonic_series_cps_derivedharmonic_series_foldedharmonic_series_folded_charmonic_series_folded_21alves_slendro_r alves_slendroalves_pelog_bem_ralves_pelog_bemalves_pelog_barang_ralves_pelog_barangalves_pelog_23467_ralves_pelog_23467odd_torowcolumn in_oct_mulinnermeyer_table_rckmeyer_table_indicesmeyer_table_rowst3_3elementsdegreefarey_sequencepsaltery psaltery_o k_manisrenga k_kanjutmesem k_udanriris k_pengawesari k_rarasrumk_hardjanagara k_madukentirk_surakk_setcalculate_averages k_averagesgm_1gm_2gm_3gm_4gm_5gm_6gm_7gm_8gm_set gm_averages i_categories i_categorypadi_category_tablepolansky_1984_rpolansky_1984_cEpsilonScalePitchscale_description scale_degree scale_pitches scale_octaveperfect_octavescale_pitch_representations pitch_cents pitch_ratio scale_uniform scale_cents scale_ratios comment_p filter_crp_orremove_eol_commentsfilter_commentsdelete_trailing_pointpitchpitch_lnparseload dir_subsetload_dirEVRSp_cyclee_to_seq e_from_seqr_voices rr_voices t_retrogradet_normalr_from_tperfect_tilings_mperfect_tilingselemOrd v_dot_star v_space_ix with_bars v_dot_star_mv_print v_print_mv_print_m_fromp1p2p3p4p4_bp5p7p10p11Z12liftUZ12liftBZ12toZ12fromZ12 complementpcsettninverttnimnm5 t_related ti_relatedS_MMStratification traceShowatat'mod'to_rdiv'indispensibilities lower_psireverse_primesprime_stratification upper_psithinning_tablethinning_table_pprelative_to_lengthrelative_indispensibilities align_meters whole_div whole_quotprolong_stratificationsmeansquare align_s_mm upper_psi' mps_limitmean_square_productmetrical_affinitymetrical_affinity' Table_2_Rowbarlowfactor prime_factorsmultiplicitiesprime_factors_mmergerational_prime_factors_mrational_prime_factors_tdisharmonicity harmonicity harmonicity_r to_rational from_rationaltable_2 table_2_ppDurationdivisiondots multiplier duration_meqduration_compare_meqduration_compare_meq_err order_pair sort_pair sort_pair_mno_dotssum_dur_undottedsum_dur_dottedsum_dursum_dur'$whole_note_division_to_musicxml_typeduration_to_musicxml_typeduration_to_lilypond_type!whole_note_division_to_beam_countduration_beam_countwhole_note_division_pp duration_ppbreve whole_note half_note quarter_note eighth_notesixteenth_notethirtysecond_note dotted_brevedotted_whole_notedotted_half_notedotted_quarter_notedotted_eighth_notedotted_sixteenth_notedotted_thirtysecond_notedouble_dotted_brevedouble_dotted_whole_notedouble_dotted_half_notedouble_dotted_quarter_notedouble_dotted_eighth_notedouble_dotted_sixteenth_notedouble_dotted_thirtysecond_noteRQrq_to_duration rq_is_cmnrq_to_duration_errwhole_note_division_to_rq rq_apply_dotsduration_to_rqduration_compare_rqrq_modrq_divisible_byrq_is_integral rq_integralrq_derive_tuplet_plainrq_derive_tuplet rq_un_tuplet rq_to_cmn rq_can_notate Duration_A D_Annotation End_Tuplet Begin_TupletTie_Left Tie_Right begin_tupletda_begin_tuplet begins_tupletda_begins_tupletda_ends_tuplet da_tied_right da_tuplet begin_end_cmpbegin_end_cmp_eq group_treeda_group_tuplets break_left sep_balancedda_group_tuplets_nn zip_with_krzip_kr nn_reshape adopt_shape adopt_shape_md_annotated_tied_lrduration_a_tied_lrwhqesw'h'q'e's'w''h''q''e''s''_1_2_4_8_16_32_1'_2'_4'_8'_16'_32'_1''_2''_4''_8''_16''_32''Time_Signature ts_whole_notets_whole_note_rqts_rq ts_divisionsts_duration_pulses ts_rewritets_sum Tempo_Marking rq_to_secondspulse_durationmeasure_durationmeasure_duration_fset n_powersetpowersetpairstriples expand_set partitionscartesian_productSpellingnote alterationoctave Alteration_T DoubleSharpThreeQuarterToneSharpSharpQuarterToneSharpNaturalQuarterToneFlatFlatThreeQuarterToneFlat DoubleFlatNote_TBAGFDCOctPCOctave_PitchClassOctave PitchClasspitch_pppitch_pp_ascii note_to_pcalteration_to_diffalteration_to_diff_erralteration_to_fdifffdiff_to_alterationalteration_symbolalteration_ly_namealteration_raise_quarter_tonealteration_lower_quarter_tonealteration_edit_quarter_tonealteration_clear_quarter_tonepitch_clear_quarter_tonepitch_to_octpc pitch_to_midipitch_to_fmidi pitch_to_pc pitch_compareoctpc_to_pitch octpc_nrm octpc_trs octpc_to_midi midi_to_octpc midi_to_pitchfmidi_to_pitchpitch_note_raisepitch_note_lower%pitch_rewrite_threequarter_alterationpitch_edit_octavenote_t_transpose midi_to_cps fmidi_to_cps cps_to_midi cps_to_fmidi octpc_to_cpsa0b0bes0ais0bis0c1d1e1f1g1a1b1ces1des1ees1fes1ges1aes1bes1cis1dis1eis1fis1gis1ais1bis1c2d2e2f2g2a2b2ces2des2ees2fes2ges2aes2bes2cis2dis2eis2fis2gis2ais2bis2cisis2disis2eisis2fisis2gisis2aisis2bisis2c3d3e3f3g3a3b3ces3des3ees3fes3ges3aes3bes3cis3dis3eis3fis3gis3ais3bis3ceses3deses3eeses3feses3geses3aeses3beses3cisis3disis3eisis3fisis3gisis3aisis3bisis3ceseh3deseh3eeseh3feseh3geseh3aeseh3beseh3ceh3deh3eeh3feh3geh3aeh3beh3cih3dih3eih3fih3gih3aih3bih3cisih3disih3eisih3fisih3gisih3aisih3bisih3c4d4e4f4g4a4b4ces4des4ees4fes4ges4aes4bes4cis4dis4eis4fis4gis4ais4bis4ceses4deses4eeses4feses4geses4aeses4beses4cisis4disis4eisis4fisis4gisis4aisis4bisis4ceseh4deseh4eeseh4feseh4geseh4aeseh4beseh4ceh4deh4eeh4feh4geh4aeh4beh4cih4dih4eih4fih4gih4aih4bih4cisih4disih4eisih4fisih4gisih4aisih4bisih4c5d5e5f5g5a5b5ces5des5ees5fes5ges5aes5bes5cis5dis5eis5fis5gis5ais5bis5ceses5deses5eeses5feses5geses5aeses5beses5cisis5disis5eisis5fisis5gisis5aisis5bisis5ceseh5deseh5eeseh5feseh5geseh5aeseh5beseh5ceh5deh5eeh5feh5geh5aeh5beh5cih5dih5eih5fih5gih5aih5bih5cisih5disih5eisih5fisih5gisih5aisih5bisih5c6d6e6f6g6a6b6ces6des6ees6fes6ges6aes6bes6cis6dis6eis6fis6gis6ais6bis6ceseh6deseh6eeseh6feseh6geseh6aeseh6beseh6ceh6deh6eeh6feh6geh6aeh6beh6cih6dih6eih6fih6gih6aih6bih6cisih6disih6eisih6fisih6gisih6aisih6bisih6c7d7e7f7g7a7b7ces7des7ees7fes7ges7aes7bes7cis7dis7eis7fis7gis7ais7bis7c8cis8d8Interval interval_typeinterval_qualityinterval_directioninterval_octave Interval_Q AugmentedMajorPerfectMinor Diminished Interval_TSeventhSixthFifthFourthThirdSecondUnison interval_tyinterval_q_tbl interval_qinterval_q_reverseinterval_semitones note_spaninvert_orderingintervalinvert_intervalquality_difference_mquality_difference transposecircle_of_fifthsperfect_fourth perfect_fifth major_seventh i_to_intervalinterval_simplify Spelling_Mpc_spell_natural_mpc_spell_natural pc_spell_kspc_spell_sharp pc_spell_flatspell_cluster_c4_tablespell_cluster_c4spell_cluster_cspell_cluster_fspell_cluster_leftKeyMode_T Major_Mode Minor_Mode key_fifthsClefclef_t clef_octaveClef_T PercussionTrebleAltoTenorBass clef_range clef_suggest clef_zerobracketgenericRotate_left rotate_leftgenericRotate_right rotate_rightrotaterotate_r rotations genericAdj2adj2close adj2_cyclic interleaveinterleave_rotations histogramsegments intersect_lunion_l adj_intersectcyclescollatewith_keydx_dd_dx difference is_subset is_superset subsequenceelem_index_unique find_bounds dropRightat_headat_last separate_lastindicate_repetitionsadjacent_groupBy group_justmergeBy merge_set factorialnk_permutationsn_permutations permutationapply_permutationapply_permutation_cnon_invertible from_cyclespermutations_ncomposetwo_lineone_lineone_line_compactmultiplication_tablenk_combinations combinations permutationsmultiset_permutations Conforms_fBuild_fContour_Descriptioncontour_description_ncontour_description_mContour_Half_Matrixcontour_half_matrix_ncontour_half_matrix_mMatrixreplace all_equalcompare_adjacentadjacent_indices all_indicesgenericFromEnum genericToEnum ord_to_int int_to_ord ord_invertmatrix_fcontour_matrix half_matrix_fcontour_half_matrixcontour_half_matrix_strcontour_descriptioncontour_description_strhalf_matrix_to_descriptioncontour_description_ixuniform no_equalities all_contours implication violations is_possiblepossible_contoursimpossible_contourscontour_description_lmcontour_truncatecontour_is_prefix_of contour_eq_at draw_contourcontour_description_invert build_f_nbuild_sequence build_contourbuild_contour_retrybuild_contour_setbuild_contour_set_nodupex_1ex_2ex_3ex_4FaceF_TopF_BottomF_LeftF_RightF_FrontF_BackRelSeqHalf_SeqLabelQ12Q11Q10Q9Q8Q7Q6Q5Q4Q3Q2Q1L2LIG2E2D2full_seqlowerl_onseq_of half_seq_ofhalf_seqreverse_lookuplabel_of complementaryrelaterelate_l relations relations_lapply_relationapply_relationsapply_relations_lfacesviii_6_lviii_7 viii_6b_l viii_6b_p'viii_6b'viii_6bviii_6_relationsviii_6b_relationsRQ_T Tied_Rightrqtrqt_rqrqt_tied is_tied_right rqt_un_tupletrq_rqt rq_tie_lastrqt_to_duration_arqt_can_notate rqt_to_cmn rqt_to_cmn_lrqt_set_to_cmnRQ1_DivRQ_Divrq1_div_to_rq_div rq_div_verifyrq_div_mm_verifyrq_div_to_rq_set_trq_set_t_to_rqt rq_div_seq_rqpartitions_sumpartitions_sum_p rq1_div_univ Simplify_M Simplify_P Simplify_Tall_just all_rightcoalescecoalesce_accum coalesce_sumeither_to_maybe take_sum_bytake_sumtake_sum_by_eqsplit_sum_by_eq split_sum_t_f rqt_split_sum rqt_separaterqt_separate_mrqt_separate_tupletrqt_tuplet_subdividerqt_tuplet_subdivide_seqrqt_tuplet_sanity_ rqt_tuplet_subdivide_seq_sanity_to_measures_rqto_measures_rq_cmnto_measures_tsto_measures_ts_by_eqm_divisions_rqm_divisions_tsto_divisions_rqto_divisions_ts p_tuplet_rqtp_notatem_notate mm_notate meta_table_p meta_table_t default_tabledefault_8_ruledefault_4_rule default_rule m_simplifyp_simplify_rule p_simplifynotate zip_hold_lhszip_hold_lhs_errzip_hold m_ascribeascribe mm_ascribe group_chd ascribe_chdmm_ascribe_chd Dynamic_Node Hairpin_T End_Hairpin Diminuendo CrescendoDynamic_Mark_TSFFZSFZSFPPSFPSFFPFFFFFFFFFFFFFFMFMPPPPPPPPPPPPPPPPNientedynamic_mark_mididynamic_mark_dbimplied_hairpinempty_dynamic_nodedynamic_sequencedelete_redundant_marksdynamic_sequence_setsapply_dynamic_nodePsiDeltadif_idif_rabs_difsqrsqr_dif sqr_abs_dif sqrt_abs_difcity_block_metriceuclidean_metric_2euclidean_metric_lcbrtnthrtminkowski_metric_2minkowski_metric_ld_dx_abs olm_no_delta' olm_generalix_dif abs_ix_difsqr_abs_ix_difolm olm_no_deltaolm_no_delta_squared second_orderolm_no_delta_second_order!olm_no_delta_squared_second_order!second_order_binonial_coefficientdirection_intervalord_histdirection_vectoruldoldocducdcombinatorial_magnitude_matrixulm_simplifiedocm_zcmocmocm_absolute_scaled kanjutmesem_s kanjutmesem_pdarius_s madeleine_p lipur_sih_s lipur_sih_pidealized_et_sidealized_et_pax_rSieve IntersectionUnionEmptyunion intersection∪∩l⋄ normalise is_normalelementbuildbuildn differentiateeuclid de_meziriacreduce_intersectionreduce rti_related tmi_related rtmi_related rrtmi_relatedtn_to invert_ixtmatrixSC_Name t_rotations ti_rotations minimumBy_or t_cmp_prime ti_cmp_prime forte_cmp forte_primesc_tablesc_namescscsscs_nbipicicvSATVMAXMINof_c sc_table_n icv_minmaxr_ppsatv_f satv_e_ppsatv_ppsatv_asatv_bsatv satv_minmax satv_n_sumtwo_part_difference_vectortwo_part_difference_vector_setsatsim satsim_tablesatsim_table_histogramsimasimt_primeinv_symsc_t_ti t_sc_table t_sc_namet_sct_scst_scs_n t_subsets ti_subsetsrle rle_decode rle_lengtht_n_class_vectorti_n_class_vectordyad_class_percentage_vectorrelt_relti_relrahn_cmp rahn_primeSROintsrosrossro_Tnsro_TnIsro_RTnIsro_TnMI sro_RTnMIcfcggcgcg_rcisegcmplcycd_nmdimdim_nmdisdoifnhas_essess has_sc_pfhas_scicficiici_cicsegisegimbissbmxsnrmnrm_rpcirsrsgsbspscrnrtnmipcoencodedecode encode_primeDesignc_7_3_1b_7_3_1d_7_3_1n_7_3_1p_9_3_1b_13_4_1d_13_4_1n_13_4_1b_12_4_3n_12_4_3 bjorklundxdotiseqiseq_strbase Control.MonadmsumGHC.Base.mapreturn MonadPlus logict-0.6Control.Monad.Logic observeAllEitherLeftRight Data.MaybeMaybeGHC.RealroundRational fromRational/ghc-prim GHC.Classes<<=GHC.Num*StringRatio Text.ReadreadGHC.List concatMapminelem GHC.TypesFalse$fNumZ12 $fShowZ12Double Data.List genericIndexmod fromIntegraldivquotremprimes-0.2.1.0Data.Numbers.Primesprimes Data.Tupleuncurry% numerator denominator $fOrdDurationOrdcompare==OrderingLTGTEQcontainers-0.5.0.0 Data.TreeTreeNothingJustbreakzipWithzip Fractionalnubsort^multiset-comb-0.2.3Math.Combinatorics.Multiset integer-gmpGHC.Integer.TypeInteger $fOrdPitchGHC.Enum enumFromTofoldl1 intersectflip isInfixOf elemIndicesdropunfoldr-fromEnumtoEnumGHC.ShowShowTrueIntegralInt$fShowContour_Description$fShowContour_Half_MatrixidtakelookupconstsndNumReal realToFracabs GHC.Floatsqrtcurry>Charis_charget_intSTEPleftright bjorklund'