Skip to content

Commit

Permalink
Merge branch 'master' into lf_sawpos_reset
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon authored Oct 13, 2020
2 parents 7eba4b2 + 2d5e402 commit f4dc8b3
Show file tree
Hide file tree
Showing 15 changed files with 635 additions and 126 deletions.
1 change: 1 addition & 0 deletions all.lib
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import("oscillators.lib");
import("noises.lib");
import("phaflangers.lib");
import("physmodels.lib");
import("quantizer.lib");
import("reducemaps.lib");
import("reverbs.lib");
import("routes.lib");
Expand Down
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
32 changes: 20 additions & 12 deletions basics.lib
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ declare version "0.1";
//
// * `n`: number of samples
//----------------------------
samp2sec = /(ma.SR);
samp2sec(n) = n/ma.SR;


//-------`(ba.)sec2samp`----------
Expand All @@ -89,7 +89,7 @@ samp2sec = /(ma.SR);
//
// * `d`: duration in seconds
//----------------------------
sec2samp = *(ma.SR);
sec2samp(d) = d*ma.SR;


//-------`(ba.)db2linear`----------
Expand Down Expand Up @@ -123,7 +123,7 @@ db2linear(l) = pow(10, l/20.0);
//
// * `g`: a linear gain
//-----------------------------
linear2db(g) = 20*log10(g);
linear2db(g) = 20.0*log10(g);


//----------`(ba.)lin2LogGain`------------------
Expand Down Expand Up @@ -1025,8 +1025,8 @@ listInterp(v) =


