Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCC equations parameters in the code #19

Open
skateskate opened this issue Aug 20, 2020 · 0 comments
Open

LCC equations parameters in the code #19

skateskate opened this issue Aug 20, 2020 · 0 comments

Comments

@skateskate
Copy link

Hello,
first of all thank you very much for your project, it sounds amazing!
I am trying to understand the code of the lcc() function in order to find a one-to-one correspondence with the LCC equations written in one of your papers. Unfortunately, there are some parameters that I cannot link back to the equations.
For clarity, here is the code of the lcc() function and the equations I am referring to.

static void lcc(){
	for (int i=0; i<buflen; i += 2) {
		in_LR[i]   = in_LR[i]   * inputgain;
		in_LR[i+1] = in_LR[i+1] * inputgain;
		
		out_LR[i]   = in_LR[i]   - decaygain * prevOut_LR[i+1]; //Left channel
		out_LR[i+1] = in_LR[i+1] - decaygain * prevOut_LR[i]; //Right channel

		if (i==0) {
			prevOut_LR[buflen-2] += out_LR[0]*delaymod;
			prevOut_LR[buflen-1] += out_LR[1]*delaymod;
		}
	}	
	
	for (int i=0; i<buflen; i += 2){
		if (i<buflen-2) {
			prevOut_LR[i]   = out_LR[i]*delaymodinv  + out_LR[i+2]*delaymod;
			prevOut_LR[i+1] = out_LR[i+1]*delaymodinv + out_LR[i+3]*delaymod;
		} else {
			prevOut_LR[i]   = out_LR[i]*delaymodinv;
			prevOut_LR[i+1] = out_LR[i+1]*delaymodinv;
		}
		out_LR[i] = endgain*(out_LR[i]     + in_LR[i]*centergain*inputgain/2 +
			in_LR[i+1]*centergain*inputgain/2);
		out_LR[i+1] = endgain*(out_LR[i+1] + in_LR[i]*centergain*inputgain/2 +
			in_LR[i+1]*centergain*inputgain/2);
	}
}

image

The used parameters are:

  • inputgain: scales the input samples. Not directly present in the equations, but it is ok to me, since it should be compensated by endgain if I am not wrong.
  • decaygain: it should be the "alpha" parameter in the equations, right?
  • delaymod: unfortunately I cannot understand the meaning of this parameter, nor I can find the corresponding element in the equations.
  • delaymodinv: same as the previous parameter.
  • centergain: if I am not wrong, it should be the "beta" parameter in the equations.

I am not sure also on the d term of the equation (the "forward interval delay per reiteration"), where is it used in the code?

Sorry for the multiple questions... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant