Why doesn't this circular convolution work? help with DSP!
Archive · 20077 old posts
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
lapleca ·
Hi!
Please, I need help to do the circular convolution. I have done a DSP module where I try to do the convolution between a signal with 44100 samples and another signal with 512, but it doesn't work...I am desperated.
what's wrong in this code?
I know that my knowledge of DSP is very poor...
I think my main problem with the convolution is do the buffers for operate, with both signals, I think that the signal don't pass through the buffer. I hope you understand me, my english is very poor too..
Thank you very much..If you could tell me something about this, I would be very grateful..
Another thing: I vote to the creation of a convolution module!!!
lapleca
rl ·
lapleca wrote: what's wrong in this code?
...
streamin coef;
...
float memcoefs[512]; // coefficient data
...
loop(512)// Put coefficients
{
memcoefs[index]=coef;
index=index+1;
}
I think that's the problem. You have a streamin coef statement. That means one value of coeff per cycle of the code module. You can't read in all coeffs in one loop.
You would either need 512 streamin statements (resulting in 512 connectors 🙁 ) to have all coefficients available at once or you could read them sample by sample resulting in 512 samples extra-latency.
This is a limitation to the code module. A nice feature add would be an array input.
Like:
memin coeff [512];
where a Mem or Mem Array could be connected.
Malc, Jorge?
As a workaround you could build the schematic without the code module until you run out of cables 😉
stefan ·
Or you could spend the first 512 samples worth of audio time for filling the array by feeding it sample by sample to the code component. Would bloat the code a fair bit, but should work 🙂
lapleca ·
Thank you very much guys!
Following the advise of rl, I have removed the loop (512) for storing the coefs (before stage(1)), and I put the buffer of coefs in the stage (1), I but it doesn't work.
and Stefan, what do you mean with "you could spend the first 512 samples worth of audio time for filling the array"? I mean, what array? because I think that an array can't be an entry of a code module..
Well, this is the new code, I don't know if you suggest something like this..
I think that the problem in general is in buffers, because I need that one buffer stores the first 512 samples of the signal of 44100 samples, and after, this buffer stores the samples 2 until 513, and then 3 until 514, etc..I mean, like in a loop..
So I need 2 buffers, one of them, for filling the signal of 44100 samples, and get pieces of 512, and the other buffer for stores the 512 coefs.
I have try to do this without code module, but I don't know how exactly I can do a buffer with other modules..I am trying with MemCreate, and then WriteMem..in this sense If you know some way for creating a buffer with modules..I am proving too with this.
Thank you again!
lapleca
[/img]
BasherT ·
I've been struggling with something similar as part of an attempt to create a beat detection module.
I found thisonline and have been thinking about how to implement the first technique suggested which involves comparing the average "energy" of 44100 samples with the average energy of the first 1024 samples within that 44100 samples.
Once I have loaded a Wav file into memory I have been unable to figure out how to fill a buffer with 44100 samples. Any suggestions bearing in mind that the beat detection does not have to be done in real time?
stefan ·
lapleca wrote: and Stefan, what do you mean with "you could spend the first 512 samples worth of audio time for filling the array"? I mean, what array? because I think that an array can't be an entry of a code module..
I meant something that would work kindof like this (pseudo-code):
streamin arrayInput;
i = 0;
if ( i < 512 )
array[i] = arrayInput;
else
[doConvolutionStuff]
i = i + 1;
So arrayInput would get it's values from outside of this component, one value at a time during the first 512 rendered samples.
Now, I don't think this is a GOOD solution, but it could work in some scenarios.
ronaldpassion ·
i am also waiting this convolution things...
still doesnt find the right source...
help help..
THanx
Wrote something here? To have a post removed or your name hidden, write to [email protected].