On Fri, Oct 21, 2016 at 11:14:33AM +0200, Stéphane Letz wrote:
In some of the scripts, the program 'error' is used. IDK which package provides that, but I don't have it. A simple "echo" would be preferable imho.Patch?
I attached a patch for faust2. faust1 seems unaffected. I also found a small bug in the libs of both v1 and 2: maxmsp.lib uses if without importing it. Patch also attached. Cheers, Bart.
diff --git a/tools/faust2appls/faust2gen b/tools/faust2appls/faust2gen index f0da9fe..1d81c8c 100755 --- a/tools/faust2appls/faust2gen +++ b/tools/faust2appls/faust2gen @@ -24,7 +24,7 @@ then FAUSTLIB=/usr/share/faust JSFILE_PATH="ui.js" else - error "$0: Cannot find Faust library dir (usually /usr/local/share/faust)" + echo "$0: Cannot find Faust library dir (usually /usr/local/share/faust)" fi #PHASE 2 : dispatch command arguments diff --git a/tools/faust2appls/faust2javaswing b/tools/faust2appls/faust2javaswing index 6f67037..dfc15a9 100755 --- a/tools/faust2appls/faust2javaswing +++ b/tools/faust2appls/faust2javaswing @@ -13,7 +13,7 @@ elif [ -f /usr/share/faust/music.lib ] then FAUSTLIB=/usr/share/faust/ else - error "$0: Cannot find Faust library dir (usually /usr/local/share/faust)" + echo "$0: Cannot find Faust library dir (usually /usr/local/share/faust)" fi diff --git a/tools/faust2appls/faust2webaudio b/tools/faust2appls/faust2webaudio index cbe347d..d05ee4e 100755 --- a/tools/faust2appls/faust2webaudio +++ b/tools/faust2appls/faust2webaudio @@ -13,7 +13,7 @@ elif [ -f /usr/share/faust/music.lib ] then FAUSTLIB=/usr/share/faust/ else - error "$0: Cannot find Faust library dir (usually /usr/local/share/faust)" + echo "$0: Cannot find Faust library dir (usually /usr/local/share/faust)" fi
diff --git a/libraries/maxmsp.lib b/libraries/maxmsp.lib index 072be4b..6807747 100644 --- a/libraries/maxmsp.lib +++ b/libraries/maxmsp.lib @@ -4,8 +4,8 @@ Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale --------------------------------------------------------------------- This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. + 02111-1307 USA. ************************************************************************ ************************************************************************/ @@ -24,30 +24,31 @@ declare name "MaxMSP compatibility Library"; declare author "GRAME"; declare copyright "GRAME"; declare version "1.1"; -declare license "LGPL"; +declare license "LGPL"; +ba = library("basic.lib"); ma = library("math.lib"); atodb = db2lin; //------------------------------------------------------------------------- -// -// Implementation of MaxMSP filtercoeff -// +// +// Implementation of MaxMSP filtercoeff +// // from : Cookbook formulae for audio EQ biquad filter coefficients // by : Robert Bristow-Johnson <r...@audioimagination.com> // URL : http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt -// +// //------------------------------------------------------------------------- -filtercoeff(f0, dBgain, Q) = environment +filtercoeff(f0, dBgain, Q) = environment { //---------------------------------------- - // biquad coeffs for various filters - // usage : filtercoeff(f0, dBgain, Q).LPF + // biquad coeffs for various filters + // usage : filtercoeff(f0, dBgain, Q).LPF //---------------------------------------- - - LPF = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + LPF = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = (1 - cos(w0))/2; b1 = 1 - cos(w0); @@ -56,8 +57,8 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*cos(w0); a2 = 1 - alpha; }; - - HPF = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + HPF = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = (1 + cos(w0))/2; b1 = -1 - cos(w0); @@ -66,7 +67,7 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*cos(w0); a2 = 1 - alpha; }; - + BPF = rbjcoef( a0, a1, a2, b0, b1, b2 ) // constant 0 dB peak gain with { b0 = alpha; @@ -76,8 +77,8 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*cos(w0); a2 = 1 - alpha; }; - - notch = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + notch = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = 1; b1 = -2*cos(w0); @@ -86,8 +87,8 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*cos(w0); a2 = 1 - alpha; }; - - APF = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + APF = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = 1 - alpha; b1 = -2*cos(w0); @@ -96,8 +97,8 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*cos(w0); a2 = 1 - alpha; }; - - peakingEQ = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + peakingEQ = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = 1 + alpha*A; b1 = -2*cos(w0); @@ -106,8 +107,8 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*cos(w0); a2 = 1 - alpha/A; }; - - peakNotch = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + peakNotch = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = 1 + alpha*G; b1 = -2*cos(w0); @@ -116,8 +117,8 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*cos(w0); a2 = 1 - alpha/G; }; - - lowShelf = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + lowShelf = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = A*( (A+1) - (A-1)*cos(w0) + 2*sqrt(A)*alpha ); b1 = 2*A*( (A-1) - (A+1)*cos(w0) ); @@ -126,8 +127,8 @@ filtercoeff(f0, dBgain, Q) = environment a1 = -2*( (A-1) + (A+1)*cos(w0) ); a2 = (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha; }; - - highShelf = rbjcoef( a0, a1, a2, b0, b1, b2 ) + + highShelf = rbjcoef( a0, a1, a2, b0, b1, b2 ) with { b0 = A*( (A+1) + (A-1)*cos(w0) + 2*sqrt(A)*alpha ); b1 = -2*A*( (A-1) + (A+1)*cos(w0) ); @@ -138,10 +139,10 @@ filtercoeff(f0, dBgain, Q) = environment }; // --------------------- implementation ------------------------------ - + // convert rbj coeffs to biquad coeffs rbjcoef(a0,a1,a2,b0,b1,b2) = (b0/a0, b1/a0, b2/a0, a1/a0, a2/a0); - + // common values // alpha = sin(w0)/(2*Q); // w0 = 2*ma.PI*f0/Fs; @@ -155,17 +156,17 @@ filtercoeff(f0, dBgain, Q) = environment //------------------------------------------------------------------------- // Implementation of MaxMSP biquad~ -// y[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2] - b1 * y[n-1] - b2 * y[n-2] +// y[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2] - b1 * y[n-1] - b2 * y[n-2] //------------------------------------------------------------------------- -biquad(x,a0,a1,a2,b1,b2) = x : + ~ ((-1)*conv2(b1, b2)) : conv3(a0, a1, a2) +biquad(x,a0,a1,a2,b1,b2) = x : + ~ ((-1)*conv2(b1, b2)) : conv3(a0, a1, a2) with { conv2(c0,c1,x) = c0*x+c1*x'; conv3(c0,c1,c2,x) = c0*x+c1*x'+c2*x''; }; //------------------------------------------------------------------------- -// +// // Filters using filtercoeff and biquad // //------------------------------------------------------------------------- @@ -181,26 +182,26 @@ BPF(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).BPF : biquad; // notch Filter notch(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).notch : biquad; - + // All Pass Filter APF(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).APF : biquad; - + // ???? peakingEQ(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).peakingEQ : biquad; - + // Max peakNotch is like peakingEQ but with a linear gain peakNotch(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).peakNotch : biquad; - + // ???? lowShelf(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).lowShelf : biquad; - + // ???? highShelf(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).highShelf : biquad; //------------------------------------------------------------------------- -// Implementation of Max/MSP line~. Generate signal ramp or envelope -// +// Implementation of Max/MSP line~. Generate signal ramp or envelope +// // USAGE : line(value, time) // value : the desired output value // time : the interpolation time to reach this value (in milliseconds) @@ -209,11 +210,11 @@ highShelf(x, f0, gain, Q) = x , filtercoeff(f0,gain,Q).highShelf : biquad; // output value changes. The interpolation time is sampled only then. //------------------------------------------------------------------------- -line (value, time) = state~(_,_):!,_ +line (value, time) = state~(_,_):!,_ with { - state (t, c) = nt, if (nt <= 0, value, c+(value - c) / nt) + state (t, c) = nt, ba.if (nt <= 0, value, c+(value - c) / nt) with { - nt = if( value != value', samples, t-1); + nt = ba.if( value != value', samples, t-1); samples = time*ma.SR/1000.0; }; };
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________ Faudiostream-devel mailing list Faudiostream-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-devel