 unsigned int signalMin[pinCount] = {1024};
 unsigned long startMillis = millis();
 
-int silenceSamples = 60;
-int soundSamples = 60;
-int silenceThreshold = 880;
-int silenceCapacitor = silenceSamples;
-int soundCapacitor = 0;
-int soundThreshold = 990;
+int silenceThreshold = 800;
+int soundThreshold = 930;
+int nrOfConsecutiveSilenceSamplesBeforeFlippingToSound = 30;
+int nrOfConsecutiveSoundSamplesBeforeFlippingToSilence = 60;
+int silenceSampleCounter = 0;
+int soundSampleCounter = 0;
+
 int currentState = 0;
 
-
-int threshold = 700; //in mV
-int capacity[pinCount] = {0};
-int thresholdCapacity[pinCount] = {0};
 int currentSoundState[pinCount] = {0};
 
 bool debug = false;

/* Function prototypes -------------------------------------------------------*/
void updateState(int pin, int state);
void sendSoundState(int pin, int state);
void readIncommingNodeData();
void sendSoundLevels();
void checkSoundStates();

/* Variables -----------------------------------------------------------------*/
#define NodeSerial Serial1 // makes it a little easier to read the code :-) NodeSerial is the serial port that communicates with Node.js, accesible as /dev/ttyATH0 in Linux

}




