Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MCISendString can't play large mid file(3MB)

Status
Not open for further replies.

Vizion01

Programmer
Jun 4, 2003
9
0
0
US
Hi guys,

I'm using MCIsendString to play a midi file but it seems that the command is very picky about the file size. I used a sample of small mid file(42KB) and it works fine. But after I put in 3MB mid file size, no sound is produced. Both have same file extension. I don't see what's wrong except the file size.

What do you guys suggest?

Thanks. :)
 
First of goto and get the file description and make sure that your big file is what it is supposed to be, or double click on it and see if your default midi player can play the file. You also may have a memory limitation.

Good Luck
 
Just getting curious, would you tell what is the duration of the file you want to play if it is really a midi file?
 
Hi,

My WMP can play the file perfectly fine. It's only 35 seconds of duration so I go for all(from beginning to the end). My midi file is 3.69MB in .MID format, if I convert it to .MP3 format, the file size reduced to 363KB. But I'm not sure the MCISendString can read .MP3 format.

What else can you guys suggest?

Thank you.
 
Well, if the duration of the file is only 35 seconds, I do not think it is actually a midi file. It may be a wave file which has been renamed to .mid extension.

WMP is clever enough that it detects the correct media format despite of the wrong extension and uses the correct decoder required to play that file.

You may verify the file format by reading first few bytes of the file. All midi files begin with characters "MThd".
The following small program reads the first four characters of the file and checks them if they are "MThd".
___
[tt]Option Explicit

Function IsMidi(FileName As String) As Boolean
Dim sig As String * 4, FileNum As Integer
FileNum = FreeFile
Open FileName For Binary As #FileNum
Get #FileNum, , sig
Close
IsMidi = sig = "MThd"
End Function

Private Sub Form_Load()
MsgBox IsMidi("C:\windows\media\flourish.mid")
End
End Sub[/tt]
 
Hi,

Thanks for the code Hypetia. You're right about the conversion. It was in .wav and I used Nero Wave Editor to convert it into .mid extension. But guess what I tried out yesterday. This MCISendString can actually play .mp3 file. I inserted .mp3 and it played well. And the .mp3 file is small in size too. It's still 35secs but less than half of the floppy disk size.

Thank you very much, guys. I appreciated. [thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top