|
🍑 nectarine
Audio synthesis tools for C23
|
Waveform functions. More...
#include <stddef.h>#include <math.h>#include "vendor/prelude/hint.h"Go to the source code of this file.
Functions | |
| static long double | nec_wrapl (long double phase) |
| Maps an arbitrary phase into the domain [0, 1). | |
| static double | nec_wrap (double phase) |
| Maps an arbitrary phase into the domain [0, 1). | |
| static float | nec_wrapf (float phase) |
| Maps an arbitrary phase into the domain [0, 1). | |
| static void | nec_fill_wrapl (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Maps a buffer of arbitrary phases into the domain [0, 1). | |
| static void | nec_fill_wrap (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Maps a buffer of arbitrary phases into the domain [0, 1). | |
| static void | nec_fill_wrapf (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Maps a buffer of arbitrary phases into the domain [0, 1). | |
| static long double | nec_analog_sawtoothl (long double phase) |
| Analog-like sawtooth waveform. | |
| static double | nec_analog_sawtooth (double phase) |
| Analog-like sawtooth waveform. | |
| static float | nec_analog_sawtoothf (float phase) |
| Analog-like sawtooth waveform. | |
| static void | nec_fill_analog_sawtoothl (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with an analog-like sawtooth waveform. | |
| static void | nec_fill_analog_sawtooth (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Fills a buffer with an analog-like sawtooth waveform. | |
| static void | nec_fill_analog_sawtoothf (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Fills a buffer with an analog-like sawtooth waveform. | |
| static long double | nec_analog_squarel (long double phase, long double duty) |
| Analog-like square waveform. | |
| static double | nec_analog_square (double phase, double duty) |
| Analog-like square waveform. | |
| static float | nec_analog_squaref (float phase, float duty) |
| Analog-like square waveform. | |
| static void | nec_fill_analog_squarel (size_t len, long double phase[const restrict static len], long double duty[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with an analog-like square waveform. | |
| static void | nec_fill_analog_square (size_t len, double phase[const restrict static len], double duty[const restrict static len], double output[restrict static len]) |
| Fills a buffer with an analog-like square waveform. | |
| static void | nec_fill_analog_squaref (size_t len, float phase[const restrict static len], float duty[const restrict static len], float output[restrict static len]) |
| Fills a buffer with an analog-like square waveform. | |
| static long double | nec_analog_trianglel (long double phase) |
| Analog-like triangle waveform. | |
| static double | nec_analog_triangle (double phase) |
| Analog-like triangle waveform. | |
| static float | nec_analog_trianglef (float phase) |
| Analog-like triangle waveform. | |
| static void | nec_fill_analog_trianglel (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with an analog-like triangle waveform. | |
| static void | nec_fill_analog_triangle (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Fills a buffer with an analog-like triangle waveform. | |
| static void | nec_fill_analog_trianglef (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Fills a buffer with an analog-like triangle waveform. | |
| static long double | nec_paraboll (long double phase) |
| Fast sine approximation waveform. | |
| static double | nec_parabol (double phase) |
| Fast sine approximation waveform. | |
| static float | nec_parabolf (float phase) |
| Fast sine approximation waveform. | |
| static void | nec_fill_paraboll (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with a fast sine approximation waveform. | |
| static void | nec_fill_parabol (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Fills a buffer with a fast sine approximation waveform. | |
| static void | nec_fill_parabolf (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Fills a buffer with a fast sine approximation waveform. | |
| static long double | nec_sinl (long double phase) |
| Accurate sine approximation waveform. | |
| static double | nec_sin (double phase) |
| Accurate sine approximation waveform. | |
| static float | nec_sinf (float phase) |
| Accurate sine approximation waveform. | |
| static void | nec_fill_sinl (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with an accurate sine approximation waveform. | |
| static void | nec_fill_sin (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Fills a buffer with an accurate sine approximation waveform. | |
| static void | nec_fill_sinf (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Fills a buffer with an accurate sine approximation waveform. | |
| static long double | nec_circlel (long double phase) |
| Circle waveform function. | |
| static double | nec_circle (double phase) |
| Circle waveform function. | |
| static float | nec_circlef (float phase) |
| Circle waveform function. | |
| static void | nec_fill_circlel (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with a circle waveform. | |
| static void | nec_fill_circle (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Fills a buffer with a circle waveform. | |
| static void | nec_fill_circlef (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Fills a buffer with a circle waveform. | |
| static long double | nec_sawtoothl (long double phase) |
| Basic sawtooth waveform. | |
| static double | nec_sawtooth (double phase) |
| Basic sawtooth waveform. | |
| static float | nec_sawtoothf (float phase) |
| Basic sawtooth waveform. | |
| static void | nec_fill_sawtoothl (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with a sawtooth waveform. | |
| static void | nec_fill_sawtooth (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Fills a buffer with a sawtooth waveform. | |
| static void | nec_fill_sawtoothf (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Fills a buffer with a sawtooth waveform. | |
| static long double | nec_squarel (long double phase, long double duty) |
| Basic square waveform. | |
| static double | nec_square (double phase, double duty) |
| Basic square waveform. | |
| static float | nec_squaref (float phase, float duty) |
| Basic square waveform. | |
| static void | nec_fill_squarel (size_t len, long double phase[const restrict static len], long double duty[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with a square waveform. | |
| static void | nec_fill_square (size_t len, double phase[const restrict static len], double duty[const restrict static len], double output[restrict static len]) |
| Fills a buffer with a square waveform. | |
| static void | nec_fill_squaref (size_t len, float phase[const restrict static len], float duty[const restrict static len], float output[restrict static len]) |
| Fills a buffer with a square waveform. | |
| static long double | nec_trianglel (long double phase) |
| Basic triangle waveform. | |
| static double | nec_triangle (double phase) |
| Basic triangle waveform. | |
| static float | nec_trianglef (float phase) |
| Basic triangle waveform. | |
| static void | nec_fill_trianglel (size_t len, long double phase[const restrict static len], long double output[restrict static len]) |
| Fills a buffer with a triangle waveform. | |
| static void | nec_fill_triangle (size_t len, double phase[const restrict static len], double output[restrict static len]) |
| Fills a buffer with a triangle waveform. | |
| static void | nec_fill_trianglef (size_t len, float phase[const restrict static len], float output[restrict static len]) |
| Fills a buffer with a triangle waveform. | |
Variables | |
| static constexpr long double | NECTARINE_SINE_ERR_CORRECTION_WEIGHT = 0.225l |
| Error correction term used to increase the accuracy of nec_sin. | |
Waveform functions.
|
inlinestaticnodiscard |
Analog-like sawtooth waveform.
This sawtooth waveform changes with an exponential curve to emulate a discharging capacitor (or charging, when inverted).
To be more precise, it approximates the exponential curve \(\frac{2e}{e-1}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Analog-like sawtooth waveform.
This sawtooth waveform changes with an exponential curve to emulate a discharging capacitor (or charging, when inverted).
To be more precise, it approximates the exponential curve \(\frac{2e}{e-1}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Analog-like sawtooth waveform.
This sawtooth waveform changes with an exponential curve to emulate a discharging capacitor (or charging, when inverted).
To be more precise, it approximates the exponential curve \(\frac{2e}{e-1}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Analog-like square waveform.
This square waveform decays with an exponential curve to emulate a discharging capacitor.
To be more precise, it approximates the exponential curve \(\frac{e}{2\left(e-1\right)}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
| duty | The duty cycle of the waveform, in domain [0, 1]. |
|
inlinestaticnodiscard |
Analog-like square waveform.
This square waveform decays with an exponential curve to emulate a discharging capacitor.
To be more precise, it approximates the exponential curve \(\frac{e}{2\left(e-1\right)}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
| duty | The duty cycle of the waveform, in domain [0, 1]. |
|
inlinestaticnodiscard |
Analog-like square waveform.
This square waveform decays with an exponential curve to emulate a discharging capacitor.
To be more precise, it approximates the exponential curve \(\frac{e}{2\left(e-1\right)}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
| duty | The duty cycle of the waveform, in domain [0, 1]. |
|
inlinestaticnodiscard |
Analog-like triangle waveform.
This triangle waveform changes with an exponential curve to emulate a charging and discharging capacitor.
To be more precise, it approximates the exponential curve \(\frac{2e}{e-1}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Analog-like triangle waveform.
This triangle waveform changes with an exponential curve to emulate a charging and discharging capacitor.
To be more precise, it approximates the exponential curve \(\frac{2e}{e-1}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Analog-like triangle waveform.
This triangle waveform changes with an exponential curve to emulate a charging and discharging capacitor.
To be more precise, it approximates the exponential curve \(\frac{2e}{e-1}\left(e^{-x}-1\right)+1\) using a rational function.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Circle waveform function.
This waveform looks like an alternating semicircle.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Circle waveform function.
This waveform looks like an alternating semicircle.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Circle waveform function.
This waveform looks like an alternating semicircle.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestatic |
Fills a buffer with an analog-like sawtooth waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sawtooth waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like sawtooth waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sawtooth waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like sawtooth waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sawtooth waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like square waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [in] | duty | A buffer full of duty cycles in domain [0, 1]. |
| [out] | output | A buffer to be filled with samples of a square waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like square waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [in] | duty | A buffer full of duty cycles in domain [0, 1]. |
| [out] | output | A buffer to be filled with samples of a square waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like square waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [in] | duty | A buffer full of duty cycles in domain [0, 1]. |
| [out] | output | A buffer to be filled with samples of a square waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like triangle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a triangle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like triangle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a triangle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an analog-like triangle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a triangle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a circle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a circle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a circle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a circle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a circle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a circle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a fast sine approximation waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of an approximated sine waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a fast sine approximation waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of an approximated sine waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a fast sine approximation waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of an approximated sine waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a sawtooth waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sawtooth waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a sawtooth waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sawtooth waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a sawtooth waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sawtooth waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an accurate sine approximation waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sine waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an accurate sine approximation waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sine waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with an accurate sine approximation waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a sine waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a square waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [in] | duty | A buffer full of duty cycles in domain [0, 1]. |
| [out] | output | A buffer to be filled with samples of a square waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a square waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [in] | duty | A buffer full of duty cycles in domain [0, 1]. |
| [out] | output | A buffer to be filled with samples of a square waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a square waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [in] | duty | A buffer full of duty cycles in domain [0, 1]. |
| [out] | output | A buffer to be filled with samples of a square waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a triangle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a triangle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a triangle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a triangle waveform, with range [-1, 1]. |
|
inlinestatic |
Fills a buffer with a triangle waveform.
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of input phases in domain [0, 1). |
| [out] | output | A buffer to be filled with samples of a triangle waveform, with range [-1, 1]. |
|
inlinestatic |
Maps a buffer of arbitrary phases into the domain [0, 1).
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of arbitrary input phases. |
| [out] | output | A buffer to be filled with equivalent phases to the contents of phase, but within the domain [0, 1). |
|
inlinestatic |
Maps a buffer of arbitrary phases into the domain [0, 1).
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of arbitrary input phases. |
| [out] | output | A buffer to be filled with equivalent phases to the contents of phase, but within the domain [0, 1). |
|
inlinestatic |
Maps a buffer of arbitrary phases into the domain [0, 1).
| [in] | len | The length of the input and output buffers, phase and output. Must be at least 1. |
| [in] | phase | A buffer full of arbitrary input phases. |
| [out] | output | A buffer to be filled with equivalent phases to the contents of phase, but within the domain [0, 1). |
|
inlinestaticnodiscard |
Fast sine approximation waveform.
This function generates a fast approximation of a sine waveform. It has a maximum absolute error of ±0.05601, which is quite large and produces audible harmonics, so it is intended for use in oscillators where these harmonics are desirable or LFOs where they aren't perceptible.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Fast sine approximation waveform.
This function generates a fast approximation of a sine waveform. It has a maximum absolute error of ±0.05601, which is quite large and produces audible harmonics, so it is intended for use in oscillators where these harmonics are desirable or LFOs where they aren't perceptible.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Fast sine approximation waveform.
This function generates a fast approximation of a sine waveform. It has a maximum absolute error of ±0.05601, which is quite large and produces audible harmonics, so it is intended for use in oscillators where these harmonics are desirable or LFOs where they aren't perceptible.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Basic sawtooth waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Basic sawtooth waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Basic sawtooth waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Accurate sine approximation waveform.
This function generates a sine approximation. It has a maximum absolute error of ±0.0010903. This error does produce harmonics, but they are very quiet.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Accurate sine approximation waveform.
This function generates a sine approximation. It has a maximum absolute error of ±0.0010903. This error does produce harmonics, but they are very quiet.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Accurate sine approximation waveform.
This function generates a sine approximation. It has a maximum absolute error of ±0.0010903. This error does produce harmonics, but they are very quiet.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Basic square waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
| duty | The duty cycle of the waveform, in domain [0, 1]. |
|
inlinestaticnodiscard |
Basic square waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
| duty | The duty cycle of the waveform, in domain [0, 1]. |
|
inlinestaticnodiscard |
Basic square waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
| duty | The duty cycle of the waveform, in domain [0, 1]. |
|
inlinestaticnodiscard |
Basic triangle waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Basic triangle waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Basic triangle waveform.
| phase | The input phase of the waveform, in domain [0, 1). |
|
inlinestaticnodiscard |
Maps an arbitrary phase into the domain [0, 1).
All of nectarine's waveform functions require an input phase within the domain [0, 1) and misbehave outside that domain. This function can be used to produce an equivalent input phase within that domain.
This is desirable when storing an oscillator's phase also, since long-running oscillators can accumulate floating point precision error as the phase increases further and further away from zero. Wrapping an oscillator's stored phase periodically can help prevent this.
| phase | An arbitrary input phase. |
phase, but within the domain [0, 1).
|
inlinestaticnodiscard |
Maps an arbitrary phase into the domain [0, 1).
All of nectarine's waveform functions require an input phase within the domain [0, 1) and misbehave outside that domain. This function can be used to produce an equivalent input phase within that domain.
This is desirable when storing an oscillator's phase also, since long-running oscillators can accumulate floating point precision error as the phase increases further and further away from zero. Wrapping an oscillator's stored phase periodically can help prevent this.
| phase | An arbitrary input phase. |
phase, but within the domain [0, 1).
|
inlinestaticnodiscard |
Maps an arbitrary phase into the domain [0, 1).
All of nectarine's waveform functions require an input phase within the domain [0, 1) and misbehave outside that domain. This function can be used to produce an equivalent input phase within that domain.
This is desirable when storing an oscillator's phase also, since long-running oscillators can accumulate floating point precision error as the phase increases further and further away from zero. Wrapping an oscillator's stored phase periodically can help prevent this.
| phase | An arbitrary input phase. |
phase, but within the domain [0, 1).
|
staticconstexpr |
Error correction term used to increase the accuracy of nec_sin.
Found this old forum thread for a fast sin() approximation. Turns out the code given in the thread is equivalent to nec_parabol once the domain is remapped to [0, 1). nec_sin uses the error correction shown in the thread to improve upon nec_parabol.