12-03-2009 03:44 AM
Hi!
I have a little problem with summing elements in 2D array… I have signal from 64 sources in the 2D array - 64 colums and (time*sampling) rows. I have to add some deley to every signal (different for each) and then sum signals from all of the sources. I hope the picture below explains what I have to do:
What's more - I have a 2D array of delays. By now I'm doing this by creating an 1D array of "0" and then putting in it the 1D signal array at index specified by delay value.
And it works ok. But... It takes long time... Is there any method to do the summing "at once" for all the delays? Is there sth like "pointer" in array, so I could take elements from the array from specified element?
Rgds,
Mordimer
12-03-2009 04:14 AM
Hi Mordimer,
some smaller improvements:
- All "constant" operations do belong outside of loops: Move everything that is in the outer loop (except the inner loop) outside of the loop.
- In general: reading property nodes is slow!
- There is a "Sum" function in the arithmetics palette, you probably need that too...
- Why don't you attach snippets of your code? So we could play around with it...
12-03-2009 03:16 PM
Thanks for the answer.
Property nodes are temporary - it'll be changed in future when I'll connect my code with another codes - this is only a part of a bigger app...
The biggest problem is it'll have to work in a real time... and by now I've no idea how to do it, because there's a lot of operations to do - add specified delay to each channel at once, sum values and repeat all of this for another set of delays.
I'm not pretty sure where I could use the sum function. I don't have to sum all elements in the array, but only elements in every column.
The snippet won't be helpfull - it's just to big app (or I'm just to bad programist;) It's also hard to send the VI, 'couse it's useless without data to operate on...
I forgot - all of this is going to be delay and sum beamforming algorithm for 64 channel microphone matrix.
12-03-2009 05:19 PM - edited 12-03-2009 05:20 PM
One problem with your solution is also that the subset is of variable lenght due to truncation, so the shift register needs to be reallocated whenever the size changes. (Even if you define a lenght for the subset, you run out of elements and the result will be shorter!). You might want to e.g. truncate all to the shortest subset (longest delay) before summing for better inplaceness.
Why do you have a 2D array of delays? isn't the time spacing of each column constant?
What is your definition of "takes a long time": microseconds?, minutes?
12-04-2009 02:00 AM
I have 2D array of delays, because there's different "set" of delays for each angle of view - i.e. the mic array "looks" straight, so the angle of view is 0 [dgr], and delays are "0", but when it "looks" at 13 [dgr] delays are much different. The thing I could do is to replace the array of delays for each angle by a "fundamental" delay (the shortest one) and compute the others (they're 2, 3 ... times greater - for regular mic array). But I'm not sure if it would help.
"Takes a long time" means about 4s (signals are 48kHz, 2s long, the mic array is regular - 64 mics, 2cm between mics).
The best thing would be something like buffer - signals would be delayed in it and would be summed after this buffer (picture below shows what I mean). Is it possible to do?
Rgds,
Mordimer
12-04-2009 02:17 AM
Mordimer wrote:picture below shows what I mean
The picture is not clear. Too many unlabeled squares arranged in weird patterns connected by random arrows.
I still don't understand the experiment. Is there a more detailed description on the web somewhere?
12-04-2009 02:52 AM
I hope this picture will be more helpful:
A detailed description of what I'm doing is here -> B&K Technical review (I'm doing it now in time domain, not in frequency domain).
12-04-2009 03:33 AM
As i understand it:
Select a column (index array), rotate array/select subarray according to delay, replace column.
Now the table/matrix should be organized.
Do a Sum function on resulting matrix.
/Y
12-04-2009 03:45 AM
12-04-2009 09:48 AM
OK, makes more senses now. Could you attach a very small VI that contains a typical input array as diagram constant, as well as a delay array and an array with the desired result.
(To make these arrays, simply add properly named indicators to the various wires, run the VI once, then right-click the indicator terminals...create constant. Show the label of the constants. Copy them all into a new VI and attach it here. No code needed.)