//-------------------`(ba.)bypass1`-------------------------
// Takes a mono input signal, route it to `e` and bypass it if `bpc = 1`. When bypassed, `e` is feed with zeros
// so that its state is cleanup up.
// Takes a mono input signal, route it to `e` and bypass it if `bpc = 1`.
// When bypassed, `e` is feed with zeros so that its state is cleanup up.
// `bypass1` is a standard Faust function.
//
// #### Usage
Expand All @@ -1049,8 +1049,8 @@ with {


//-------------------`(ba.)bypass2`-------------------------
// Takes a stereo input signal, route it to `e` and bypass it if `bpc = 1`. When bypassed, `e` is feed with zeros
// so that its state is cleanup up.
// Takes a stereo input signal, route it to `e` and bypass it if `bpc = 1`.
// When bypassed, `e` is feed with zeros so that its state is cleanup up.
// `bypass2` is a standard Faust function.
//
// #### Usage
Expand Down Expand Up @@ -1098,9 +1098,11 @@ with {


//-------------------`(ba.)bypass_fade`-------------------------
// Bypass an arbitrary (N x N) circuit with 'n' samples crossfade. Inputs and outputs signals are faded
// out when 'e' is bypassed, so that 'e' state is cleanup up.
// Once bypassed the effect is replaced by par(i,N,_). Bypassed circuits can be chained.
// Bypass an arbitrary (N x N) circuit with 'n' samples crossfade.
// Inputs and outputs signals are faded out when 'e' is bypassed,
// so that 'e' state is cleanup up.
// Once bypassed the effect is replaced by par(i,N,_).
// Bypassed circuits can be chained.
//
// #### Usage
//
Expand Down Expand Up @@ -1451,6 +1453,7 @@ with {
int2nrOfBits(maxN) = int(floor(log(maxN)/log(2))+1);
};


//------------------------------`(ba.)slidingSum`------------------------------
// The sliding sum of the last n input samples.
//
Expand All @@ -1469,6 +1472,7 @@ with {
//------------------------------------------------------------------------------
slidingSum(n) = fi.integrator <: _, _@int(max(0,n)) :> -;


//------------------------------`(ba.)slidingSump`------------------------------
// The sliding sum of the last n input samples.
//
Expand Down Expand Up @@ -1504,6 +1508,7 @@ slidingSump(n,maxn) = slidingReduce(+,n,maxn,0);
//------------------------------------------------------------------------------
slidingMax(n,maxn) = slidingReduce(max,n,maxn,-(ma.INFINITY));


//----------------------------`(ba.)slidingMin`--------------------------------
// The sliding minimum of the last n input samples.
//
Expand Down Expand Up @@ -1538,6 +1543,7 @@ slidingMin(n,maxn) = slidingReduce(min,n,maxn,ma.INFINITY);
//------------------------------------------------------------------------------
slidingMean(n) = slidingSum(n)/n;


//----------------------------`(ba.)slidingMeanp`-------------------------------
// The sliding mean of the last n input samples.
//
Expand Down Expand Up @@ -1574,7 +1580,8 @@ slidingMeanp(n,maxn) = slidingSump(n,maxn)/n;
//
// * `N`: the number of values to process
//------------------------------------------------------------------------------
slidingRMS(n) = pow(2):slidingMean(n) : sqrt;
slidingRMS(n) = pow(2) : slidingMean(n) : sqrt;


//---------------------------`(ba.)slidingRMSp`---------------------------------
// The root mean square of the last n input samples.
Expand All @@ -1592,7 +1599,8 @@ slidingRMS(n) = pow(2):slidingMean(n) : sqrt;
// * `N`: the number of values to process
// * `maxN`: the maximum number of values to process, needs to be a power of 2
//------------------------------------------------------------------------------
slidingRMSp(n,maxn) = pow(2):slidingMeanp(n,maxn) : sqrt;
slidingRMSp(n,maxn) = pow(2) : slidingMeanp(n,maxn) : sqrt;


//////////////////////////////////Deprecated Functions////////////////////////////////////
// This section implements functions that used to be in music.lib but that are now
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
26 changes: 13 additions & 13 deletions delays.lib
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,16 @@ with {
// considered as "deprecated".
//////////////////////////////////////////////////////////////////////////////////////////

delay1s(d) = delay(65536,d);
delay2s(d) = delay(131072,d);
delay5s(d) = delay(262144,d);
delay10s(d) = delay(524288,d);
delay21s(d) = delay(1048576,d);
delay43s(d) = delay(2097152,d);

fdelay1s(d) = fdelay(65536,d);
fdelay2s(d) = fdelay(131072,d);
fdelay5s(d) = fdelay(262144,d);
fdelay10s(d) = fdelay(524288,d);
fdelay21s(d) = fdelay(1048576,d);
fdelay43s(d) = fdelay(2097152,d);
delay1s(d) = delay(65536,d);
delay2s(d) = delay(131072,d);
delay5s(d) = delay(262144,d);
delay10s(d) = delay(524288,d);
delay21s(d) = delay(1048576,d);
delay43s(d) = delay(2097152,d);

fdelay1s(d) = fdelay(65536,d);
fdelay2s(d) = fdelay(131072,d);
fdelay5s(d) = fdelay(262144,d);
fdelay10s(d) = fdelay(524288,d);
fdelay21s(d) = fdelay(1048576,d);
fdelay43s(d) = fdelay(2097152,d);
7 changes: 4 additions & 3 deletions envelopes.lib
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,15 @@ adsre(attT60,decT60,susLvl,relT60,gate) = envelope with {
ugate = gate>0;
samps = ugate : +~(*(ugate)); // ramp time in samples
attSamps = int(attT60 * ma.SR);
// if attSamps==0, go straight into the decay phase
attPhase = (samps<attSamps) | (ugate:ba.impulsify);
target = select2(ugate, 0.0,
select2(samps<attSamps, (susLvl)*float(ugate), ugate));
t60 = select2(ugate, relT60, select2(samps<attSamps, decT60, attT60));
select2(attPhase, (susLvl)*float(ugate), ugate));
t60 = select2(ugate, relT60, select2(attPhase, decT60, attT60));
pole = ba.tau2pole(t60/6.91);
envelope = target : si.smooth(pole);
};


//------------------------`(en.)asre`----------------------
// ASRE (Attack, Sustain, Release) envelope generator with Exponential segments.
//
Expand Down
Loading

0 comments on commit f4dc8b3

Please sign in to comment.