Hi,

How can I inspect the value of a variable in Faust? I’m trying to build a 
spectral tilt filter in Matlab (for learning purposes), following the Faust 
implementation. The results are wrong in Matlab, and I would like to compare my 
variables in Matlab with those in Faust.

This is what I have so far in Faust:

import("filters.lib");
import("noises.lib");

   alpha = hslider("[1] Slope of Spectral Tilt across Band",-1/2,-1,1,0.001);
   f0 = hslider("[2] Band Start Frequency [unit:Hz]",100,20,10000,1);
   bw = hslider("[3] Band Width [unit:Hz]",5000,100,10000,1);

process(x) =  no.noise  : spectral_tilt(2,f0,bw,alpha) : _;

and this what I have in Matlab:

function tilt()

sr = 48000;
N = 10; % Number of poles
alpha = -0.5;
f0 = 100;
f1 = 18000;

noise = rand(sr,1);

w0 = 2 * pi * f0;
r =  (f1/f0)^(1.0/(N-1));

mp = w0*r .^ (0:N-1); 
mz = w0*r .^(-alpha + (0:N-1)); 


% prewarping for bilinear transform
mph = prewarp(mp,sr,w0);
mzh = prewarp(mz,sr,w0);

for i=1:N
   g = mph(i)/mzh(i); % a0/b0
   [b1, b0, a1] = tf1s(1,mzh(i),mph(i),1,sr);
   noise = g*filter([b0, b1],[1, -a1], noise,sr);
  % soundsc(noise,sr);
end
plot(noise)
soundsc(filter(Ba,[1 Aa],rand(sr,1)), sr)

end

function warped = prewarp(w,sr,wp)
T = 1/sr;
warped = wp * tan(w*T/2)/tan(wp*T/2);
end

function [b1d, b0d, a1d] = tf1s(b1,b0,a0,w1,sr)
c   = 1/tan(w1*0.5/sr); % bilinear-transform scale-factor
d   = a0 + c;
b1d = (b0 - b1*c) / d;
b0d = (b0 + b1*c) / d;
a1d = (a0 - c) / d;
end

I’d like to compare the Matlab results in mzh, and mph, with those of Faust 
(e.g., a0,b0, etc.), but I can’t figure out how.

I’m sorry if this is obvious, I’m new to Faust.

Thanks,

Julian Villegas, Ph.D.


PS: The Matlab code is based on that provided in "Closed Form Fractional 
Integration and Differentiation via Real Exponentially Spaced Pole-Zero Pairs” 
by
Julius Orion Smith and Harrison Freeman Smith.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to