Recognition of the signal duration from the sensor
I don't see where you are even attempting to detect the long condition in your code.
First of all you need determine what constitutes a long vs. a short detection.  My recommendation is to write your code to do the following:

Initial detection.
Wait for your &quot;short&quot; interval.  If the detection is gone, then you know it was a &quot;short&quot; one and you can play your short music.
If the detection is still there, wait for the remainder of the time for your &quot;long&quot; detection.
If the detection is gone you know it was a &quot;short&quot; one since it didn't make it to the &quot;long&quot; state.  So play your &quot;short&quot; song.
Play your &quot;long&quot; music since the detection lasted for the duration of the long interval.

I'll leave the actual coding of that to you.  I'll also add that doing it this way, that is using the built-in delay() function is probably not the best approach overall.  The issue is that delay() blocks your loop() function and prevents you from doing anything else while it's delaying.
A better approach is to implement this as a state-machine coupled with an timer-driven interrupt.  That will give you much better control over your detections and also allow you do handle other inputs or set other outputs while you are waiting for detections to occur.
There are many resources online that discuss how to configure and handle AVR timers and their interrupts and there are also many resources discussing state machines and programming them in C.