interval

[Function]
  (`interval` arg [arg2])

Encodes a typed interval from an external description specified in arg and arg2. If arg and arg2 are both notes in the standard chromatic scale then a typed interval is encoded by "subtracting" the first note from the second such that an ascending interval will be encoded if arg2 is a higher than arg, otherwise a descending interval is encoded. If arg is a "note class" (a note with no octave number) then the encoded interval is always ascending regardless of arg2.

If arg is not a note then it should name the quality of the interval and arg2 should be its size. Possible interval qualities and their shorthand "nicknames" are:

> `doubly-diminished`, `ddim`, `dd`
> `diminished`, `dim`, `d`
> `minor`, `min`, `mi`
> `major`, `maj`, `ma`, `mj`
> `perfect`, `p`
> `augmented`, `aug`, `a`
> `doubly-augmented`, `aaug`, `aa`

Qualities can be expressed as keywords or regular symbols. The size specified in arg2 is the positive or negative number of "letter steps", where 1 means unison, 2 means a second, 8 means an octave, 10 mean a tenth, 15 means two octaves and so on.

Some sample interval specifications:

> Perfect unison | `(interval 'perfect 1)`
> major third | `(interval 'maj 3)`
> augmented fourth down | `(interval 'a -4)`
> doubly-diminished octave | `(interval 'dd 8)`
> minor tenth down | `(interval 'minor -10)`
> perfect fifth | `(interval 'p 5)`
> doubly augmented seventh | `(interval 'aaug 7)`

If arg2 is not specified then arg should be a list of two values. In this case the first value in the list becomes the value of arg and the second value in the list becomes the value for arg2. The following four expressions all create an augmented 6th interval:

> `(interval 'fs4 'dss5)`
> `(interval '(fs4 dss5))`
> `(interval 'aug 6)`
> `(interval '(aug 6))`

    cm> (interval 'c4 'ds4)
    86275
    cm> (transpose 'g4 86275)
    as4
    cm> (transpose 'c4 (interval :aug 4))
    fs4
    cm> (transpose 'c4 (interval '(dim 5) ))
    gf4
    cm> (transpose 'cs4 (interval 'min -10 ))
    as2
    cm> (transpose 'es4 (interval :p 12 ))
    bs5
    cm> (transpose 'fs3 (interval '(:dd 10) ))
    aff4
    cm>

#### See Also:

- `decode-interval``` [Function]