# Pitch interval

In musical set theory, there are four kinds of interval:
* Ordered pitch interval
* Unordered pitch interval
* Ordered pitch-class interval
* Unordered pitch-class interval

## Pitch Intervals
### Ordered Pitch Interval

The ordered pitch interval. is the number of semitones that separates one pitch from another, upward or downward. It is thus more specific than the unordered pitch interval in that it represents the directionality of the interval. An ordered pitch interval always includes a plus or minus sign. Thus this interval type can describe a melodic as well as a harmonic interval.

### Unordered Pitch Interval

The unordered pitch interval does not include directionality information and is thus less specific than the ordered pitch interval. It is still the distance between two pitches measured in semitones, but that distance is not qualified by a positive (+) or negative symbol. (-). An unordered pitch interval can describe a harmonic interval but not a melodic interval.
Both types of pitch intervals describe octave information in that they do not treat all octaves as being equivalent. Pitch intervals, both ordered and unordered, may therefore be larger than 12.

### Comparison to Pitch-Class Intervals

By treating all octaves as being equivalent, pitch-classes contain less information (ex 'C') than pitches (ex: C3). Pitch-class intervals (below) are therefore never larger than 12 semitones.

## Pitch-Class Intervals

In musical set theory, pitch-class intervals do not distinguish between octaves since pitch-classes themselves treat all octaves as being equivalent.
There are two kinds of pitch-class intervals:
* ordered pitch-class interval (also called a pitch-interval class - PIC)
* unordered pitch-class interval (also called an 'interval class')

### Ordered pitch-class intervals ('pitch interval class; PIC')

The ordered pitch-class interval describes the number of ascending semitones from one pitch-class to the next, ordered from lowest to highest.
Since pitch-classes have octave equivalence, the ordered pitch -class interval can be computed mathematically as "the absolute value of the difference between the two pitch-classes modulo 12". See Equations, below. A more visual way to do this calculation is to place the pitch-classes on a clockface and measure the difference, always going clockwise (i.e. always ascending).

### Unordered pitch-class intervals ('interval class; IC')

Unlike the ordered, the unordered pitch-class interval (often called the 'Interval class') does not require the two pitch-classes to be ordered from lowest to highest. Rather, this type of interval measures in semitones whichever interval is smallest.
Because of symmetry, the smallest semitone interval between any two pitch-classes can only be an integer between 0 and 6. (hence the seven 'interval classes') The tonal interval names 'minor 2nd' and 'major 7th' both correspond to "interval class 1" for example, this is because both are composed of one semitone and directional order is unimportant when the criteria become to select the smallest interval.
Similarly, the 'augmented fourth' and the 'diminished fifth' both correspond to 'interval class 6'. There is no 'interval class 7' therefore, since counting down five semitones can describe the perfect fifth more parsimoniously that counting up seven semitones can.
A visual way to do determine an unordered pitch-class interval is to place the pitch-classes on a clockface and measure clockwise or counter-clockwise, whichever distance is smaller.

## Equations

Using integer notation and modulo 12, ordered pitch interval, ip, may be defined, for any two pitches x and y, as:
* $\operatorname {ip} \langle x,y\rangle =y-x$
and:
* $\operatorname {ip} \langle y,x\rangle =x-y$
the other way.
Ascending intervals are indicated by a positive value, and descending intervals by a negative one.
One can also measure the distance between two pitches without taking into account direction with the unordered pitch interval, similar to the interval of tonal theory. This may be defined as:
* $\operatorname {ip} (x,y)=|y-x|$
The interval between pitch-classes may be measured with ordered and unordered pitch-class intervals. The ordered one, also called directed interval, may be considered the measure upwards, which, since we are dealing with pitch classes, depends on whichever pitch is chosen as 0. Thus, the ordered pitch-class interval, i⟨x, y⟩, may be defined as:
* $\operatorname {i} \langle x,y\rangle =y-x$ (in modular 12 arithmetic)
The unordered pitch-class interval i(x, y) may be defined as
* $i(x,y)={\text{ the smaller of }}i\langle x,y\rangle {\text{ and }}i\langle y,x\rangle$