Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 06/02/2007 04:18:38

Title: MIDIs absolutely refuse to play (Solved)
Post by: on Tue 06/02/2007 04:18:38
Okay, I'm probably making some sort of ridiculous newbie mistake - probably - but I cannot for the life of me get MIDIs to play in my game. I've tried renaming them to all-caps/all-lowercase, I've tried putting them in just about every conceivable folder in the game directory, I've fiddled with all the sound settings nine times over and I've rewritten the script twice as many times.

I can play the files fine in Winamp/WMP. Other AGS games with MIDI music work perfectly. MP3s play just fine. And yet, when I run the game, they don't play. :-\

Any insight? This would be positively maddening if weren't so weird...
Title: Re: MIDIs absolutely refuse to play
Post by: AdamM on Tue 06/02/2007 04:32:34
How Bizarre (By OMC).

For the record, all music/sound files should be in the project folder (not the AGS folder or the Compiled folder). MIDI files should be named MUSIC0.mid, MUSIC1.mid, etc. You then call those files in your game by scripting the function PlayMusic(int), where int is the number of music file you want to play (0, 1, etc.).

Also bear in mind that AGS searches for MP3s first, and then MIDIs second. If you are naming your files based on file type seperately, such as having a MUSIC1.mp3 and a MUSIC1.mid, the MUSIC1.mid will never be played. You must give each file a seperate number.

You say you've done all this?
Title: Re: MIDIs absolutely refuse to play
Post by: on Tue 06/02/2007 05:01:22
Yup. Triple-checked it just now, as well; no dice.
Title: Re: MIDIs absolutely refuse to play
Post by: Gilbert on Tue 06/02/2007 05:15:57
Make sure that the option "hide known extensions" (or whatever it's called, I'd never used a native English version of windows) in Explorer is not enabled, otherwise you need to be careful in the filenames in case they might be named something silly like music1.mid.mid .

Also, check the setup of your games and make sure that it's using a valid MIDI output device of your computer.
Title: Re: MIDIs absolutely refuse to play
Post by: on Tue 06/02/2007 05:26:42
Check and check. Still nothing.
Title: Re: MIDIs absolutely refuse to play
Post by: Khris on Tue 06/02/2007 11:37:30
For the record, all music files should be in the Music folder (not the project folder).

Could you upload one of the midis so we can check if the file itself is faulty?
http://www.2dadventure.com/ags/upload/upload.html
Title: Re: MIDIs absolutely refuse to play
Post by: on Tue 06/02/2007 19:51:02
Moved it back into the Music folder and recompiled; no change.

Here's the file, (http://www.2dadventure.com/ags/MUSIC1_notworking.mid) if anyone wants to take a look at it, although I'm starting to get sick of it at this point. I'll try fiddling around with some other MIDIs in the meantime.
Title: Re: MIDIs absolutely refuse to play
Post by: Scorpiorus on Tue 06/02/2007 20:26:48
I've just tried playing the file and it worked fine for me.

Try renaming it to "MUSIC0.MID". This way it should play on game start, it's just to make sure it's not a game logic problem.

Also, what version of AGS are you using?
Title: Re: MIDIs absolutely refuse to play
Post by: Mr Flibble on Tue 06/02/2007 20:29:17
I had this problem once, no idea what caused it. It was fixed by opening the MIDI file in an editing program and then saving it again.

I recommend Noteworthy Composer but I guess you could use anything at all.
Title: Re: MIDIs absolutely refuse to play
Post by: on Tue 06/02/2007 21:26:36
Just tried both renaming and resaving it with Noteworthy; no change at all. This is approaching Twilight Zone territory.

As for what version I'm using - 2.72. I've also tried deleting it and reinstalling, also with no results.
Title: Re: MIDIs absolutely refuse to play
Post by: Scorpiorus on Tue 06/02/2007 21:44:45
Ok, I made a test game for you to try: http://www.geocities.com/scorpiorus82/miditest.zip (686Kb, right click/save as or copy and paste)

Try compiling it with AGS v2.72 and run.

The music should start playing after a few seconds (that's how it was composed).

Also, there is a PreCompiled folder where I put a compiled version of the game, try it as well.

Let us know how it goes.
Title: Re: MIDIs absolutely refuse to play
Post by: on Tue 06/02/2007 23:22:55
Hmm. Neither the precompiled version nor the one I compiled will play the music. I think we're getting somewhere... but I'm not entirely sure where we're getting.
Title: Re: MIDIs absolutely refuse to play
Post by: Scorpiorus on Wed 07/02/2007 00:14:00
Well, it might then be some sort of hardware and/or operating system incompatibility. DirectX version should also be taken into account.

What operating system version do you run?

Have you had any success playing other MIDI files?

For instance, I am on Win2k so I don't know whether it would play on another OS.

By the way, I take it you checked not only the global volume but also the one for Sound Synthesizing Device?

Additionally, if you run any media players (eg: WinAmp) on the background, I'd suggest turning them off (maybe even end all their processes, such as WinAmp Agent etc).
Title: Re: MIDIs absolutely refuse to play
Post by: on Wed 07/02/2007 03:42:54
Aha! I've run a few experiments, and I've come to the conclusion that, for some utterly incomprehensible reason, Windows Media Player - the very player I was using to verify whether or not the MIDIs would play - mutes my Synth channel every time it closes. So it kept re-breaking in the process of trying to track down the cause of why it was broken in the first place. Mystery solved!

Thank you all so very, very much; I probably would never have figured that out myself. WMP is a tricky, tricky thing and I don't think I'll be using it to test MIDIs in the future...
Title: Re: MIDIs absolutely refuse to play
Post by: AdamM on Wed 07/02/2007 04:20:47
Quote from: KhrisMUC on Tue 06/02/2007 11:37:30
For the record, all music files should be in the Music folder (not the project folder).
Well I apologise for my misinformation then. I still use 2.70.
Title: Re: MIDIs absolutely refuse to play (Solved)
Post by: NiksterG on Sat 03/03/2007 03:30:34
Okay, I'm really sorry to bring this thread up to the front again after it seemed to be solved, but I have a question. This has been happening to me, too, and I noticed that the midis only play while WMP is on in the background. Assuming that Aesir's conclusion is correct, how would I disable the muting of the synth channel after turning off WMP? Or do I have to check it manually each time before I launch my game?  ???

Again, sorry I'm bringing this to the front again, but I figured it'd probably be better to post here than to make a whole new thread.
Title: Re: MIDIs absolutely refuse to play (Solved)
Post by: Gilbert on Sat 03/03/2007 15:48:35
Are you really sure that the MIDI device is not muted in your mixer setting?

Note that when you double click the mixer icon on your taskbar to bring it up, sometimes for some reasons a device is not shown on it, so you don't see it actual settings. Selecting Option -> Properties from there should bring up a list on which devices to be shown.