-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generalized Pitch Class Sets for Haskell. -- -- An implementation of musical pitch class sets for Haskell. This -- library is capable of handling standard 12-tone pitch class sets and -- tone rows. However, it is also capable of handling GENERAL pitch class -- sets, which may come from alternative equal temperament systems. @package gpcsets @version 0.9.2.0 module Data.PcSets.Notes test :: Int module Data.PcSets.Catalog test :: Int -- | The basic module for working with Pitch Class Sets of all kinds, -- including Tone Rows. The broadest datatypes (GenSet and -- GenRow) can model any equal temperament system; the standard -- datatypes (StdSet and StdRow) model 12 Tone Equal -- Temperament (12-TET). module Data.PcSets -- | The broadest class of Pitch Class Set. All members of this class have -- a modulus which restricts their elements in some way. -- They also have pMap, a method for lifting integer list -- functions to act on set elements. The modulus corresponds to -- the underlying system of equivalent pitch classes, for example, 12-TET -- = modulus 12. class PcSet a modulus :: PcSet a => a -> Int elements :: PcSet a => a -> [Int] pMap :: PcSet a => ([Int] -> [Int]) -> a -> a -- | Selective Pitch Class Sets can have elements in a range of -- values permitted by their modulus. They can have as few as 0 -- (the empty set) or as many as all. The set complement operation -- only makes sense for Selective sets. class PcSet a => Selective a complement :: Selective a => a -> a -- | Inclusive Pitch Class Sets, or Tone Rows, have all the possible -- elements permitted by their modulus. The most important -- characteristic of a Tone Row is not its elements, but the -- ordering of its elements. class PcSet a => Inclusive a reconcile :: Inclusive a => Int -> a -> a -- | General Pitch Class Set. This represents a Pitch Class Set that can -- have a modulus of any positive integer value, representing the -- number of equivalent pitch classes in a given system; for example, -- 19-TET would be a modulus 19 set. The members of a the set can be as -- few as zero and as many as all possible values. data GenSet -- | Standard Pitch Class Set. This represents the traditional definition -- of a pitch class set, based on 12-TET, with the pitch classes numbered -- C = 0, C#/Db = 1, D = 2, and so on up to B = 11. This set can have -- anywhere from zero to 12 members (the empty set vs. the chromatic -- scale). data StdSet -- | General Tone Row. A Tone Row is a collection of all possible -- Pitch Class Set elements within a given modulus. Since -- it contains all elements, the significant information in this type of -- set is the ordering of the elements. This set always has a -- length equal to its modulus. data GenRow -- | Standard Tone Row. This is the traditional Tone Row, a collection of -- all the elements [0..11], based on 12-TET. As with -- GenRow, the most significant information in this type of set is -- the ordering of the elements. Since this is always a complete set, -- this set always has a length of 12. data StdRow -- | Constructor for General Pitch Class Sets. This constructor accepts any -- Int value for modulus, and any [Int] values -- for an input list. Zero modulus always returns an empty set; a -- negative modulus is always taken as positive (since the number -- represent the absolute size of the equivalence class). genset :: Int -> [Int] -> GenSet -- | Constructor for Standard Pitch Class Sets. This constructor accepts -- any [Int] values for elements. The modulus is always -- 12 (12-TET). stdset :: [Int] -> StdSet -- | Constructor for General Tone Rows. This constructor accepts any -- Int value for modulus, and any [Int] values -- for an input list. Zero modulus always returns an empty set; a -- negative modulus is always taken as positive (see -- GenSet). If the input list of elements is incomplete, -- the remaining elements are filled in at the end, in order. genrow :: Int -> [Int] -> GenRow -- | Constructor for Standard Tone Rows. This constructor accepts any -- [Int] values for an input list. The modulus is always -- 12 (12-TET). If the input list of elements is incomplete, the -- remaining elements are filled in at the end, in order. stdrow :: [Int] -> StdRow -- | Returns a new PcSet which is the original transposed by -- n. transpose :: PcSet a => Int -> a -> a -- | Returns a new PcSet which is the standard inverse of the -- original, that is, about an axis containing pitch class 0. invert :: PcSet a => a -> a -- | Inversion around an axis specified by pitch classes x and -- y. This inverts the set in such a way that x becomes -- y and y becomes x. invertXY :: PcSet a => Int -> Int -> a -> a -- | Returns a new PcSet in which the elements have been transposed -- so that the first element is zero. zero :: PcSet a => a -> a -- | Returns a new PcSet with the elements of the original reversed. retrograde :: PcSet a => a -> a -- | Returns a new PcSet with the elements shifted n places -- to the left. rotate :: PcSet a => Int -> a -> a -- | Returns a Selective PcSet in which the elements of the -- original have been sorted in ascending order. (Note this is restricted -- to Sets, as sorting a Tone Row produces only an ascending chromatic -- scale.) sort :: (PcSet a, Selective a) => a -> a -- | Returns a Selective PcSet in which the elements of the -- original have been put into normal form. This can be defined as -- an ascending order in which the elements fit into the smallest overall -- interval. In the event of a tie, the arrangement with the closest -- leftward packing is chosen. normal :: (PcSet a, Selective a) => a -> a -- | Returns a Selective PcSet in which the elements of the -- original have been put into reduced form. This can be thought -- of as the normal form, transposed so that the first element -- starts on zero. reduced :: (PcSet a, Selective a) => a -> a -- | Returns a Selective PcSet in which the elements of the -- original have been put into prime form. A prime form is able to -- generate all the members of its set family through the some -- combination of the operations transpose, invert, and -- simple permutation. prime :: (PcSet a, Selective a) => a -> a -- | Returns the number of elements in a Selective PcSet. cardinality :: (PcSet a, Selective a) => a -> Int -- | Binary Value. For a given Selective PcSet, this returns -- a unique number relating to the elements of the set -- a -- measure of the leftward packing of the sorted set (overall -- closeness of each element to zero). binaryValue :: (PcSet a, Selective a) => a -> Integer -- | Ascending Vector. If the elements of a Selective PcSet -- are taken to be in strictly ascending order, the ascending vector is -- the interval difference between each element. avec :: (PcSet a, Selective a) => a -> [Int] -- | Common Tone Vector: finds the number of common tones for each possible -- value of n in the operation transpose n . -- invert. Returns a list where element 0 is the number of common -- tones with n=0, element 1 is with n=1, and so on. cvec :: (PcSet a, Selective a) => a -> [Int] -- | Interval Vector. Each element of the interval vector represents the -- number of intervals in the set for that particular interval class. -- Element 0 measures the number of 1-interval leaps; element 1 measures -- the number of 2-interval leaps, and so on, up to half of the modulus -- m. ivec :: (PcSet a, Selective a) => a -> [Int] -- | Returns a new Tone Row in which the elements are Prograde (in -- their original order) and transposed so that the first element is -- n. rowP :: (PcSet a, Inclusive a) => Int -> a -> a -- | Returns a new Tone Row in which the elements are Retrograde -- (reversed compared to their original order) and transposed so that the -- first element is n. rowR :: (PcSet a, Inclusive a) => Int -> a -> a -- | Returns a new Tone Row in which the elements have been Inverted -- (see invert) and transposed so that the first element is -- n. rowI :: (PcSet a, Inclusive a) => Int -> a -> a -- | Returns a new Tone Row in which the elements are both -- Retrograde and Inverted, and transposed so that the -- first element is n. rowRI :: (PcSet a, Inclusive a) => Int -> a -> a instance Eq StdRow instance Ord StdRow instance Show StdRow instance Eq GenRow instance Ord GenRow instance Show GenRow instance Eq StdSet instance Ord StdSet instance Show StdSet instance Eq GenSet instance Ord GenSet instance Show GenSet instance Inclusive StdRow instance PcSet StdRow instance Inclusive GenRow instance PcSet GenRow instance Selective StdSet instance PcSet StdSet instance Selective GenSet instance PcSet GenSet -- | This module translates Pitch Class Sets to and from Compact -- Format. In Compact Format, data such as StdSet [0,4,7,11] could be -- represented by the string 047B, which uses a single alphanumeric -- character for each pitch class element. -- -- Limitations: this module is only usable for pitch class sets of -- modulus 36 or below. Beyond that, it's not really certain that a -- compact format would be of any practical use. module Data.PcSets.Compact -- | Creates a new General Pitch Class Set of modulus n. -- Alphanumeric character values 0-9 and A-Z represent the numbers 0 to -- 36. Other inputs, including whitespace, are ignored. toGenSet :: Int -> String -> GenSet -- | Creates a new Standard (modulus 12) Pitch Class Set. Here, input -- characters 0-9 count as their decimal equivalents; the letter A -- stands for 10, and the letter B stands for 11. Other inputs, -- including whitespace, are ignored. toStdSet :: String -> StdSet -- | Creates a new Standard (modulus 12) Pitch Class Set, using an -- alternative duodecimal format. Here, input characters 0-9 count as -- their decimal equivalents; the letter T stands for 10, and the -- letter E stands for 11. Other inputs, including whitespace, are -- ignored. toStdSet' :: String -> StdSet -- | Creates a new General Tone Row of modulus n. Alphanumeric -- character values 0-9 and A-Z represent the numbers 0 to 36. Other -- inputs, including whitespace, are ignored. Since Tone Rows must -- contain all possible elements, an incomplete entry list will result in -- a new row with the missing tones added at the end. toGenRow :: Int -> String -> GenRow -- | Creates a new Standard (modulus 12) Tone Row. Here, input characters -- 0-9 count as their decimal equivalents; the letter A stands for -- 10, and the letter B stands for 11. Other inputs, including -- whitespace, are ignored. (Also, see notes for toGenRow.) toStdRow :: String -> StdRow -- | Creates a new Standard (modulus 12) Tone Row, using an alternative -- duodecimal format. Here, input characters 0-9 count as their decimal -- equivalents; the letter T stands for 10, and the letter -- E stands for 11. Other inputs, including whitespace, are -- ignored. (Also, see notes for toGenRow.) toStdRow' :: String -> StdRow -- | Translates a Pitch Class Set or Tone Row to Compact Format. Values -- from 0-9 are translated as the characters 0-9; values from 10 to 35 -- are translated as charaters A-Z. Values which are out of the -- representable range are ignored, therefore this function is not -- suitable for sets of modulus 37 or greater. compact :: PcSet a => a -> String -- | This function is identical to compact, except that Standard -- (modulus 12) sets and rows are rendered using T for 10 and -- E for 11. compact' :: PcSet a => a -> String -- | This module produces simple representations of Pitch Class Sets -- suitable for use in Scalable Vector Graphics. By default it does not -- generate the files -- instead, it generates a printable string, which -- can be captured to standard output or directed to a file at your -- discretion. module Data.PcSets.Svg -- | The basic idea: generate SVG data for an input pitch class set. pcSvg :: PcSet a => a -> String -- | Same as pcSvg, but includes an invertXY style axis. pcSvgAx :: PcSet a => a -> (Int, Int) -> String -- | Same as pcSvg but allows a custom Rendering. pcSvg' :: PcSet a => Rendering -> a -> String -- | Same as pcSvgAx, but allows a custom Rendering. pcSvgAx' :: PcSet a => Rendering -> a -> (Int, Int) -> String -- | Stores the rendering information for the SVG file. data Rendering Rendering :: Int -> String -> String -> String -> String -> Float -> Float -> Float -> Rendering -- | sets the (square) image dimensions pxSize :: Rendering -> Int -- | line color for the main structures lnColor :: Rendering -> String -- | pitch class set color psColor :: Rendering -> String -- | complementary set color csColor :: Rendering -> String -- | axis color axColor :: Rendering -> String -- | proportion of main circle compared to image relMain :: Rendering -> Float -- | proportion of elements compared to main circle relElem :: Rendering -> Float -- | proportion of axis (if any) compared to image relAxis :: Rendering -> Float -- | The Standard Rendering is a 500x500 image using black lines, -- with elements of the set in red, the complement in black, and any axis -- in blue. The pitch class set circle is 80% of the frame, each element -- is 10% of the main circle's size, and any axis is 95% frame size. stdRen :: Rendering instance Show PTag instance Show Tag instance Show Attr