Is the LED blinking?
It would be nice to know something about the sound sensor.* When you buy cheap stuff off eBay sometimes you don't get specs or a datasheet. It wouldn't hurt to send the soundsens value out to the serial port so you can see what you're getting. (See the Analog Read Serial Example.)
You're not using millis() and you can't read the sensor during the delay() time. Take-out the delay().
...The idea would be to read millis() every time through the loop but save the timer value (in a variable you create) only if sound is present. When there is no sound don't update that saved timer value.
When there is sound, the millis() value (current time) and the saved value will be very-close. When the sound stops, millis() will keep counting-up (as it always does) but the saved value won't be updated.
Subtract those two values (every time through the loop). If the time difference is greater than 10,000ms, turn-on the relay.
If you do nothing else and just keep running the loop, the time difference between the current time and the saved time will continue to grow and the relay will remain on. When there's sound again the time difference will go back to (almost) zero and the relay will turn off.
- There are 3 kinds of sound sensors (and some that work more than one way).:
-
Some put-out a digital-high when the signal is above the threshold and a digital-low when below the threshold.
-
Some put-out a biased & amplified analog audio waveform. (They are biased because the Arduino can't directly read the negative half of an AC audio signal. These will put-out 2.5V with silence which reads about 512 on the ADC).
-
Some put-out a varying 0 - 5V DC voltage that's proportional to loudness.
P.S.
You might want to START with a simple program that turns-on the LED whenever sound is present (with no timing). Then reverse the logic to turn the LED off when sound is present. Then add the timing to ignore short periods of silence.