         return;
     }
 
+    if (++numKeysDown == 1) {
+        float freq = pow(2.0, (note - 69) / 12.0) * 440;
+        percussion.frequency(freq * 2);
+        percussionEnv.noteOn();
+    }
     keys[key] = 1;
     manual_fill_volumes(keys, drawbars, volumes);
     tonewheels.setVolumes(volumes);

#include "tonewheel_osc_audio.h"
#include "vibrato_audio.h"

TonewheelOsc tonewheels;
Vibrato vibrato;
Preamp preamp;
AudioFilterBiquad antialias;
AudioOutputI2S i2s1;

AudioConnection patchCord0(tonewheels, 0, vibrato, 0);
AudioConnection patchCord1(vibrato, 0, preamp, 0);
AudioConnection patchCord2(preamp, 0, antialias, 0);
AudioConnection patchCord3(antialias, 0, i2s1, 0);
AudioConnection patchCord4(antialias, 0, i2s1, 1);
AudioControlSGTL5000 audioShield;

uint8_t keys[62] = {0};
uint8_t drawbars[10] = {0};
uint16_t volumes[92] = {0};

void handleNoteOn(byte chan, byte note, byte vel);
void handleNoteOff(byte chan, byte note, byte vel);


        return;
    }

    if (--numKeysDown == 0) {
        percussionEnv.noteOff();
    }
    keys[key] = 0;
    manual_fill_volumes(keys, drawbars, volumes);
    tonewheels.setVolumes(volumes);
