From QB64 Wiki
The _SNDLIMIT statement stops playing a sound after it has been playing for a set number of seconds.
- _SNDLIMIT (handle&, limit!)
- Sets how long a sound will be played in seconds.
- Set limit to 0 to remove the limit.
- Cannot be set for playing a looping sound.
_SNDLIMIT h&, 5.5