Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ezfit:clarujust:ezfit_optimizer_clarujust_algorithms [2010/01/07 15:30]
smayr
ezfit:clarujust:ezfit_optimizer_clarujust_algorithms [2010/01/08 16:44] (current)
smayr
Line 5: Line 5:
 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. 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 ===  === 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. + 
-  +It turns out that the CRs provided by the Ethos API generate nice even gain steps as we increase the CR index.  
-I am assuming a TK of 50dB (index 2 ...which is our default) for these calculations.+  * 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 ====  ==== Calculate Gain 60 and 80 ==== 
 +
 Given the Gain for 50 in, we can calculate the gain provided for 60 in as follows: Given the Gain for 50 in, we can calculate the gain provided for 60 in as follows:
 <code csharp>  <code csharp> 
 +//--------------------------------------------
 +// 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); G60 = G50 - (10 x 0.05 x CRi);
 +G80 = G50 - (30 x 0.05 x CRi);
 </code> </code>
-  
-So, G60 (gain for 60 in) is the gain for 50 in (G50) reduced by 10x0.05 multiplied by the CR index (NOT the CR itself). The 10 represents the fact that 60in is 10 dB higher than 50dB, and the 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. 
  
-Likewise+  * 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.
  
-<code csharp> +==== Calculate Equalizers ====  
-G80 G50 - (30 x 0.05 x CRi); + 
-</code> +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:
-  +
-The change to 30 x 0.05 is because 80 in is 30 dB louder than 50 in. +
-  +
-The G50 values are taken from the BEQx values (i.e. Equalizer parameters) for each channel/band as setup by Autofit. +
-==== Equalizer ====  +
-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 integer. This results in the following pseudo code:+
    
 <code csharp> <code csharp>
 +//--------------------------------------------
 +// Equalizer Formulas
 +//--------------------------------------------
 BEQx_60in = BEQx_autofit - Round((10 * 0.05 * CRi_autofit) / 2);  // assuming Round() does rounding to the nearest integer, NOT truncation 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);   BEQx_80in = BEQx_autofit - Round((30 * 0.05 * CRi_autofit) / 2);  
 </code> </code>
    
 +
 +==== 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: 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:
  
Line 53: Line 68:
 BEQ12_60in = BEQ12_autofit - Round((10 * 0.05 * CR8_autofit) / 2);  // also uses CR8 BEQ12_60in = BEQ12_autofit - Round((10 * 0.05 * CR8_autofit) / 2);  // also uses CR8
    
-// now we set the CRi to 0, which results in a CR of 1:1...linear condition+//---------------------------------------------------------------  
 +// Set Compression to Linear (CR 1:1), i.eset the CRi = 0 
 +//--------------------------------------------------------------- 
 for i = 1 to 8 do begin for i = 1 to 8 do begin
    CRi = 0;    CRi = 0;
Line 79: Line 96:
 BEQ12_80in = BEQ12_autofit - Round((30 * 0.05 * CR8_autofit) / 2);  // also uses CR8 BEQ12_80in = BEQ12_autofit - Round((30 * 0.05 * CR8_autofit) / 2);  // also uses CR8
    
-// now we set the CRi to 0, which results in a CR of 1:1...linear condition+//---------------------------------------------------------------  
 +// Set Compression to Linear (CR 1:1), i.eset the CRi = 0 
 +//--------------------------------------------------------------- 
 for i = 1 to 8 do begin for i = 1 to 8 do begin
    CRi = 0;    CRi = 0;
Line 86: Line 105:
 // all done setup80 // all done setup80
 </code> </code>
- 
 ==== Compression ====  ==== 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. 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. 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. 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. 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, So,
 <code csharp>  <code csharp> 
Line 122: Line 141:
 </code> </code>
    
-Please double check that we are setting the TKs to index 2 (50dB).+
    
  
 === Summary === === Summary ===
    
-The setup60 and setup80 routines calculate the inital EQ settings for each optimisation based on the Autofit values (and all CRs are set 1:1) using the following formulas:+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:
 <code> <code>
 BEQx_60in = BEQx_autofit - Round((10 * 0.05 * CRi_autofit) / 2);  // Assuming Round() does rounding to the nearest integer, NOT truncation 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);   BEQx_80in = BEQx_autofit - Round((30 * 0.05 * CRi_autofit) / 2);  
 </code> </code>
- +
 These gains are lower then the Autofit values, but because compression is being turned off, the gains should be appropriate for each input condition. 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: 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:
 <code> <code>
 BEQi_best = BEQi_optimized60 + Round((10 * 0.05 * CRi_optimized) / 2);    // Assuming Round() does rounding to near integer BEQi_best = BEQi_optimized60 + Round((10 * 0.05 * CRi_optimized) / 2);    // Assuming Round() does rounding to near integer
 </code> </code>