How about this?
import("music.lib");
M = 4; // Number of rows
N = 3; // Number of columns
// 4x3 matrix of gains:
coeffs = (
1, 2, 3,
4, 5, 6,
7, 8, 9,
10,11,12
);
row(i) = (bus(N) , (par(col,N,coeffs:selector(N*i+col,N*M))) :
interleave(N,2)) : par(i,N,*) :> _;
process = bus(N) <: par(i,M,row(i));
At 01:42 PM 10/10/2014, Pierre Lecomte wrote:
Thank you for your solution !
It's working for small matrix dimensions.
I tried with a big matrix (32 inputs, 25 outputs) but unfortunately it's
killing the CPU, lots of xruns, and no sound..
Maybe an alternate solutions for big matrix .. ?
Thanks
Pierre
> Pierre,
>
> There's probably a better way, but this works for what I need.
>
>
> // 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);
>
> Aaron ([email protected])
> Menlo Park, CA US
>
>
> On Mon, Sep 22, 2014 at 8:12 AM, Pierre Lecomte <[email protected]>
>
> wrote:
> > Hello,
> >
> > I would like to know if there is a easy-way to perform matrix
> > multiplication in FAUST :
> >
> > More precisely, I would like to multiply N input audio streams by a
> > constant matrix (M x N) to obtain M output audio streams :
> >
> > a0 a1 a2 in1 out1
> > a3 a4 a5 X in2 = out2
> >
> > in3
> >
> > I would like to avoid to explicitely write the matrix operation :
> > out1 = a0 in1 + a1 in2 + a2 in3, etc.
> >
> > Thank you for your help
> >
> > Pierre
> >
> >
> >
--------------------------------------------------------------------------
> > ---- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> >
> >
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clkt
> > rk _______________________________________________
> > Faudiostream-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/faudiostream-users
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Julius O. Smith III <[email protected]>
Professor of Music and, by courtesy, Electrical Engineering
CCRMA, Stanford University
http://ccrma.stanford.edu/~jos/
------------------------------------------------------------------------------
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