 }
 
 unsigned long last_time = millis();
+
+// Keep track of the frame count so we can read inputs less often.
+byte frameCount = 0;
+
+// How often to read inputs.
+byte frameStep = 8;
+
 void loop() {
 
   // Change this to if(1) for measurement output every 2 seconds

  digitalWrite(multiplexAPin, LOW);
  delayMicroseconds(propagationDelay);

  //  readAdditionalInputs();

  // Synth osc 1
  value = readSelectorPin(multiplexInputPin1);

  if (value != p0) {
    p0 = value;

    switch (p0) {
      case 0:
        synth.setWaveForm1(WAVEFORM_SINE);
        break;

      case 1:
        synth.setWaveForm1(WAVEFORM_TRIANGLE);
        break;

      case 2:
        synth.setWaveForm1(WAVEFORM_SAWTOOTH);
        break;

      case 3:
        synth.setWaveForm1(WAVEFORM_SQUARE);
        break;

      case 4:
        synth.setWaveForm1(WAVEFORM_CELLO);
        break;

      case 5:
        synth.setWaveForm1(WAVEFORM_PIANO);
        break;

      case 6:
        synth.setWaveForm1(WAVEFORM_EORGAN);
        break;
    }
  }

  // Filter envelope attack
  value = analogRead(multiplexInputPin2);
  synth.setFilterEnvelopeAttack(fscale(1, 1023, 1, 2000, value, -5));

  // LFO amplitude
  value = analogRead(multiplexInputPin3);


  /**
   * Multiplexer pin 6
   */
  digitalWrite(multiplexCPin, HIGH);
  delayMicroseconds(propagationDelay);
  readInputKeyRow(81);

  // Tap tempo
  value = analogRead(multiplexInputPin1);

  // Amplitude envelope release
  value = analogRead(multiplexInputPin2);
  synth.setAmpEnvRelease(fscale(1, 1023, 1, 2000, value, -5));

  // LFO target
  value = readSelectorPin(multiplexInputPin3);

//  if (value >= 512) {
//    synth.setFilterLFOAmount(fscale(512, 1023, 0, 3, value, -3));
//  }
//  else {
//    synth.setAmplitudeModulationLFOAmount(fscale(1, 512, 1.0, 0.0, value, 3));
//  }


  /**


  readInputKeyRow(67);

  if (frameCount % frameStep == 5) {

    // Detune
    int value = analogRead(multiplexInputPin1);
    // 1.0293022 = 24th root of 2 = quarter-step.
    float detune = fscale(1, 1023, 1, 1.0293022, value, 0);
    synth.setDetune(detune);

    // Amplitude envelope decay
    value = analogRead(multiplexInputPin2);
    synth.setAmpEnvDecay(fscale(1, 1023, 1, 2000, value, -5));

    // Filter resonance
    value = analogRead(multiplexInputPin3);
    float res = fscale(1, 1023, 0.0, 5.0, value, 0);
    synth.setFilterResonance(res);
  }


  /**
