       pattern += b;
     }
     Serial.println(pattern);
-    patterns[instrument] = pattern;
+    patterns[tag] = pattern;
   }
 }
 
-void playSample(String msg) {
+void playSample(String sampleName) {
   Process p;
-  p.runShellCommandAsynchronously("madplay "+sampleFolder+msg);
+  p.runShellCommandAsynchronously("madplay " + sampleFolder + sampleName+".wav");
 }
+
+void playDrumSample(String sampleName) {
+  
+  }

#include <Process.h>


String instruments[] = {"PS", "BD", "SD","KI","SN","CR"};
//PS: play sample, BD: bass drum, SD: snare, KI: kick,SN: snare, CR: crash
const int numIns = 6;
byte patterns[numIns-1];
// length
const int patternL = 8;


  if (time > nextB) {
    nextB += nextBInc;
    for (int i = 1; i < numIns; i++) {
      if (patterns[i - 1] & bs[pos])
        Serial.print(hashTags[i]);
      else
        Serial.print("..");
      Serial.print("-");
    }
    Serial.println("");
    pos = (pos + 1) % patternL;
