Skip to content

Commit a4e60ec

Browse files
committed
LFO: document some things that trip up users
Closes: #9073 Closes: #9063
1 parent 87a400a commit a4e60ec

File tree

1 file changed

+24
-1
lines changed
  • shared-bindings/synthio

1 file changed

+24
-1
lines changed

shared-bindings/synthio/LFO.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,30 @@ STATIC const uint16_t triangle[] = {0, 32767, 0, -32767};
5757
//|
5858
//| In the current implementation, LFOs are updated every 256 samples. This
5959
//| should be considered an implementation detail, though it affects how LFOs
60-
//| behave for instance when used to implement an integrator (``l.offset = l``).
60+
//| behave for instance when used to implement an integrator (``l.offset = l``).A
61+
//|
62+
//| An LFO's output is not updated in any other way than when its associated
63+
//| synthesizer updates it. For instance, if an LFO is created and its "first"
64+
//| output is non-zero, its output is 0 until it is updated by its associated synthesizer.
65+
//| Similarly, it is not updated when its inputs like ``scale`` and ``offset`` are changed.
66+
//|
67+
//| The interpolation of the waveform is necessarily different depending on the ``once``
68+
//| property. Consider a LFO with
69+
//| ``waveform=np.array([0, 32767], dtype=np.int16), interpolate=True, once=True, rate=1``.
70+
//| Over 1 second this LFO's output will change
71+
//| from ``0`` to ``32767``, and will remain at ``32767`` thereafter, creating
72+
//| a "bend out" over a duration of 1 second.
73+
//|
74+
//| However, when ``once=False``, this creates a sawtooth waveform with a period of 1 second.
75+
//| Over about the first half second the input will increase from ``0`` to ``32767``,
76+
//| then during the second half of the second it will decrease back to ``0``.
77+
//|
78+
//| The time of the peak output is different depending on the value of ``once``:
79+
//| At 1.0s for ``once=True`` and at 0.5s for ``once=False``.
80+
//|
81+
//| Because of this difference in interpolation, dynamically updating the
82+
//| ``once`` flag except when the LFO is at a phase of 0 will cause a step in
83+
//| the LFO's output.
6184
//| """
6285
//|
6386
//| def __init__(

0 commit comments

Comments
 (0)