OverviewClamps PackagesCM DictionaryClamps DictionaryFomus

hertz

Function

(hertz freq {keyword value}*)

Returns the Hertz value of freq, which can be a note name, key number, Hertz value or list of the same.

hertz supports the following keyword arguments:

:hz boolean
If true then a numerical freq is interpreted as a Hertz value rather than as a key number.
:in tuning
The tuning to return the Hertz value from. The default value is *scale*.
:through { tuning | mode}
Filters freq through tuning or mode and returns the Hertz value of the closest Hertz values.

Examples

;; Converting notes and key numbers to Hertz.
(hertz 'c4)
 261.625
(hertz '(a4 c5 e))
 (440.0 523.2511 659.2552)
(hertz 0)
 8.175
(hertz '(69 69.5 70))
 (440.0 452.892 466.163)
;; Tunings and Hertz.
;;; define a scale whose steps are harmonics 8-16.
(define harms
  (new tuning :ratios (loop for i from 8 to 16 collect (/ i 8))
       :lowest (hertz 'c0)))

;; middle c octave
(hertz (loop for k from 32 to 40 collect k) :in harms)
 (261.625 294.328 327.031 359.735 392.438 425.14 457.844 490.54 523.25)

See Also