- [Function]
(
harmonics
low high {keyword value}*)
Returns the harmonic series between harmonic numbers low and high (inclusive) as a list of ratios, hertz values or floating point keynums according to keyword arguments.
harmonics
supports the following keyword arguments:
-
:hertz
number - The frequency base of the returned series. The default value of 1 Hz returns rational frequency ratios.
-
:keynum
{keynum | note} - A keynum specification of the base frequency returns floating point key numbers.
-
:undertones
boolean - If true then undertones are generated, i.e. the reciprocals of the harmonics between low and high in decreasing order. The default value is false.
-
:invert
boolean - If true the harmonic series between low and high is inverted, or flipped. The default value is false.
-
:rescale
number - If provided the entire series is rescaled to lie between the values :hertz and :rescale (inclusive). If :keynum is specified then the value of :rescale must be a key number as well.
-
:scale-order
{false | :reverse | :up | :down | :random} - Optionally reorders the series. If false then overtones are returned in ascending order and undertones in decending order. The value :reverse reverses this. The value :up reverses undertones without affecting overtones and :down does the opposite. The value :random returns a random permutation of the list. The default value is false.
-
:harmonic
integer - If specified then integer must be a harmonic number between low and high (inclusive) and only that harmonic value is returned.
Examples:
Example 1. Generating frequency ratios.
(harmonics 1 8) ⇒ (1 2 3 4 5 6 7 8) (harmonics 8 16) ⇒ (1 9/8 5/4 11/8 3/2 13/8 7/4 15/8 2) (harmonics 1 8 :undertones #t) ⇒ (1 1/2 1/3 1/4 1/5 1/6 1/7 1/8) (harmonics 8 16 :undertones #t) ⇒ (1 8/9 4/5 8/11 2/3 8/13 4/7 8/15 1/2) (harmonics 1 8 :invert #t) ⇒ (1 8/7 4/3 8/5 2 8/3 4 8) (harmonics 1 8 :undertones #t :invert #t) ⇒ (1 7/8 3/4 5/8 1/2 3/8 1/4 1/8) (define septimal-scale (new tuning :ratios (harmonics 7 14)))
Example 2. Hertz and key numbers.
(harmonics 1 8 :hertz 100) ⇒ (100 200 300 400 500 600 700 800) (harmonics 6 12 :hertz 100.0) ⇒ (100.0 116.666664 133.33334 150.0 166.66666 183.33334 200.0) (harmonics 1 8 :keynum 'c2) ⇒ (35.999992 47.999992 55.019547 60.0 63.863136 67.01955 69.68826 72.0) (harmonics 8 12 :keynum 'a4 :scale-order ':random) ⇒ (74.51318 76.019554 71.03909 79.88269 69.0 72.86314 78.68826 77.40527 81.0) (harmonics 1 4 :keynum 60 :harmonic 3) ⇒ 79.01955
See also:
fm-spectrum
[Function]rm-spectrum
[Function]