== ezFIT Optimizer (for Clarujust) Algorithms == == Setup Baseline60 and Baseline80 == === Goals === We want to take the Equalizer (EQ) and Compression Ratio (CR) settings (as determined by Autofit) as the basis for setting up the Ethos chip to provide linear amplification (CR = 1:1) for two different input conditions. Setup60 and Setup80 are to linearize the HA with the appropriate gains for both 60 and 80 dB inputs. === Steps === It turns out that the CRs provided by the Ethos API generate nice even gain steps as we increase the CR index. * Valid indexes range from 0 to 15, corresponding to CRs going from 1:1 up to 4:1. * Let's assume a TK of 50dB (index 2 ...which is our default) for these calculations. ==== Calculate Gain 60 and 80 ==== Given the Gain for 50 in, we can calculate the gain provided for 60 in as follows: //-------------------------------------------- // Gain Formulas // X = 60dB Input, or 80dB Input // CRi = Compression Ratio Index // GainX = G50 - (50dB-XdB x 0.05 x CRi); //-------------------------------------------- G60 = G50 - (10 x 0.05 x CRi); G80 = G50 - (30 x 0.05 x CRi); * Gain Input: * G60 (Gain for 60in): It is the gain for 50 in (G50) reduced by 10x0.05 multiplied by the CR index (NOT the CR itself). * G80 (Gain for 60in): It is the gain for 50 in (G50) reduced by 30x0.05 multiplied by the CR index (NOT the CR itself). * G50: The G50 values are taken from the BEQx values (i.e. Equalizer parameters) for each channel/band as setup by Autofit. * 50dB-XdB Offset: * 10: represents the fact that 60in is 10dB higher (louder) than 50dB (50in). * 30: The change to 30 x 0.05 is because 80 in is 30dB higher (louder) than 50dB (50in). * 0.05 is a gain factor that results from the nice CR spacings on the Ethos. It really is 0.05 dB/dB, which is 0.05 dB of gain change for each dB in increase in input level. ==== Calculate Equalizers ==== On Ethos the BEQx index values correspond to 2 dB steps so we need to quantize the gain differences to a 2 dB resolution. Also the BEQx values must be of type integer. This results in the following pseudo code: //-------------------------------------------- // Equalizer Formulas //-------------------------------------------- BEQx_60in = BEQx_autofit - Round((10 * 0.05 * CRi_autofit) / 2); // assuming Round() does rounding to the nearest integer, NOT truncation BEQx_80in = BEQx_autofit - Round((30 * 0.05 * CRi_autofit) / 2); ==== Set Equalizers and Linear Compression ==== Of course, we also need to deal with the fact that there are 12 bands of EQ and only 8 channels of Compression, so in an exhaustive set of code lines: For setup60: //-------------------------------------------- // Setup Equalizers for Baseline60 //-------------------------------------------- BEQ1_60in = BEQ1_autofit - Round((10 * 0.05 * CR1_autofit) / 2); BEQ2_60in = BEQ2_autofit - Round((10 * 0.05 * CR2_autofit) / 2); BEQ3_60in = BEQ3_autofit - Round((10 * 0.05 * CR3_autofit) / 2); BEQ4_60in = BEQ4_autofit - Round((10 * 0.05 * CR4_autofit) / 2); BEQ5_60in = BEQ5_autofit - Round((10 * 0.05 * CR5_autofit) / 2); // next 8 share a CRi value with their neighbour BEQ6_60in = BEQ6_autofit - Round((10 * 0.05 * CR5_autofit) / 2); // also uses CR5 BEQ7_60in = BEQ7_autofit - Round((10 * 0.05 * CR6_autofit) / 2); BEQ8_60in = BEQ8_autofit - Round((10 * 0.05 * CR6_autofit) / 2); // also uses CR6 BEQ9_60in = BEQ9_autofit - Round((10 * 0.05 * CR7_autofit) / 2); BEQ10_60in = BEQ10_autofit - Round((10 * 0.05 * CR7_autofit) / 2); // also uses CR7 BEQ11_60in = BEQ11_autofit - Round((10 * 0.05 * CR8_autofit) / 2); BEQ12_60in = BEQ12_autofit - Round((10 * 0.05 * CR8_autofit) / 2); // also uses CR8 //--------------------------------------------------------------- // Set Compression to Linear (CR = 1:1), i.e. set the CRi = 0 //--------------------------------------------------------------- for i = 1 to 8 do begin CRi = 0; end; // all done setup60 Likewise for setup80: //-------------------------------------------- // Setup Equalizers for Baseline80 //-------------------------------------------- BEQ1_80in = BEQ1_autofit - Round((30 * 0.05 * CR1_autofit) / 2); BEQ2_80in = BEQ2_autofit - Round((30 * 0.05 * CR2_autofit) / 2); BEQ3_80in = BEQ3_autofit - Round((30 * 0.05 * CR3_autofit) / 2); BEQ4_80in = BEQ4_autofit - Round((30 * 0.05 * CR4_autofit) / 2); BEQ5_80in = BEQ5_autofit - Round((30 * 0.05 * CR5_autofit) / 2); // next 8 share a CRi value with their neighbour BEQ6_80in = BEQ6_autofit - Round((30 * 0.05 * CR5_autofit) / 2); // also uses CR5 BEQ7_80in = BEQ7_autofit - Round((30 * 0.05 * CR6_autofit) / 2); BEQ8_80in = BEQ8_autofit - Round((30 * 0.05 * CR6_autofit) / 2); // also uses CR6 BEQ9_80in = BEQ9_autofit - Round((30 * 0.05 * CR7_autofit) / 2); BEQ10_80in = BEQ10_autofit - Round((30 * 0.05 * CR7_autofit) / 2); // also uses CR7 BEQ11_80in = BEQ11_autofit - Round((30 * 0.05 * CR8_autofit) / 2); BEQ12_80in = BEQ12_autofit - Round((30 * 0.05 * CR8_autofit) / 2); // also uses CR8 //--------------------------------------------------------------- // Set Compression to Linear (CR = 1:1), i.e. set the CRi = 0 //--------------------------------------------------------------- for i = 1 to 8 do begin CRi = 0; end; // all done setup80 ==== Compression ==== We also need to modify the ''SetCompression()'' functionality slightly. At present we are moving the TKs up to 60 dB (index value 4). This was done to save some time during the initial testing of the Clarujust method. It is better to keep the TKs at 50 in (index value 2), and tweak the gain for 50dBin slightly. Similar to the above, the Gain for 50 is slightly more than the Gain for 60 in. We are assuming the present BEQi settings are based on the Optimized 60 settings, and that the CR indexes have been calculated as in the previous version of this routine to provide the CRi_optimized index values. So, G50 = G60_optimized + ( 10 x 0.05 x CRi_optimized ) // NOTE: it is now a plus sign instead of minus before the bracket The gain change needs to be quatized to the nearest 2dB since that is the gain resolution of the Ethos EQs. BEQi_best = BEQi_optimized60 + Round((10 * 0.05 * CRi_optimized)/2); // assuming Round() does rounding to nearest integer And of course the 8 channel / 12 bands necessitates the following explicit code: BEQ1_best = BEQ1_optimized60 + Round((10 * 0.05 * CR1_optimized) / 2); BEQ2_best = BEQ2_optimized60 + Round((10 * 0.05 * CR2_optimized) / 2); BEQ3_best = BEQ3_optimized60 + Round((10 * 0.05 * CR3_optimized) / 2); BEQ4_best = BEQ4_optimized60 + Round((10 * 0.05 * CR4_optimized) / 2); BEQ5_best = BEQ5_optimized60 + Round((10 * 0.05 * CR5_optimized) / 2); // next 8 share a CRi value with their neighbour BEQ6_best = BEQ6_optimized60 + Round((10 * 0.05 * CR5_optimized) / 2); // also uses CR5 BEQ7_best = BEQ7_optimized60 + Round((10 * 0.05 * CR6_optimized) / 2); BEQ8_best = BEQ8_optimized60 + Round((10 * 0.05 * CR6_optimized) / 2); // also uses CR6 BEQ9_best = BEQ9_optimized60 + Round((10 * 0.05 * CR7_optimized) / 2); BEQ10_best = BEQ10_optimized60 + Round((10 * 0.05 * CR7_optimized) / 2); // also uses CR7 BEQ11_best = BEQ11_optimized60 + Round((10 * 0.05 * CR8_optimized) / 2); BEQ12_best = BEQ12_optimized60 + Round((10 * 0.05 * CR8_optimized) / 2); // also uses CR8 === Summary === The setup60 and setup80 routines calculate the inital EQ settings for each optimization based on the Autofit values (and all CRs are set 1:1) using the following formulas: BEQx_60in = BEQx_autofit - Round((10 * 0.05 * CRi_autofit) / 2); // Assuming Round() does rounding to the nearest integer, NOT truncation BEQx_80in = BEQx_autofit - Round((30 * 0.05 * CRi_autofit) / 2); These gains are lower then the Autofit values, but because compression is being turned off, the gains should be appropriate for each input condition. The ''SetCompression()'' routine calculates new CRs based on the optimization process (using equations buried in the VB coded provided previously), and now we are going to leave the TKs at 50in, and compensate by increasing the EQ gains slightly using: BEQi_best = BEQi_optimized60 + Round((10 * 0.05 * CRi_optimized) / 2); // Assuming Round() does rounding to near integer