diff --git a/analyzers.lib b/analyzers.lib index d013f8ce..2233d7bd 100644 --- a/analyzers.lib +++ b/analyzers.lib @@ -512,7 +512,7 @@ mth_octave_spectral_level6e(M,ftop,N,tau,dB_offset) = _<: _,mth_octave_analyzer6e(M,ftop,N) : _,(display:>_):attach with { display = par(i,N,dbmeter(i)); - dbmeter(i) = abs : si.smooth(ba.tau2pole(tau)) : max(1.0e-7) : ba.linear2db : +(dB_offset) : + dbmeter(i) = abs : si.smooth(ba.tau2pole(tau)) : max(ma.EPSILON) : ba.linear2db : +(dB_offset) : meter(N-i-1); meter(i) = speclevel_group(vbargraph("[%2i] [unit:dB] [tooltip: Spectral Band Level in dB]", -50, 10)); @@ -696,7 +696,7 @@ goertzel = goertzelOpt; // Undocumented utility functions used by fft and ifft: c_magsq(N) = si.cbus(N) : par(i,N,(par(j,2,abs<:_*_):>_)) :> si.bus(N); -c_magdb(N) = si.cbus(N) : an.c_magsq(N) : par(i,N,(max(1.0e-7):log10:*(10.0))); +c_magdb(N) = si.cbus(N) : an.c_magsq(N) : par(i,N,(max(ma.EPSILON):log10:*(10.0))); c_select_pos_freqs(2) = (_,_), (_,_); // both dc and SR/2 included with "positive frequencies" c_select_pos_freqs(N) = si.cbus(N) : par(i,N/2+1,(_,_)),par(i,N/2-1,(!,!)) : si.cbus(N/2+1); // for complex spectra select_pos_freqs(2) = _,_; // both dc and SR/2 included diff --git a/compressors.lib b/compressors.lib index de022715..c4b0ccd6 100644 --- a/compressors.lib +++ b/compressors.lib @@ -712,7 +712,7 @@ with { // A general 'knee' parameter could be used instead of tying it to att/2: kneesmooth(att) = si.smooth(ba.tau2pole(att/2.0)); // compression gain in dB: - outminusindb(ratio,thresh,level) = max(level-thresh,0.0) * (1.0/max(1.0e-7,float(ratio))-1.0); + outminusindb(ratio,thresh,level) = max(level-thresh,0.0) * (1.0/max(ma.EPSILON,float(ratio))-1.0); // Note: "float(ratio)" REQUIRED when ratio is an integer > 1! }; diff --git a/filters.lib b/filters.lib index 5b276e3f..e5d61e6d 100644 --- a/filters.lib +++ b/filters.lib @@ -2310,7 +2310,7 @@ spectral_tilt(N,f0,bw,alpha) = seq(i,N,sec(i)) with { prewarp(w,SR,wp) = wp * tan(w*T/2) / tan(wp*T/2) with { T = 1/ma.SR; }; mz(i) = w0 * r ^ (-alpha+i); // minus zero i in s plane mp(i) = w0 * r ^ i; // minus pole i in s plane - f0p = max(f0,1.0e-7); // cannot go to zero + f0p = max(f0,ma.EPSILON); // cannot go to zero w0 = 2 * ma.PI * f0p; // radian frequency of first pole f1 = f0p + bw; // upper band limit r = (f1/f0p)^(1.0/float(N-1)); // pole ratio (2 => octave spacing) diff --git a/maths.lib b/maths.lib index 760ba903..bb0b66f4 100644 --- a/maths.lib +++ b/maths.lib @@ -75,6 +75,7 @@ ma = library("maths.lib"); // for compatible copy/paste out of this file //----------------------------------------------------------------------------- SR = pl.SR; + //---------------------------------`(ma.)BS`--------------------------------------- // Current block-size. Can change during the execution. // diff --git a/old/oscillator.lib b/old/oscillator.lib index 8553be0f..10b110b2 100644 --- a/old/oscillator.lib +++ b/old/oscillator.lib @@ -133,7 +133,7 @@ saw3 = sawN(3); saw4 = sawN(4); saw5 = sawN(5); saw6 = sawN(6); saw2(freq) = y with { // newer PTR version (stateless - freq can vary at any speed) - p0 = float(ml.SR)/float(max(1.0e-7,abs(freq))); // period in samples + p0 = float(ml.SR)/float(max(ma.EPSILON,abs(freq))); // period in samples t0 = 1.0/p0; // phase increment p = ((_<:(-(1)<:_,_),_) <: selector1,selector2) ~(+(t0)):!,_; selector1 = select2(<(0)); // for feedback diff --git a/oscillators.lib b/oscillators.lib index 7060f175..aab8ec8d 100644 --- a/oscillators.lib +++ b/oscillators.lib @@ -585,7 +585,7 @@ saw3 = sawN(3); saw4 = sawN(4); saw5 = sawN(5); saw6 = sawN(6); // * `freq`: frequency //-------------------------------------------------------- saw2(freq) = y with { // newer PTR version (stateless - freq can vary at any speed) - p0 = float(ma.SR)/float(max(1.0e-7,abs(freq))); // period in samples + p0 = float(ma.SR)/float(max(ma.EPSILON,abs(freq))); // period in samples t0 = 1.0/p0; // phase increment p = ((_<:(-(1)<:_,_),_) <: selector1,selector2) ~(+(t0)):!,_; selector1 = select2(<(0)); // for feedback