Csound Csound-dev Csound-tekno Search About

[Csnd] sum of all elements in a table

Date2009-07-12 00:49
FromOeyvind Brandtsegg
Subject[Csnd] sum of all elements in a table
Hello,

I'm building a modulation routing matrix, for efficient manipulation
of a large amount of synthesis parameters and a quite large amount of
modulators (LFOs etc).
A few hundred parameters should be routed, offset and multiplied
flexibly. I have started to build a routing matrix using tables and
the vcopy/vaddv/vmultv opcodes.
This seems pretty efficient in terms of CPU usage.
The final stage (summing of all modulators for one parameters)
requires me to sum all elements in a table (say, 1024 elements in the
table, I want one single krate variable as output).
I could of course do this in Csound code, summing the elements one by
one, but it seems it would be much more (CPU) efficient if there was
an opcode for it.
Is there an opcode that returns the sum of all elements in a table (or vector) ?
Is this perhaps possible with the new lineear algebra opcodes ?
(haven't been able to check them out yet).

all best
Oeyvind

Date2009-07-12 03:21
Fromjpff@cs.bath.ac.uk
Subject[Csnd] Re: sum of all elements in a table
I do not think we have such an opcode,m but it is trivial to write.
Want to do it, or houdl I?
==J

> Hello,
>
> I'm building a modulation routing matrix, for efficient manipulation
> of a large amount of synthesis parameters and a quite large amount of
> modulators (LFOs etc).
> A few hundred parameters should be routed, offset and multiplied
> flexibly. I have started to build a routing matrix using tables and
> the vcopy/vaddv/vmultv opcodes.
> This seems pretty efficient in terms of CPU usage.
> The final stage (summing of all modulators for one parameters)
> requires me to sum all elements in a table (say, 1024 elements in the
> table, I want one single krate variable as output).
> I could of course do this in Csound code, summing the elements one by
> one, but it seems it would be much more (CPU) efficient if there was
> an opcode for it.
> Is there an opcode that returns the sum of all elements in a table (or
> vector) ?
> Is this perhaps possible with the new lineear algebra opcodes ?
> (haven't been able to check them out yet).
>
> all best
> Oeyvind
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>
>



Date2009-07-12 13:46
FromRory Walsh
Subject[Csnd] Re: sum of all elements in a table
> Is there an opcode that returns the sum of all elements in a table (or vector) ?

Can't this be done manually, in Csound? Just read a table and sum the
output of each index? I guess you probably want it instantly however,
would setting a high k-rate in a UDO be ok? Just a thought...

Rory.



> all best
> Oeyvind
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>