Hello everyone,

I'm trying to implement an HOA decoder for spherical microphones and I'm 
getting some numerical issues :

The principle is the following : I have the temporal signals of all the 
capsules of the microphone : it's temporal vector of signals, let's call it 
"I"  (size n x 1)

I have to multiply this vector by a Matrix "M" (size m x n) to obtain my HOA 
components.

So I have to do this operation at each discrete time t :

B = M.I

I've used the solution proposed by Aaron Heller to implement the matrix 
multiplication :

// bus with gains
gain(c) = R(c) with {
  R((c,cl)) = R(c),R(cl);
  R(1)      = _;
  R(0)      = !;
  //R(0)      = !:0; // if you need to preserve the number of outputs
  R(float(0)) = R(0);
  R(float(1)) = R(1);
  R(c)      = *(c);
};

// n = number of inputs
// m = number of output
matrix(n,m) = par(i,n,_) <: par(i,m,gain(a(i)):>_);

a(0) = (0.5, -0.5, 1.1, 1.2,0);
a(1) = (1,2,3,4,-1);
a(2) = (0.5,0.5,0,0.25,1/3);
a(3) = (0,0,0,.1, sqrt(2));

process = matrix(5,4);

It's working but I have got some unexplained numerical problems :

In my matrix "M", the sum of the components of each rows = 0 except the first 
row.  So if  all inputs signals are exactly the same, the outputs will be 0 
except the first output.

But,  if the signals are not the same, I should have m outputs signals not 
null. But I don't when I'm playing my input wav : only the first output is not 
null !

So I've tried the following :

I take a constant signal as input signal : the n samples at discrete time t 
(extract from  my input wav signal)

matrix(n,m)= 
(0.143993,0.147716,0.118169,0.141023,0.155442,0.112583,0.166597,0.178432,0.135545,0.186261,0.181142,0.168309,0.137996,0.14302,0.139751,0.157548,0.159706,0.133034,0.168049,0.124931,0.160939,0.161888,0.146289,0.140364,0.188028,0.168121,0.160577,0.152144,0.156805,0.145675,0.196994,0.134682)<:
 
par(i,m,gain(a(i)):>_);

I measure the output and I've got something everywhere ! But when I play the 
wav entirely, no outputs except the first one !

I've implemented this matrix operation in PureData (without the use of Faust) 
and it's working when I'm playing the input wav (the M matrix is exactly the 
same)

My observations are the following with my Faust code : when the inputs signals 
are slightly different, I've got output signal everywhere, but when they are 
not exactly identical but close enough, I just have the first output


Here is my Faust code for a M = 3*32 matrix :

import("math.lib");
import("music.lib");

// bus with gains
gain(c) = R(c) with {
  R((c,cl)) = R(c),R(cl);
  R(1)      = _;
  R(0)      = !;
  //R(0)      = !:0; // if you need to preserve the number of outputs
 R(float(0)) = R(0);
  R(float(1)) = R(1);
  R(c)      = *(c);
};

//vmeter(x)             = attach(x, envelop(x) : vbargraph("[unit:dB]", -70, 
10));
//envelop                       = abs : max(db2linear(-70)) : linear2db : 
min(10)  : max ~ 
-(80.0/SR);

vmeter(x)               = attach(x, envelop(x) : vbargraph("[unit:dB]", -100, 
10));
envelop                 = abs : max(db2linear(-100)) : linear2db : min(10)  : 
max ~ 
-(80.0/SR);

// n = number of inputs
// m = number of output

matrix(n,m) = hgroup("Inputs",par(i,n,vgroup("%i", 
vmeter)))<:par(i,m,gain(a(i)):>hgroup("Outputs",vgroup("%i",vmeter)));

//matrixtest(n,m) = par(i,n,1) <: par(i,m,gain(a(i)):>_);

//matrixtest2(n,m)= 
(0.143993,0.147716,0.118169,0.141023,0.155442,0.112583,0.166597,0.178432,0.135545,0.186261,0.181142,0.168309,0.137996,0.14302,0.139751,0.157548,0.159706,0.133034,0.168049,0.124931,0.160939,0.161888,0.146289,0.140364,0.188028,0.168121,0.160577,0.152144,0.156805,0.145675,0.196994,0.134682)<:
 
par(i,m,gain(a(i)):>_);

a(0)=(0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125,0.03125);

a(1)=(0.0505636,0.0460428,0.0505636,0.0460428,0.028456,0.03125,0.0193136,0.03125,0.028456,0.03125,0.0193136,0.03125,0,0,0,0,-0.0505636,-0.0460428,-0.0505636,-0.0460428,-0.028456,-0.03125,-0.0193136,-0.03125,-0.028456,-0.03125,-0.0193136,-0.03125,0,0,0,0);

a(2)=(7.53456*10^-10,0.028456,0,-0.028456,0,0.03125,0.0505636,0.03125,0,-0.03125,-0.0505636,-0.03125,0.0193136,0.0460428,0.0460428,0.0193136,7.53456*10^-10,-0.028456,7.53456*10^-10,0.028456,0,-0.03125,-0.0505636,-0.03125,0,0.03125,0.0505636,0.03125,-0.0193136,-0.0460428,-0.0460428,-0.0193136);

process = matrix(32,25);
//process=matrixtest2(32,25);

Thanks for your help

Pierre Lecomte
PhD student

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to