|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Pitch as octaves and ratios: from an interval to a frequency and back. More...
Pitch as octaves and ratios: from an interval to a frequency and back.
An interval is a number of octaves, continuous, or the frequency ratio it stands for: r = 2^octaves, so 1 octave is 2:1 and log2(3/2) octaves is a just fifth. A frequency is a reference moved by an interval, in the reference's own unit, Hz or cycles per frame. Nothing here holds a note, a scale, a division of the octave or a reference pitch: a tuning that maps keys or degrees to intervals sits above these functions (sound-byte-libs#146).
Plain math, no clamping: a non-finite input gives a non-finite output, and octaves_from_ratio() needs a ratio above 0.
Definition in file pitch.hpp.
#include <cmath>Go to the source code of this file.
Namespaces | |
| namespace | sbl |
| Root namespace for all Sound Byte Libs code. | |
| namespace | sbl::dsp |
| The audio stack. | |
| namespace | sbl::dsp::math |
| Math for the audio stack. | |
Functions | |
| float | sbl::dsp::math::ratio_from_octaves (float octaves) |
| The frequency ratio of an interval: 2^octaves. | |
| float | sbl::dsp::math::octaves_from_ratio (float ratio) |
| The interval of a frequency ratio, in octaves: log2(ratio). | |
| float | sbl::dsp::math::frequency (float reference, float octaves) |
| A reference frequency moved by an interval in octaves. | |