Random readings on sound sensor

You are very infrequently sampling the microphone, so of course the results seem random.

  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability

Just printing out "sensorValue" at 9600 Baud slows the program down enormously, and of course, the idiotic delay() doesn't do you any good.