Skip to content

Commit

Permalink
Use ma.EPSILON instead of 1.0e-7.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Jun 29, 2020
1 parent cde57d7 commit e120e2c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions analyzers.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compressors.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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!
};

Expand Down
2 changes: 1 addition & 1 deletion filters.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions maths.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
2 changes: 1 addition & 1 deletion old/oscillator.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion oscillators.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e120e2c

Please sign in to comment.