Sometimes it is useful to know the length of a wave file without having to manually check it. Since LB has no native function for determining the length of a wave file, it is useful to have a custom function for this purpose.
FUNCTION WaveLength(wave$)
if wave$ = "" then exit function
starttime = time$("ms")
playwave wave$, sync
endtime = time$("ms")
time = starttime - endtime
END FUNCTION
It is important to note that this function will not report the correct time if the date changes while the wave is being played.
FUNCTION WaveLength(wave$) if wave$ = "" then exit function starttime = time$("ms") playwave wave$, sync endtime = time$("ms") time = starttime - endtime END FUNCTIONIt is important to note that this function will not report the correct time if the date changes while the wave is being played.