gpcsets-0.9.2.0: Generalized Pitch Class Sets for Haskell.

Data.PcSets

Description

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).

Synopsis

# Classes

class PcSet a whereSource

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.

Methods

modulus :: a -> IntSource

Determines the range of possible elements of the set, from 0 to (m-1). If m = 0, the set can only be empty.

elements :: a -> [Int]Source

Returns the elements of the set as a list.

pMap :: ([Int] -> [Int]) -> a -> aSource

Maps an integer list function across the members of the set, and returns the results in a new set of the same type.

Instances

 PcSet StdRow PcSet GenRow PcSet StdSet PcSet GenSet

class PcSet a => Selective a whereSource

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.

Methods

complement :: a -> aSource

Returns a new PcSet which is the complement of the original: it contains all the elements which the original does not.

Instances

 Selective StdSet Selective GenSet

class PcSet a => Inclusive a whereSource

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.

Methods

reconcile :: Int -> a -> aSource

Transposes the elements of a Tone Row so that the first element is n.

Instances

 Inclusive StdRow Inclusive GenRow

# Types

## Selective (Sets)

data GenSet Source

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.

Instances

 Eq GenSet Ord GenSet Show GenSet Selective GenSet PcSet GenSet

data StdSet Source

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).

Instances

 Eq StdSet Ord StdSet Show StdSet Selective StdSet PcSet StdSet

## Inclusive (Rows)

data GenRow Source

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.

Instances

 Eq GenRow Ord GenRow Show GenRow Inclusive GenRow PcSet GenRow

data StdRow Source

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.

Instances

 Eq StdRow Ord StdRow Show StdRow Inclusive StdRow PcSet StdRow

# Constructors

## Selective (Sets)

genset :: Int -> [Int] -> GenSetSource

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).

stdset :: [Int] -> StdSetSource

Constructor for Standard Pitch Class Sets. This constructor accepts any [Int] values for elements. The modulus is always 12 (12-TET).

## Inclusive (Rows)

genrow :: Int -> [Int] -> GenRowSource

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.

stdrow :: [Int] -> StdRowSource

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.

# General Operations (All Sets)

## Transformations

transpose :: PcSet a => Int -> a -> aSource

Returns a new PcSet which is the original transposed by n.

invert :: PcSet a => a -> aSource

Returns a new PcSet which is the standard inverse of the original, that is, about an axis containing pitch class 0.

invertXY :: PcSet a => Int -> Int -> a -> aSource

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.

zero :: PcSet a => a -> aSource

Returns a new PcSet in which the elements have been transposed so that the first element is zero.

## Permutations

retrograde :: PcSet a => a -> aSource

Returns a new PcSet with the elements of the original reversed.

rotate :: PcSet a => Int -> a -> aSource

Returns a new PcSet with the elements shifted n places to the left.

# Selective Set Operations

## Systematically Equivalent Forms

sort :: (PcSet a, Selective a) => a -> aSource

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.)

normal :: (PcSet a, Selective a) => a -> aSource

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.

reduced :: (PcSet a, Selective a) => a -> aSource

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.

prime :: (PcSet a, Selective a) => a -> aSource

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.

## Scalar Quantities

cardinality :: (PcSet a, Selective a) => a -> IntSource

Returns the number of elements in a Selective PcSet.

binaryValue :: (PcSet a, Selective a) => a -> IntegerSource

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).

## Vector Quantities

avec :: (PcSet a, Selective a) => a -> [Int]Source

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.

cvec :: (PcSet a, Selective a) => a -> [Int]Source

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.

ivec :: (PcSet a, Selective a) => a -> [Int]Source

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.

# Inclusive Set (Tone Row) Operations

rowP :: (PcSet a, Inclusive a) => Int -> a -> aSource

Returns a new Tone Row in which the elements are Prograde (in their original order) and transposed so that the first element is n.

rowR :: (PcSet a, Inclusive a) => Int -> a -> aSource

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.

rowI :: (PcSet a, Inclusive a) => Int -> a -> aSource

Returns a new Tone Row in which the elements have been Inverted (see invert) and transposed so that the first element is n.

rowRI :: (PcSet a, Inclusive a) => Int -> a -> aSource

Returns a new Tone Row in which the elements are both Retrograde and Inverted, and transposed so that the first element is n.