user11381: 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?

user11086: 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.

11381: <p>I have tested the SimpleAudioPlayer example.</p>

<p><a href="https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer" rel="nofollow">https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer</a></p>

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

<pre><code>void loop()
{
    // ... source from the example 

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

    sleep(1000);
}
</code></pre>

<p>Does anyone have any idea on how to resolve this?</p>
 11086: <p><code>sleep()</code> is something different. You are probably want to use <code>delay(1000)</code> instead.</p>

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