Description

Tools for creating and manipulation Pitch Factor Diagrams, a tool for representing musical intervals and examining their relations.

Synopsis

# Documentation

semi :: Floating a => a Source #

12 tone equal temperament semitone ratio. Equal to 2 ** (1/12).

allSemis :: Floating a => [a] Source #

12 tone equal temperament ratios for all semitones in an octave.

takeFinAlignments :: Floating a => Int -> [[a]] Source #

List multiples of the single octave semitone ratios upto a certain amount.

newtype PitchFactorDiagram Source #

A pitch factor diagram is a list of prime exponents that represents a rational number via diagramToRatio. These are useful because pitches with few prime factors, that is, small PitchFactorDiagrams with small factors in them, are generally consonant, and many interesting just intonation intervals can be written this way (see perfectFifth and majorThird).

Constructors

 Factors FieldsgetFactors :: [Integer]
Instances
 Source # Instance detailsDefined in Boopadoop.Diagram MethodsshowList :: [PitchFactorDiagram] -> ShowS # Source # PitchFactorDiagrams are combined by multiplying their underlying ratios (adding factors). Instance detailsDefined in Boopadoop.Diagram Methodsstimes :: Integral b => b -> PitchFactorDiagram -> PitchFactorDiagram # Source # mempty is the unison PFD, with ratio 1. Instance detailsDefined in Boopadoop.Diagram Methods

Convert a factor diagram to the underlying ratio by raising each prime (starting from two) to the power in the factor list. For instance, going up two perfect fifths and down three major thirds yields:  diagramToRatio (Factors [4,2,-3]) = (2 ^^ 4) * (3 ^^ 2) * (5 ^^ (-3)) = 144/125 

Similar to diagramToRatio, but simplifies the resulting ratio to the simplest ratio within 0.05.

Convert a PFD to its decimal number of semitones. Useful for approximating weird ratios in a twelvetone scale:  diagramToSemi (normalizePFD \$ Factors [0,0,0,1]) = diagramToSemi (countPFD (7/4)) = 9.688259064691248 

Normalize a PFD by raising or lowering it by octaves until its ratio lies between 1 (unison) and 2 (one octave up). This operation is idempotent.

Same as countPFD but makes an effort to simplify the ratio from a Double slightly to the simplest rational number within 0.0001.

Calculates the PitchFactorDiagram corresponding to a given frequency ratio by finding prime factors of the numerator and denominator.

Converts a PFD into an operation on frequencies. intervalOf perfectFifth concertA is the just intonation E5.

Scale a PFD by raising the underlying ratio to the given power. scalePFD 2 perfectFifth = addPFD octave majorSecond

Inverts a PFD. invertPFD = scalePFD (-1)

Adds two PFDs together by multiplying their ratios. addPFD minorThird majorThird = perfectFifth

Prints the natural numbers from the given value up to 128, highlighting primes and powers of two. Interesting musical intervals are build out of the relative distance of a prime between the two nearest powers of two.