Fading out audio?

BlitzMax Forums/BlitzMax Programming/Fading out audio?

Hey guys,

Is there a method for fading out an audio track?

Something like this
chan:TChannel = AllocChannel()
mySfx:TSound = LoadSound("song3.ogg")
chan = PlaySound(mySfx)

tmpVol# = 1
Repeat
	If MilliSecs() >= fadeTime + 100 Then
    	     SetChannelVolume chan, tmpVol
     	     tmpVol:-.02
	     fadeTime = MilliSecs()
	EndIf
	
Delay 10
Until KeyDown(KEY_ESCAPE) Or tmpVol <= 0


How would a program be able to find the duration of an audio file?