Intervals in Integer Notation
Post-tonal theory measures intervals as counts of semitones rather than by tonal quality and size. An ordered pitch-class interval from pc x to pc y is computed as (y − x) mod 12 — it is directed, so moving from C (0) up to E (4) gives interval 4, while moving from E (4) up to C (0) gives (0 − 4) mod 12 = 8. The twelve ordered pc intervals are the integers 0 through 11.
An unordered pitch-class interval (also called the interval between two pitch classes) is simply the shorter of the two directed intervals between the pair: min((y − x) mod 12, (x − y) mod 12). This is always a value between 0 and 6. For example, C and G differ by 7 semitones going up or 5 going down; the unordered interval is 5.
Interval classes (ICs) collapse inversionally related intervals into a single category, because an interval and its inversion are perceptually similar in atonal contexts. The six interval classes are IC 1 (semitone/major seventh), IC 2 (whole tone/minor seventh), IC 3 (minor third/major sixth), IC 4 (major third/minor sixth), IC 5 (perfect fourth/perfect fifth), and IC 6 (tritone, which is its own inversion). Any interval between 0 and 11 maps to an interval class by taking min(interval, 12 − interval), giving a result from 0 to 6; IC 0 denotes a unison or octave.