DrSlue
asked on
Midi Files: finding the length?
Hi guys. I need to know how to call the length of a midi file, so that i can create some other functions for a program that i am making for a few of my friends.
I'm fairly new to VB, so i don't know too much of the complex stuff, but here goes. I'm using a system (i believe it's called API) to play the midi files, and the syntax is like this:
i = mciSendString("play mid1 from 0", 0&, 0, 0)
Is it possible to call the length of a midi while using this method? Any help would be much appreciated!
I'm fairly new to VB, so i don't know too much of the complex stuff, but here goes. I'm using a system (i believe it's called API) to play the midi files, and the syntax is like this:
i = mciSendString("play mid1 from 0", 0&, 0, 0)
Is it possible to call the length of a midi while using this method? Any help would be much appreciated!
If you mean the length of the music then try this:
1. Add a reference to the ActiveX-Control MCI32.OCX (Microsoft Multimedia Control).
2. Insert an instance of the Control on a form.
3. Try this
Private Sub Form_Load()
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "Sequencer"
MMControl1.FileName = "C:\WINDOWS\MEDIA\PASSPORT .MID"
MMControl1.Command = "Open"
Debug.Print MMControl1.Length
End Sub
v.k.
1. Add a reference to the ActiveX-Control MCI32.OCX (Microsoft Multimedia Control).
2. Insert an instance of the Control on a form.
3. Try this
Private Sub Form_Load()
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "Sequencer"
MMControl1.FileName = "C:\WINDOWS\MEDIA\PASSPORT
MMControl1.Command = "Open"
Debug.Print MMControl1.Length
End Sub
v.k.
ASKER
Thanks! I'm finally getting some sort of output, but i was wondering what exactly that is outputting it in (unit wise).
I'm using this code:
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "Sequencer"
MMControl1.FileName = midi & ".mid"
MMControl1.Command = "Open"
lblLength.Caption = MMControl1.Length
Where midi is the current song playing e.g:
midi = "z64epona"
i = mciSendString("open " & midi & ".mid type sequencer alias mid1", 0&, 0, 0)
It displays it as being "660", but when i load it up in winamp to check, it displays it as 108 Seconds (1:48min).
SO could you or someone else please explain this a bit further.
I'm using this code:
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "Sequencer"
MMControl1.FileName = midi & ".mid"
MMControl1.Command = "Open"
lblLength.Caption = MMControl1.Length
Where midi is the current song playing e.g:
midi = "z64epona"
i = mciSendString("open " & midi & ".mid type sequencer alias mid1", 0&, 0, 0)
It displays it as being "660", but when i load it up in winamp to check, it displays it as 108 Seconds (1:48min).
SO could you or someone else please explain this a bit further.
Hi DrSlue,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Refund points and save as a 0-pt PAQ.
DrSlue, Please DO NOT accept THIS comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit. Explain why.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Refund points and save as a 0-pt PAQ.
DrSlue, Please DO NOT accept THIS comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit. Explain why.
==========
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
do you mean the length of the music or the length of the midi-file ?
v.k.