From 27ad2f623f3af6a70a9ab1244a7c3384db6fe8ad Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Sat, 5 Dec 2020 10:36:16 +0100 Subject: [PATCH] More efficient si.interpolate implementation, cleanup. --- basics.lib | 20 ++++++++++---------- signals.lib | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/basics.lib b/basics.lib index fa2dc16c..af5f74ec 100644 --- a/basics.lib +++ b/basics.lib @@ -106,7 +106,7 @@ sec2samp(d) = d*ma.SR; // // * `l`: loudness in dB //----------------------------- -db2linear(l) = pow(10, l/20.0); +db2linear(l) = pow(10.0, l/20.0); //-------`(ba.)linear2db`---------- @@ -554,7 +554,7 @@ pulse_countdown(trig) = - ~ _ * trig; // // Where: // -// * `n`: the highest number of the countup (included) before reset to 0. +// * `n`: the highest number of the countup (included) before reset to 0 // * `trig`: the trigger signal (1: start at next pulse; 0: reset to 0) //------------------------------------------------------------------------------ //TODO: author "Vince" @@ -596,7 +596,7 @@ resetCtr(n,m) = _ <: (_,pulse_countup_loop(n-1,1)) : (_,(_==m)) : *; // // Where: // -// * `n`: the highest number of the countup (included) before reset to 0. +// * `n`: the highest number of the countup (included) before reset to 0 // * `trig`: the trigger signal (1: start at next pulse; 0: reset to 0) //------------------------------------------------------------------------------ //TODO: author "Vince: @@ -976,7 +976,7 @@ with { // ``` // // In any case the `x_{i}` must be in increasing order (for all `i`, `x_{i} < x_{i+1}`). -// For example the following definition : +// For example the following definition: // // ``` // f = bpf.start(x0,y0) : ... : bpf.point(xi,yi) : ... : bpf.end(xn,yn); @@ -1629,7 +1629,7 @@ slidingRMSp(n,maxn) = pow(2) : slidingMeanp(n,maxn) : sqrt; // where: // // * `n`: the number of parallel inputs -// * `op`: the operator. needs to be a commutative one. +// * `op`: the operator which needs to be a commutative // //------------------------------------------------------------------------------ @@ -1638,7 +1638,7 @@ parallelOp(op,2) = op; parallelOp(op,n) = op(parallelOp(op,n-1)); //---------------------------`(ba.)parallelMax`--------------------------------- -// The maximum of n parallel inputs +// The maximum of n parallel inputs. // // #### Usage // @@ -1653,7 +1653,7 @@ parallelOp(op,n) = op(parallelOp(op,n-1)); parallelMax(n) = parallelOp(max,n); //---------------------------`(ba.)parallelMin`--------------------------------- -// The minimum of n parallel inputs +// The minimum of n parallel inputs. // // #### Usage // @@ -1668,7 +1668,7 @@ parallelMax(n) = parallelOp(max,n); parallelMin(n) = parallelOp(min,n); //---------------------------`(ba.)parallelMean`--------------------------------- -// The mean of n parallel inputs +// The mean of n parallel inputs. // // #### Usage // @@ -1683,7 +1683,7 @@ parallelMin(n) = parallelOp(min,n); parallelMean(n) = si.bus(n):>_/n; //---------------------------`(ba.)parallelRMS`--------------------------------- -// The RMS of n parallel inputs +// The RMS of n parallel inputs. // // #### Usage // @@ -1695,7 +1695,7 @@ parallelMean(n) = si.bus(n):>_/n; // // * `n`: the number of parallel inputs //------------------------------------------------------------------------------ -parallelRMS(n) = par(i, n, pow(2)):parallelMean(n) : sqrt; +parallelRMS(n) = par(i, n, pow(2)) : parallelMean(n) : sqrt; //////////////////////////////////Deprecated Functions//////////////////////////////////// diff --git a/signals.lib b/signals.lib index b2a666de..60d69e16 100644 --- a/signals.lib +++ b/signals.lib @@ -97,7 +97,7 @@ block(n) = par(i, n, !); // // * `i`: interpolation control between 0 and 1 (0: first input; 1: second input) //----------------------------------------------------------------------------- -interpolate(i) = *(1.0-i),*(i) : +; +interpolate(i,x,y) = x + i*(y-x); //------------------------`(si.)smoo`--------------------------------------- // Smoothing function based on `smooth` ideal to smooth UI signals