Arduino microphone sensor analog + digital

I tried a small arduino microphone recently:

int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
 
void setup () 
{
  pinMode (ledPin, OUTPUT);
  Serial.begin (9600);
}
 
void loop () 
{
  sensorValue = analogRead (sensorPin);
  digitalWrite (ledPin, HIGH);
  delay (sensorValue);
  digitalWrite (ledPin, LOW);
  delay (sensorValue);
  Serial.println (sensorValue, DEC);
}

Output looks like that:

22
20
22
22
22
21
22
22
21
22
22
22
22
22
22
22
21
22
22
21

 

Well explaination how sound sensors work:

Youtube Video