Odd midi problem

Started by Alynn, Tue 30/03/2004 05:04:49

Previous topic - Next topic

Alynn

Ok I am using a certain midi in my game, the midi itself works fine, and is stopped using a StopMusic() command... however after that all my other midi's sound... strange.... almost as if the first midi had a certain controller event that didn't get fully released when StopMusic is called, messing up all of the following midi's.

I looked around for other midi's of the same song, but they were all either had the same problem (same midi). Or they wouldn't play at all on AGS...

the midi that causes the problem (if i take the midi out and don't play it the problem with the others never occurs) can be found here

The second one on the same website doesn't play at all on AGS for some reason... (this is the website which I got the midi

Thanks for the help...

Ryukage

Quote from: Alynn on Tue 30/03/2004 05:04:49
Ok I am using a certain midi in my game, the midi itself works fine, and is stopped using a StopMusic() command... however after that all my other midi's sound... strange.... almost as if the first midi had a certain controller event that didn't get fully released when StopMusic is called, messing up all of the following midi's.

From your description, I think that's exactly what's happening - the midi controllers aren't getting reset.  RPGMaker 2000/2003 and Winamp 5 both have similar problems.  I think the real culprit is probably DirectMusic, because Winamp didn't have the problem until they started playing through DM.  I haven't bothered to try changing Winamp back to regular output to test my theory, however.
Ninja Master Ryukage
"Flipping out and kicking off heads since 1996"

Pumaman

Strange - I have to admit I don't know much about the MIDI player so I may not be able to fix the problem, but I'll take a look.

Dave Gilbert

Hey there,

Was this ever sorted out?  I am having the same issue too.  Whenever I switch from one MIDI to another, the music gets all wonky and sounds like it's reverberating.

Appreciate any tips. Thanks!

-Dave

modgeulator

You could try playing this after the troublesome file:
http://www.midihaven.addr.com/midi/gm_reset.mid

Dave Gilbert

Hm, nope.  That didn't work.

The problem occurs when switching from one room to another with a different midi track.  I tried playing the "silent" midi file when entering the new room, and then setting up a queue to play the correct music track when it was finished, but it still sounded funny.

I tried it out on another computer and the same problem occurs.



Dave Gilbert

Thanks.  I'll give it a go when I get home.

Just for my own curiousity, could you tell me what this file is?  Is it just a "silent" midi file?  What does it do, exactly, that solves the problem?

Pumaman

No sorry, I haven't had a chance to look at this yet.

Dave Gilbert

modgeulator:

That second silent midi file doesn't work either.

I remember some folks complaining about this problem with BoE, but not everyone.  So I assume that it only happens on certain computers.  Could it be a sound card thing?  Or the way AGS interprets the MIDI on my computer?

Thanks for the help,

modgeulator

Quote from: Dave Gilbert on Wed 21/04/2004 16:37:42
Thanks.  I'll give it a go when I get home.

Just for my own curiousity, could you tell me what this file is?  Is it just a "silent" midi file?  What does it do, exactly, that solves the problem?
Sure, the first one was just something I found on the web, all it contains is an instruction that tells your MIDI synth to reset itself. The second one I made used the reset instruction from the first file along with individual commands to set each channel's reverb, chorus and pitch bend to 0.
You said it sounded like it was "reverberating." If that didn't fix it, I don't really know anything else you could do.
The main problem I've had with MIDI playback in AGS was with the timing going wonky. To fix this I lowered the ticks resolution on the files.
To do this I loaded the files into a freeware sequencer I found called Jazz++. Then clicked "Settings: Song" and set "ticks per quarter note" to the lowest setting and re-saved the file. Since you're problem is to do with a reverb effect, this probably won't help you at all.

Dave Gilbert

Not sure if "reverb" is the best way to describe it.  It's hard to explain.  It's almost as if the first note continuously echos throughout the song, getting louder and louder until it it drowns out the music.  Does that help?

modgeulator

OK, sounds like a stuck note. Every MIDI command  has a "note on" event followed by a "note off" event. If you're unlucky enough, the "note off" gets lost somehow and you get a stuck note. So I added "all notes off" controllers to the reset MIDI.

Third time lucky: http://members.iinet.net.au/~snderson/reset3.MID

Dave Gilbert

#13
*sigh*

Still isn't working. :(

Maybe I'm not incorporating the midi file correctly.  Here's the code I'm using, where music7 is the "reset" file and music2 is the proper music track:

SetMusicRepeat(0);
PlayMusic(7);    
while ( IsMusicPlaying() )
     Wait(1);
SetMusicRepeat(1);
PlayMusic(2);

Also, I compiled a section of the game where I am having the problem.  If anyone can take a look at it, maybe it'll help decipher what's wrong:

http://www.davelgil.com/ags/RON/prayer.zip

The first room sounds fine.  The problem starts when you get to the next room.

Spoiler

To get to the next room, pick up the bible from the bench and use it on the Sherriff.  Then climb out the window.
[close]

modgeulator

I tried it out and it's doing that for me also in the second room. You could post the two MIDI files if you like, there might be some weird controller being used in there.

I'd change the code to this, so it doesn't pause the game while the first MIDI plays. Doubt it will fix things though:

StopMusic();
SetMusicRepeat(0);
PlayMusicQueued(7);
SetMusicRepeat(1);
PlayMusicQueued(2);

Dave Gilbert

Thanks modgeulator.  Here are the links:

The interior music
Exterior music

The "Exterior" midi is the one that gets all wonky.  I notice that when I START the game in the room with the music, it plays fine.  

modgeulator

#16
OK, the interior music (music6.mid) is doing some tricky stuff with a "sustain" controller. This must be what needs to be reset.
I've edited the exterior music so it resets the sustain controller on each channel, I'm pretty sure it should fix it this time:
http://members.iinet.net.au/~snderson/music2-sustainreset.MID

And here's also an updated version of the reset MIDI that now resets sustain controllers as well, if anyone needs it:
http://www.2dadventure.com/ags/reset4.mid

Damn MIDI can be a pain in the butt sometimes  ::)

Alynn

#17
Yeah I figured out how to fix my problem before I deployed but went to Iraq before I could post, I just removed the reverb controller track from the midi and it worked fine (it really didn't affect the quality of the song at all)...

Pumaman, when you have time of course, you may want to see if you can force a reset of the midi device if stop music is called and a midi is playing (or if it wont affect it, even if a midi isn't playing).

Actually since I'm in Iraq and dont have my midi editing tools or AGS for that matter, if someone could try pitch bends and the like on a song and use stopmusic and see if it resets, if it does, maybe it's just the sustain that doesn't get reset upon the command of StopMusic... (help da pumaman wif some trouble shooting, ja?)

Ya know, I don't know what I'm TXT style spelling, but I don't do it on purpose I swear!

Dave Gilbert

Modgeulator:

The new reset-midi file works like a charm.  The exterior music now plays normally.  Thanks so much for the help!  You rock the proverbial casbah.


Pumaman

modgeulator: as you understand MIDI, could you give me some advice here?

When a MIDI track finishes, AGS currently sends the MIDI controller the commands 120 (All Sound Off) and 123 (All Notes Off).

Would the addition of 121 (All Controllers Off) also get rid of all these various effects, or would it need to do a channel-by-channel Sustain Off thing?

SMF spam blocked by CleanTalk