Skip to content

LCC equations parameters in the code #19

@skateskate

Description

@skateskate

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... :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions