SimpleAudioPlayer + sleep function I have tested the SimpleAudioPlayer example.

https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer

This works fine, but when I add a sleep(1000) at the end of the loop() function, the music sounds dismembered (second run).

void loop()
{
    // ... source from the example 

    myFile.close();
    Serial.println("End of file. Thank you for listening!");

    sleep(1000);
}


Does anyone have any idea on how to resolve this?
sleep() is something different. You are probably want to use delay(1000) instead.

sleep() comes from libsam and is not very well documented for use within the Arduino environment. There is probably a conflicting timer or interrupt between sleep() and the Audio.h library. So sticking with delay() is probably your best option.