   Serial.print(velocity, DEC);
   Serial.println();
 
-  sine1.frequency(note2freq(note));
-  sine1.amplitude(0.5);
+  byte voice = allocateVoice(note);
+  float fund = note2freq(note);
+  
+  switch (voice) {
+    case 1:
+      sine1.frequency(fund);
+      sine2.frequency(fund * 0.5);
+      sine3.frequency(fund * 1.5);
+      envelope1.noteOn();
+      break;
+    case 2:
+      sine4.frequency(fund);
+      sine5.frequency(fund * 0.5);
+      sine6.frequency(fund * 1.5);
+      envelope2.noteOn();
+      break;
+    case 3:
+      sine7.frequency(fund);
+      sine8.frequency(fund * 0.5);
+      sine9.frequency(fund * 1.5);
+      envelope3.noteOn();
+      break;
+    case 4:
+      sine10.frequency(fund);
+      sine11.frequency(fund * 0.5);
+      sine12.frequency(fund * 1.5);
+      envelope3.noteOn();
+      break;
+  }
 }
 
 void OnNoteOff(byte channel, byte note, byte velocity) {


  AudioMemory(8);
  audioShield.enable();
  audioShield.volume(0.45);

  sine1.frequency(220);
  sine1.amplitude(0.4);
  
  usbMIDI.setHandleNoteOff(OnNoteOff);
  usbMIDI.setHandleNoteOn(OnNoteOn);
  usbMIDI.setHandleVelocityChange(OnVelocityChange);

#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioSynthWaveformSine   sine1;          //xy=339,52
AudioSynthWaveformSine   sine2;          //xy=339,88
AudioSynthWaveformSine   sine3;          //xy=339,124
AudioSynthWaveformSine   sine4;          //xy=340,174
AudioSynthWaveformSine   sine5;          //xy=340,209
AudioSynthWaveformSine   sine6;          //xy=340,244
AudioSynthWaveformSine   sine7;          //xy=340,291
AudioSynthWaveformSine   sine8;          //xy=341,327
AudioSynthWaveformSine   sine9;         //xy=341,412
AudioSynthWaveformSine   sine10;         //xy=341,483
AudioSynthWaveformSine   sine11;          //xy=342,363
AudioSynthWaveformSine   sine12;         //xy=342,447
AudioMixer4              mixer1;         //xy=459,325
AudioMixer4              mixer2;         //xy=461,90
AudioMixer4              mixer3;         //xy=461,208
AudioMixer4              mixer4;         //xy=461,444
AudioEffectEnvelope      envelope1;      //xy=591,90
AudioEffectEnvelope      envelope2;      //xy=591,208
AudioEffectEnvelope      envelope3;      //xy=593,326
AudioEffectEnvelope      envelope4;      //xy=596,444
AudioMixer4              mixer5;         //xy=759,274
AudioOutputI2S           i2s1;           //xy=887,273
AudioConnection          patchCord1(sine1, 0, mixer1, 0);
AudioConnection          patchCord2(sine2, 0, mixer1, 1);
AudioConnection          patchCord3(sine3, 0, mixer1, 2);
AudioConnection          patchCord4(sine4, 0, mixer2, 0);
AudioConnection          patchCord5(sine5, 0, mixer2, 1);
AudioConnection          patchCord6(sine6, 0, mixer2, 2);
AudioConnection          patchCord7(sine7, 0, mixer3, 0);
AudioConnection          patchCord8(sine8, 0, mixer3, 1);
AudioConnection          patchCord9(sine9, 0, mixer3, 2);
AudioConnection          patchCord10(sine10, 0, mixer4, 0);
AudioConnection          patchCord11(sine11, 0, mixer4, 1);
AudioConnection          patchCord12(sine12, 0, mixer4, 2);
AudioConnection          patchCord13(mixer1, envelope1);
AudioConnection          patchCord14(mixer2, envelope2);
AudioConnection          patchCord15(mixer3, envelope3);
AudioConnection          patchCord16(mixer4, envelope4);
AudioConnection          patchCord17(envelope1, 0, mixer5, 0);
AudioConnection          patchCord18(envelope2, 0, mixer5, 1);
AudioConnection          patchCord19(envelope3, 0, mixer5, 2);
AudioConnection          patchCord20(envelope4, 0, mixer5, 3);
AudioConnection          patchCord21(mixer5, 0, i2s1, 0);
AudioConnection          patchCord22(mixer5, 0, i2s1, 1);
AudioControlSGTL5000     audioShield;     //xy=132,494
// GUItool: end automatically generated code

void setup() {
