Hi,

I have been experimenting with -vec in a .dsp involving multiple parallel 
string resonators. This morning I was amazed at the performance boost I got, 
but when I added multiple controls to my .dsp file things slowed down a lot. 
Compilation takes much longer and when it finishes the compiled .vst is much 
slower than the version with single controls (roughly 10x slower I think). I 
realise there is more smoothing taking place, but I'm wondering if there is 
something else in play that is causing the compiler not to vectorize the code 
as well as with single controls.

I'm compiling on osx 10.6 with faust Version 0.9.59, like this

faust2vst stringbox.dsp -vec

my system is a 2010 MBP, i7

below are three versions of my faust .dsp. Strangely the third version compiles 
and runs quickly making me think that the nested parallel structures are 
causing problems for the auto vectorization.

thanks very much for any tips,

oli larkin

// 
----------------------------------------------------------------------------------------------------------------------------------
// stringbox.dsp VERSION 1 (multiple controls, slow)

declare name "StringBox";
declare description "Bank of 8 virtual strings";
declare author "Oli Larkin ([email protected])";
declare copyright "Oliver Larkin";
declare version "0.1";
declare licence "GPL";
 
import("filter.lib"); 
dtmax = 4096;

f(i) = hslider("A_freq%1i", 100, 20, 15000, 1) : smooth(0.999);
t60(i) = hslider("B_decay%1i", 4, 0, 60, 0.01) : smooth(0.999);
damp(i) = hslider("C_damp%1i", 1., 0, 1, 0.01) : smooth(0.999);
g(i) = hslider("D_gain%1i", 0, -70, 0., 0.1) : db2linear : smooth(0.999);
fd = hslider("E_diff", 0., 0., 1., 0.0001) : smooth(0.999);

stringloop(x, s, c) = (+ : fdelay1a(dtmax, dtsamples, x)) ~ (dampingfilter * 
fbk) : dcblocker
with {
        freq = f(s) + ((c-4) * fd);
        coeff = damp(s);
        dtsamples = (SR/freq) - 2;
        fbk = pow(0.001,1.0/( freq*t60(s)));

        h0 = (1. + coeff)/2; 
        h1 = (1. - coeff)/4;
        dampingfilter(x) = (h0 * x' + h1*(x+x''));
};

rissetstring(x, s) = _ <: par(c, 9, stringloop(x, s, c)) :> _*0.01*g(s);
stereostring(L, R, s) = rissetstring(L, s), rissetstring(R, s);
stringbox(n) = _ , _ <: par(s, n, stereostring(_, _, s)) :> _ , _;
process = stringbox(8);

// 
----------------------------------------------------------------------------------------------------------------------------------
// stringbox.dsp VERSION 2 (single controls, fast)

declare name "StringBox";
declare description "Bank of 8 virtual strings";
declare author "Oli Larkin ([email protected])";
declare copyright "Oliver Larkin";
declare version "0.1";
declare licence "GPL";
 
import("filter.lib"); 
dtmax = 4096;

f = hslider("A_freq", 100, 20, 15000, 1) : smooth(0.999);
t60 = hslider("B_decay", 4, 0, 60, 0.01) : smooth(0.999);
damp = hslider("C_damp", 1., 0, 1, 0.01) : smooth(0.999);
g = hslider("D_gain", 0, -70, 0., 0.1) : db2linear : smooth(0.999);
fd = hslider("E_diff", 0., 0., 1., 0.0001) : smooth(0.999);

stringloop(x, s, c) = (+ : fdelay1a(dtmax, dtsamples, x)) ~ (dampingfilter * 
fbk) : dcblocker
with {
        freq = f + ((c-4) * fd);
        dtsamples = (SR/freq) - 2;
        fbk = pow(0.001,1.0/( freq*t60));

        h0 = (1. + damp)/2; 
        h1 = (1. - damp)/4;
        dampingfilter(x) = (h0 * x' + h1*(x+x''));
};

rissetstring(x, s) = _ <: par(c, 9, stringloop(x, s, c)) :> _*0.01*g;
stereostring(L, R, s) = rissetstring(L, s), rissetstring(R, s);
stringbox(n) = _ , _ <: par(s, n, stereostring(_, _, s)) :> _ , _;
process = stringbox(8);

// 
----------------------------------------------------------------------------------------------------------------------------------
// stringbox.dsp VERSION 3 (multiple controls, 1 comb filter per string, 
instead of 9,  fast)

declare name "StringBox";
declare description "Bank of 8 virtual strings";
declare author "Oli Larkin ([email protected])";
declare copyright "Oliver Larkin";
declare version "0.1";
declare licence "GPL";
 
import("filter.lib"); 
dtmax = 4096;

f(i) = hslider("A_freq%1i", 100, 20, 15000, 1) : smooth(0.999);
t60(i) = hslider("B_decay%1i", 4, 0, 60, 0.01) : smooth(0.999);
damp(i) = hslider("C_damp%1i", 1., 0, 1, 0.01) : smooth(0.999);
g(i) = hslider("D_gain%1i", 0, -70, 0., 0.1) : db2linear : smooth(0.999);

stringloop(x, s) = (+ : fdelay1a(dtmax, dtsamples, x)) ~ (dampingfilter * fbk) 
: dcblocker
with {
        freq = f(s);
        coeff = damp(s);
        dtsamples = (SR/freq) - 2;
        fbk = pow(0.001,1.0/( freq*t60(s)));

        h0 = (1. + coeff)/2; 
        h1 = (1. - coeff)/4;
        dampingfilter(x) = (h0 * x' + h1*(x+x''));
};

stereostring(L, R, s) = stringloop(L, s), stringloop(R, s);
stringbox(n) = _ , _ <: par(s, n, stereostring(_, _, s)) :> _ , _;
process = stringbox(8);



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to