This a short snippet on how to play a Midi file:
note the included $metacommands..
attached is midiplay.zip which contains the midi player and midi.zip with some .mid files.
Code: (Select All)
Dim SoundHandle As Long
$Unstable:Midi
$MidiSoundFont:Default
Print "Enter midi file";
Input Midi$
Midi$ = UCase$(Midi$)
If Right$(Midi$, 4) = ".MID" Then
If _FileExists(Midi$) Then
Print "Playing.."
Print " Enter <space>=pause/+plus 10/-minus 10."
Print " Press <escape> to exit."
'_SndPlayFile Midi$
SoundHandle = _SndOpen(Midi$)
If SoundHandle Then
_SndPlay SoundHandle
Do
_Limit 50
x$ = InKey$
If Len(x$) Then
If x$ = Chr$(27) Then Exit Do
If x$ = "+" Then
z! = _SndGetPos(SoundHandle)
z! = z! + 10!
_SndSetPos SoundHandle, z!
End If
If x$ = "-" Then
z! = _SndGetPos(SoundHandle)
z! = z! - 10!
If z! < 0! Then z! = 0!
_SndSetPos SoundHandle, z!
End If
If x$ = " " Then
If _SndPaused(SoundHandle) Then
_SndPlay SoundHandle
Else
_SndPause (SoundHandle)
End If
End If
End If
Loop
End If
End If
End If
End
attached is midiplay.zip which contains the midi player and midi.zip with some .mid files.