Skip to content

Commit

Permalink
Correct documentation in interpolators.lib + typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Jun 1, 2021
1 parent 15b2d76 commit 6446b5f
Show file tree
Hide file tree
Showing 17 changed files with 203 additions and 94 deletions.
4 changes: 2 additions & 2 deletions basics.lib
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ with {
// #### Usage
//
// ```
// _ : peakhold(mode) : _;
// _ : peakhold(mode) : _
// ```
//
// Where:
Expand All @@ -984,7 +984,7 @@ peakhold = (*,_:max) ~ _;
// #### Usage
//
// ```
// _ : peakholder(n) : _;
// _ : peakholder(n) : _
// ```
//
// Where:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -387,5 +387,5 @@ <h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>

<!--
MkDocs version : 1.1.2
Build Date UTC : 2021-06-01 11:07:10.339431+00:00
Build Date UTC : 2021-06-01 16:10:57.284355+00:00
-->
4 changes: 2 additions & 2 deletions docs/libs/basics/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ <h4 id="usage_41">Usage</h4>
<h3 id="bapeakhold"><code>(ba.)peakhold</code></h3>
<p>Outputs current max value above zero.</p>
<h4 id="usage_42">Usage</h4>
<pre><code>_ : peakhold(mode) : _;
<pre><code>_ : peakhold(mode) : _
</code></pre>
<p>Where:</p>
<p><code>mode</code> means:
Expand All @@ -1047,7 +1047,7 @@ <h4 id="usage_42">Usage</h4>
<h3 id="bapeakholder"><code>(ba.)peakholder</code></h3>
<p>Tracks abs peak and holds peak for 'n' samples.</p>
<h4 id="usage_43">Usage</h4>
<pre><code>_ : peakholder(n) : _;
<pre><code>_ : peakholder(n) : _
</code></pre>
<p>Where:</p>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions docs/libs/filters/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,8 @@ <h4 id="example">Example</h4>
<h3 id="ficonv-and-ficonvn"><code>(fi.)conv</code> and <code>(fi.)convN</code></h3>
<p>Convolution of input signal with given coefficients.</p>
<h4 id="usage_14">Usage</h4>
<pre><code>_ : conv((k1,k2,k3,...,kN)) : _; // Argument = one signal bank
_ : convN(N,(k1,k2,k3,...)) : _; // Useful when N &lt; count((k1,...))
<pre><code>_ : conv((k1,k2,k3,...,kN)) : _ // Argument = one signal bank
_ : convN(N,(k1,k2,k3,...)) : _ // Useful when N &lt; count((k1,...))
</code></pre>
<hr />
<h3 id="fitf1-fitf2-and-fitf3"><code>(fi.)tf1</code>, <code>(fi.)tf2</code> and <code>(fi.)tf3</code></h3>
Expand Down
6 changes: 5 additions & 1 deletion docs/libs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,11 @@ <h2 id="interpolators">interpolators</h2>
<a href="interpolators/#itinterpolator_cosine">(it.)interpolator_cosine</a> &nbsp; &nbsp;
<a href="interpolators/#itinterpolator_two_points">(it.)interpolator_two_points</a> &nbsp; &nbsp;
<a href="interpolators/#itinterpolator_cubic">(it.)interpolator_cubic</a> &nbsp; &nbsp;
<a href="interpolators/#itinterpolator_select">(it.)interpolator_select</a> &nbsp; &nbsp;</p>
<a href="interpolators/#itinterpolator_select">(it.)interpolator_select</a> &nbsp; &nbsp;
<a href="interpolators/#itlagrange_hn-">(it.)lagrange_h(N) </a> &nbsp; &nbsp;
<a href="interpolators/#itlagrangenn-">(it.)lagrangeN(N) </a> &nbsp; &nbsp;
<a href="interpolators/#itfrdtablen,-s-">(it.)frdtable(N, S) </a> &nbsp; &nbsp;
<a href="interpolators/#itfrwtablen,-s-">(it.)frwtable(N, S) </a> &nbsp; &nbsp;</p>
<h2 id="maths">maths</h2>
<p><a href="maths/#masr">(ma.)SR</a> &nbsp; &nbsp;
<a href="maths/#mabs">(ma.)BS</a> &nbsp; &nbsp;
Expand Down
110 changes: 105 additions & 5 deletions docs/libs/interpolators/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,26 @@
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#lagrange-based-interpolators" class="nav-link">Lagrange based interpolators</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#itlagrange_hn" class="nav-link">(it.)lagrange_h(N)</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#itlagrangenn" class="nav-link">(it.)lagrangeN(N)</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#itfrdtablen-s" class="nav-link">(it.)frdtable(N, S)</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#itfrwtablen-s" class="nav-link">(it.)frwtable(N, S)</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
</ul>
</li>
Expand Down Expand Up @@ -430,7 +450,7 @@ <h2 id="two-points-interpolators">Two points interpolators</h2>
<h3 id="itinterpolator_two_points"><code>(it.)interpolator_two_points</code></h3>
<p>Generic interpolator on two points (current and next index), assuming an increasing index.</p>
<h4 id="usage_3">Usage</h4>
<pre><code>interpolator_two_points(gen, idv, interpolate_two_points) : _,_... (equal to N = outputs(gen))
<pre><code>interpolator_two_points(gen, idv, interpolate_two_points) : si.bus(outputs(gen))
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -442,7 +462,7 @@ <h4 id="usage_3">Usage</h4>
<h3 id="itinterpolator_linear"><code>(it.)interpolator_linear</code></h3>
<p>Linear interpolator for a 'gen' circuit triggered by an 'idv' input to generate values.</p>
<h4 id="usage_4">Usage</h4>
<pre><code>interpolator_linear(gen, idv) : _,_... (equal to N = outputs(gen))
<pre><code>interpolator_linear(gen, idv) : si.bus(outputs(gen))
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -453,7 +473,7 @@ <h4 id="usage_4">Usage</h4>
<h3 id="itinterpolator_cosine"><code>(it.)interpolator_cosine</code></h3>
<p>Cosine interpolator for a 'gen' circuit triggered by an 'idv' input to generate values.</p>
<h4 id="usage_5">Usage</h4>
<pre><code>interpolator_cosine(gen, idv) : _,_... (equal to N = outputs(gen))
<pre><code>interpolator_cosine(gen, idv) : si.bus(outputs(gen))
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -465,7 +485,7 @@ <h2 id="four-points-interpolators">Four points interpolators</h2>
<h3 id="itinterpolator_two_points_1"><code>(it.)interpolator_two_points</code></h3>
<p>Generic interpolator on interpolator_four_points points (previous, current and two next indexes), assuming an increasing index.</p>
<h4 id="usage_6">Usage</h4>
<pre><code>interpolator_four_points(gen, idv, interpolate_four_points) : _,_... (equal to N = outputs(gen))
<pre><code>interpolator_four_points(gen, idv, interpolate_four_points) : si.bus(outputs(gen))
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -477,7 +497,7 @@ <h4 id="usage_6">Usage</h4>
<h3 id="itinterpolator_cubic"><code>(it.)interpolator_cubic</code></h3>
<p>Cubic interpolator for a 'gen' circuit triggered by an 'idv' input to generate values</p>
<h4 id="usage_7">Usage</h4>
<pre><code>interpolator_cubic(gen, idv) : _,_... (equal to N = outputs(gen))
<pre><code>interpolator_cubic(gen, idv) : si.bus(outputs(gen))
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -495,6 +515,86 @@ <h4 id="usage_8">Usage</h4>
<li><code>gen</code>: a circuit with an 'idv' reader input that produces N outputs</li>
<li><code>idv</code>: a fractional read index expressed as a float value, or a (int,frac) pair</li>
<li><code>sel</code>: an interpolation algorithm selector in [0..3] (0 = linear, 1 = cosine, 2 = cubic, 3 = nointerp)</li>
</ul>
<h2 id="lagrange-based-interpolators">Lagrange based interpolators</h2>
<hr />
<h3 id="itlagrange_hn"><code>(it.)lagrange_h(N)</code></h3>
<p>Function to generate N + 1 coefficients for an Nth-order Lagrange
interpolation filter for an index between 0 and N.</p>
<h4 id="usage_9">Usage</h4>
<pre><code>lagrange_h(N, idx) : si.bus(N)
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: order of the interpolation filter, known at compile-time</li>
<li><code>idx</code>: a fractional index between 0 and N</li>
</ul>
<h4 id="reference_3">Reference</h4>
<ul>
<li><a href="https://ccrma.stanford.edu/~jos/pasp/Lagrange_Interpolation.html">https://ccrma.stanford.edu/~jos/pasp/Lagrange_Interpolation.html</a></li>
</ul>
<hr />
<h3 id="itlagrangenn"><code>(it.)lagrangeN(N)</code></h3>
<p>Nth-order Lagrange interpolator to interpolate between a set of N + 1 points.</p>
<h4 id="usage_10">Usage</h4>
<pre><code>lagrangeN(N, idx, si.bus(N + 1)) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: order of the interpolator, known at compile-time</li>
<li><code>idx</code>: a fractional index between 0 and N to interpolate between a set
of N + 1 points being crossed at positions 0, 1, 2, ..., N</li>
</ul>
<p>Example: find the centre position of a set of four points using an order-3
Lagrange function fitting the four points [2, 5, -1, 3]:</p>
<pre><code>N = 3;
process = it.lagrangeN(N, N / 2, 2, 5, -1, 3);
</code></pre>
<p>which outputs ~1.938.</p>
<h4 id="reference_4">Reference</h4>
<ul>
<li><a href="https://ccrma.stanford.edu/~jos/pasp/Lagrange_Interpolation.html">https://ccrma.stanford.edu/~jos/pasp/Lagrange_Interpolation.html</a></li>
</ul>
<hr />
<h3 id="itfrdtablen-s"><code>(it.)frdtable(N, S)</code></h3>
<p>Look-up circular table with Nth-order Lagrange interpolation for fractional
indexes. The index is wrapped-around and the table is cycles for an index
span of size S, which is the table size in samples.</p>
<h4 id="usage_11">Usage</h4>
<pre><code>frdtable(N, S, init, idx) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: Lagrange interpolation order, known at compile-time</li>
<li><code>S</code>: table size in samples, known at compile-time</li>
<li><code>init</code>: signal for table initialisation</li>
<li><code>idx</code>: fractional index wrapped-around 0 and S</li>
</ul>
<p>Example: test the effectiveness of the 5th-order interpolation scheme by
creating a table look-up oscillator using only 16 points of a sinewave;
compare the result with a non-interpolated version:</p>
<pre><code>N = 5;
S = 16;
index = os.phasor(S, 1000);
process = rdtable(S, os.sinwaveform(S), int(index)) ,
it.frdtable(N, S, os.sinwaveform(S), index);
</code></pre>
<hr />
<h3 id="itfrwtablen-s"><code>(it.)frwtable(N, S)</code></h3>
<p>Look-up updatable circular table with Nth-order Lagrange interpolation for
fractional indexes. The index is wrapped-around and the table is circular
indexes ranging from 0 to S, which is the table size in samples.</p>
<h4 id="usage_12">Usage</h4>
<pre><code>frwtable(N, S, init, w_idx, x, r_idx) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: Lagrange interpolation order, known at compile-time</li>
<li><code>S</code>: table size in samples, known at compile-time</li>
<li><code>init</code>: constant for table initialisation, known at compile-time</li>
<li><code>w_idx</code>: it should be an INT between 0 and S - 1</li>
<li><code>x</code>: input signal written on the w_idx positions</li>
<li><code>r_idx</code>: fractional index wrapped-around 0 and S</li>
</ul></div>
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions docs/libs/noises/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h3 id="nopink_noise"><code>(no.)pink_noise</code></h3>
<p>Pink noise (1/f noise) generator (third-order approximation)
<code>pink_noise</code> is a standard Faust function.</p>
<h4 id="usage_3">Usage</h4>
<pre><code>pink_noise : _;
<pre><code>pink_noise : _
</code></pre>
<h4 id="reference">Reference:</h4>
<ul>
Expand All @@ -322,7 +322,7 @@ <h4 id="reference">Reference:</h4>
<h3 id="nopink_noise_vm"><code>(no.)pink_noise_vm</code></h3>
<p>Multi pink noise generator.</p>
<h4 id="usage_4">Usage</h4>
<pre><code>pink_noise_vm(N) : _;
<pre><code>pink_noise_vm(N) : _
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -338,9 +338,9 @@ <h4 id="references">References</h4>
<h3 id="nolfnoise-nolfnoise0-and-nolfnoisen"><code>(no.)lfnoise</code>, <code>(no.)lfnoise0</code> and <code>(no.)lfnoiseN</code></h3>
<p>Low-frequency noise generators (Butterworth-filtered downsampled white noise).</p>
<h4 id="usage_5">Usage</h4>
<pre><code>lfnoise0(rate) : _; // new random number every int(SR/rate) samples or so
lfnoiseN(N,rate) : _; // same as &quot;lfnoise0(rate) : lowpass(N,rate)&quot; [see filters.lib]
lfnoise(rate) : _; // same as &quot;lfnoise0(rate) : seq(i,5,lowpass(N,rate))&quot; (no overshoot)
<pre><code>lfnoise0(rate) : _ // new random number every int(SR/rate) samples or so
lfnoiseN(N,rate) : _ // same as &quot;lfnoise0(rate) : lowpass(N,rate)&quot; [see filters.lib]
lfnoise(rate) : _ // same as &quot;lfnoise0(rate) : seq(i,5,lowpass(N,rate))&quot; (no overshoot)
</code></pre>
<h4 id="example">Example</h4>
<p>(view waveforms in faust2octave):</p>
Expand All @@ -353,7 +353,7 @@ <h4 id="example">Example</h4>
<h3 id="nosparse_noise_vm"><code>(no.)sparse_noise_vm</code></h3>
<p>sparse noise generator.</p>
<h4 id="usage_6">Usage</h4>
<pre><code>sparse_noise(f0) : _;
<pre><code>sparse_noise(f0) : _
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -369,7 +369,7 @@ <h4 id="reference_1">Reference</h4>
<h3 id="novelvet_noise_vm"><code>(no.)velvet_noise_vm</code></h3>
<p>velvet noise generator.</p>
<h4 id="usage_7">Usage</h4>
<pre><code>velvet_noise(amp,f0) : _;
<pre><code>velvet_noise(amp,f0) : _
</code></pre>
<p>Where:</p>
<ul>
Expand All @@ -387,7 +387,7 @@ <h4 id="reference_2">Reference</h4>
<h3 id="nognoise"><code>(no.)gnoise</code></h3>
<p>approximate zero-mean, unit-variance Gaussian white noise generator.</p>
<h4 id="usage_8">Usage</h4>
<pre><code>gnoise(N) : _;
<pre><code>gnoise(N) : _
</code></pre>
<p>Where:</p>
<ul>
Expand Down
12 changes: 6 additions & 6 deletions docs/libs/reducemaps/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ <h1 id="reducemapslib">reducemaps.lib</h1>
<p>A library to handle reduce/map kind of operation in Faust. Its official prefix is <code>rm</code>.</p>
<hr />
<h3 id="rmreduce"><code>(rm.)reduce</code></h3>
<p>Fold-like high order function. Apply a binary operation <op>
on a block of <n> consecutive samples of a signal <x>.
For example : reduce(max,128) will compute the maximun of each
<p>Fold-like high order function. Apply a binary operation <code>op</code>
on a block of consecutive samples of a signal <code>x</code>.
For example: <code>reduce(max,128)</code> will compute the maximun of each
block of 128 samples. Please note that the resulting
value, while produced continuously, will be constant for
the duration of a block. A new value is only produced
Expand All @@ -255,9 +255,9 @@ <h4 id="usage">Usage</h4>
</code></pre>
<hr />
<h3 id="rmreducemap"><code>(rm.)reducemap</code></h3>
<p>Like reduce but a foo function is applied to the result. From
a mathematical point of view :
reducemap(op,foo,n) is equivalent to reduce(op,n):foo
<p>Like <code>reduce</code> but a <code>foo</code> function is applied to the result. From
a mathematical point of view:
<code>reducemap(op,foo,n)</code> is equivalent to <code>reduce(op,n):foo</code>
but more efficient.</p>
<h4 id="usage_1">Usage</h4>
<pre><code>reducemap(op, foo, n, x)
Expand Down
4 changes: 1 addition & 3 deletions docs/libs/reverbs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ <h4 id="usage_10">Usage</h4>
<li><code>lowcut</code>: frequency (100..6000 Hz) at which the crossover between the low and mid bands of the reverb occurs</li>
<li><code>highcut</code>: frequency (1000..10000 Hz) at which the crossover between the mid and high bands of the reverb occurs</li>
</ul>
<h4 id="reference_4">Reference</h4>
<hr />
<h3 id="regreyhole"><code>(re.)greyhole</code></h3>
<p>A complex echo-like effect (stereo in/out), inspired by the classic Eventide effect of a similar name.
Expand All @@ -518,8 +517,7 @@ <h4 id="usage_11">Usage</h4>
<li><code>feedback</code>: amount of feedback through the system. Sets the number of repeating echoes. A setting of <code>1.0</code> produces infinite sustain. Values should be in the range (<code>[0..1]</code>)</li>
<li><code>mod_depth</code>: depth (<code>[0..1]</code>) of delay-line modulation. Use in combination with mod_freq to produce chorus and pitch-variations in the echoes</li>
<li><code>mod_freq</code>: frequency (<code>[0..10]</code> Hz) of delay-line modulation. Use in combination with mod_depth to produce chorus and pitch-variations in the echoes</li>
</ul>
<h4 id="reference_5">Reference</h4></div>
</ul></div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/search/search_index.json

Large diffs are not rendered by default.

Binary file modified docs/sitemap.xml.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions filters.lib
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ fir(b0) = *(b0);
// #### Usage
//
// ```
// _ : conv((k1,k2,k3,...,kN)) : _; // Argument = one signal bank
// _ : convN(N,(k1,k2,k3,...)) : _; // Useful when N < count((k1,...))
// _ : conv((k1,k2,k3,...,kN)) : _ // Argument = one signal bank
// _ : convN(N,(k1,k2,k3,...)) : _ // Useful when N < count((k1,...))
// ```
//------------------------------------------------------------
//convN(N,kv,x) = sum(i,N,take(i+1,kv) * x@i); // take() defined in math.lib
Expand Down
Loading

0 comments on commit 6446b5f

Please sign in to comment.