1701 and 1452 compressor and Crossover Formula calculation
Hello, I also use this module. The following three times can be calculated according to the formula you give. Now there is no formula for calculating the threshold and ratio. Is there a formula for this? Calculation formula of compressor and expander.
void SigmaDSP::compressorPeak(uint16_t startMemoryAddress, compressor_t &compressor)
{
uint8_t i;
uint8_t count;
float curve[33];
float x[33];
float y[33];
float delta = 0.00;
float coeff = 0.00;
float dbps = 0.00;
float hold_par = 0.00;
float decay_par = 0.00;
float postgain_par = 0.00;
linspace(-90, 6, 33, x);
count = 0;
coeff = 1/compressor.ratio;
for(i = 0; i < 33; i++) // This algorithm creates the curve with 1 1 1 1 1 1 1 0.9 0.8 0.72 0.64 and so on coefficients
{
if(x[i] >= compressor.threshold)
{
count++;
if(count == 1)
delta = x[i]*coeff-x[i]*1;
y[i] = (x[i] * coeff)-delta;
}
else
y[i] = x[i] * 1;
}
for(i = 0; i < 33; i++) // Coefficients of the curve calculation
curve[i] = (pow(10, y[i]/20)) / (pow(10, x[i]/20)); // Coefficients are the ratio between the linearized values of vect. y and x
// Create buffer to store converted data
uint8_t storeData[5];
// Parameter load into Sigma DSP
for(i = 0; i < 33; i++)
{
floatToFixed(curve[i], storeData);
safeload_writeRegister(startMemoryAddress++, storeData, false);
}
I now have this calculation formula, but it is wrong, because I use the compressor ratio and expander ratio. The calculated array and software are incorrect. How do I calculate this?
I want to control the compressor, but I find many slope types. I find that Butterworth12 has the same parameter values as the second-order filter. I have this formula.
// Butterworth lowpass
case parameters::filterType::butterworthLowpass:
alpha = sin(w0) / 2.0 * 1/sqrt(2);
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
b0 = (1 - cos(w0)) * gainLinear / 2;
b1 = (1 - cos(w0)) * gainLinear;
b2 = (1 - cos(w0)) * gainLinear / 2;
break;
// Butterworth highpass
case parameters::filterType::butterworthHighpass:
alpha = sin(w0) / 2.0 * 1/sqrt(2);
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
b0 = (1 + cos(w0)) * gainLinear / 2;
b1 = -(1 + cos(w0)) * gainLinear;
b2 = (1 + cos(w0)) * gainLinear / 2;
break;
// Bessel lowpass
case parameters::filterType::besselLowpass:
alpha = sin(w0) / 2.0 * 1/sqrt(3) ;
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
b0 = (1 - cos(w0)) * gainLinear / 2;
b1 = (1 - cos(w0)) * gainLinear;
b2 = (1 - cos(w0)) * gainLinear / 2;
break;
// Bessel highpass
case parameters::filterType::besselHighpass:
alpha = sin(w0) / 2.0 * 1/sqrt(3) ;
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
b0 = (1 + cos(w0)) * gainLinear / 2;
b1 = -(1 + cos(w0)) * gainLinear;
b2 = (1 + cos(w0)) * gainLinear / 2;
break;
}
But if the slope exceeds 12, it will not be calculated. Where can this formula be?
software
4.7
1701 1452
Hello liangseaqiang,
You had asked the first question about the ratio in an older post so I answered it there. You can find it here:
(+) Compressor input level appears to be displayed/calculated incorrectly - Q&A - SigmaDSP Processors & SigmaStudio Dev. Tool - EngineerZone (analog.com)
As far as the filters. A 2nd order filter will have 6dB/octave. To get 12dB/octave you cascade two filters in series. So both filters will have the same coefficients each one giving you 6dB of attenuation so you end up with 12dB. To get 18dB you have three 2nd order filters in series. Again, each one with the same coefficients.
Dave T
Hello,
Refer to this post for Linkwitz-Riley crossovers. For example a Linkwitz-Riley 36 is two 3rd order Butterworth filters in series.
(+) How to use basic Second order filter to implement the Linkwitz-Riley Filter - Q&A - SigmaDSP Processors & SigmaStudio Dev. Tool - EngineerZone (analog.com)
Thank you very much for the calculation formula you told me. I can correctly calculate those values now. For example, I can calculate and control Linkwitz Filey 12 correctly, and everything is normal.
But when I tune to Linkwitz Filey 24, the calculated data is the same, but the dsp has no signal and the speaker has no sound.
When I switch to Butterworth 12, the calculated data is the same, but the dsp has no signal, the speaker has no sound, and the last two data addresses are 0x0000. I also try to change the addresses of 5a and 5b to 0x0000 and there is no sound.
When I tune to Linkwitz Filey 12, the calculated data is the same, but the speaker becomes a blast sound, there is no music sound, only a blast sound. When you turn to Linkwitz Filey 24 again, there is no sound and the burst sound disappears. That is to say, at first, the default is Linkwitz Filey 12, which can be used normally. The frequency modulation rates can be divided normally, but when you turn to other frequencies, the sound is muted. When you turn back to Linkwitz Filey 12, the burst sound disappears. What is the problem?
Another problem is the calculation coefficient of the compressor. I found a new compressor, adjusted their ratios to be consistent, and found that the data are the same. How to calculate the 136 bit data? If the system can be calculated, the compressor can be directly controlled.
Please log in to reply.







