It looks like you're new here. If you want to get involved, click one of these buttons!
using the sound processing library
I guess when you start playing set a new variable playingStartedAt to millis();
when (millis() - playingStartedAt) > duration your file has ended