private static int getSoValueInputIndex(int sampleIndex) {
    int soIndex = sampleIndex / 2;
    int inputIndex = 16615 + (soIndex / 154) * 3251;
    soIndex %= 154;
    if (soIndex < 124)
      return inputIndex + soIndex * 25;
    else if (soIndex < 143)
      return inputIndex + 3100 + (soIndex-124) * 3;
    else if (soIndex == 143)
      return inputIndex + 3157;
    else if (soIndex < 150)
      return inputIndex + 3161 + (soIndex-144) * 13;
    else
      return inputIndex + 3239 + (soIndex-150) * 3;      
  }