HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Playing MIDI's (Discovered how)

10-15-2002, 02:29 PM#1
BlacKDicK
K, I discovered how to play custom MIDI's on War3. The problem is that it requires either MPQ loading or direct-file-patching to work. My MPQ is about 3,3 MB and merged with latest 1.03 war3patch.mpq it turns to be 6 MB.

This is not that usefull as I tought it would be when I started researching, since it fits betterl to "campaings" like krill.

I also created a stupid map to demonstrate it. The usage is simple, just have to call an action before starting playing custom MIDI's (wich can then be included on the W3M).

Is someone here is interested, let me know. I also need some place to host it due to it's size, as explained above.
10-15-2002, 03:31 PM#2
BlacKDicK
Small Tutorial:

1) Open SOUND EDITOR -> IMPORT EXTERNAL MUSIC to import midi to the map. I know, it won't let you select .mid files, just .mp3. But if you type "*.mid" there it will let you import.

2) ADD a "Sound - Use Daytime Ambient Theme (Allow Custom MIDI)" action anywhere. Hint: Set it after latest Map Initialization Action.

3) USE "Sound - Play Music" to play the MIDI. (It will loop)

Fo more info, see the W3M sample.

ps: It is better to wait 1 or 2 secs to begin playing mid coz if you play it on map initialization event, it will make a "small jump" before getting played.
10-15-2002, 04:41 PM#3
weaaddar
Thats pretty neat But 6 megs is a bit large..

Can You explain How you did it? There just might be a custom text solution if I know how to do it that won't involving moding the UI and would Pretty much just allow you to play Midis.
10-15-2002, 09:14 PM#4
BlacKDicK
Sure. First of all I realized that the game has some MIDIs build-in.
If you extract them and play on Winamp, Media Player, you'll notice that they DO NOT sound the same as they do inside the game. There is "something" modifying the MIDIs.

The I opened "ui\soundinfo\midisounds.slk" and noticed an entry called "DLSFileName". After some research i discovered that "*.dls" files are "Sound Sets" to be used when playing MIDIs.
That's why the internal game MIDIs sound diferent within the game.

The I discoverd that the "Standard" sount set (Made by Roland, years ago) is instaled with Windows, named as "gm.dls". All I had to do was create another entry on "ui\soundinfo\midisounds.slk" and add "gm.dls" to the MPQ. Then i did a minor change to "UI\triggerdata.txt" and "UI\WorldEditSrings.txt" to enable it on WE.

My MPQ is then:

UI\SoundInfo\MidiSounds.slk
UI\triggerdata.txt
UI\WorldEditSrings.txt
Sound\Ambient\Roland\gm.dls

(It just got bigger coz it is merged with 1.03 patch).

The file is big due to the "gm.dls" file wich does just a small compression within the MPQ. There is also another way.....

On UI\SoundInfo\MidiSounds.slk we can refer to any dls OUTSIDE of the MPQ. Mine (Windows XP) is on "c:\windows\system32\drivers\gm.dls" and thus I would not need to add the gm.dls to the MPQ. The problem is that path, it is not the same on every computer (Guess what if I had instaled it on "c:\win\" instead of "c:\windows\".

If UI\SoundInfo\MidiSounds.slk could be added to W3M, we could generate one with the most-common pathing for the gm.dls and add just the MIDI and the UI\SoundInfo\MidiSounds.slk to the W3M.

Another idea is is to have a program to do a file-search on anyone's computer, looking for the gm.dls file and in case it is found, add it to the MPQ along with the proper changes on another files.
10-15-2002, 11:14 PM#5
weaaddar
I found probably what were after The trigger CreateMIDISound. It takes a music file and converts it to sound file (Thats what an ambient does.)
The problem is with what your saying, it isn't looking for a Soundhandle but rather an entry in the SLK. I inserted my FF7-Endless Battle Midi and playing with Northrend theme it sounded Very...bad.

I also tried setting the DLS to nothing. And no midis will play so that would be a bad thing.

My idea is simple hows about we as Wc3campaigns Create a small patch that merely finds and places gm.dls into your war3 directory then we create a patcher program which works similiary to my map protector merely adds the file to the map using MPQ2k (or if Zepir wants to show his programming muscle the Shadow Flare MPQ API).
And we create a GU Trigger like patch or force them to use CustoM Text I perfer the later as it requires less work on my behalf.

If we hype it we can easily infect this patch upon everyone Or maybe we can do the very reasonable Idea of complaining to blizzard but I think the patch method for wc3campaigns wouldn't
be bad at all.

So recap: You don't need to change your ambient you just need to use that CreateMIDIsound (and please I'm not exactly sure of all ist parameters right now just look it up in common.j).
10-16-2002, 12:59 AM#6
BlacKDicK
Quote:
create a patcher program which works similiary to my map protector merely adds the file to the map using MPQ2k


Problem is: gm.dls is about 3,3 MB. Adding it to maps would cut-off the main MIDI advantage: the file size.

"native CreateMIDISound takes string soundLabel, integer fadeInRate, integer fadeOutRate returns sound"

I didn't get it, weaadar. The first parameter is an entry in the SLK or the MIDI path?? I'm lost. Explain it. plz.
10-16-2002, 03:08 AM#7
weaaddar
No BD you said you don't need it in side the mpq, so just put it in the War3 directory (Then you just type in gm.dll in that entry), then all you have to do is add the SLK (which isn't that big).
For 4 minutes of music your saving a hell of alot vs an Mp3 which would be about 4 megs.
CreateMIDISound is looking for an Entry in the SLK. The entry tells it what DLS to use and what MIDI to play. The good thing about is all you have to do is. Just go set bj_dayAmbientSound (or whatever itscalled)= CreateMidiSound("Roland",20,20,20). That is basically what the blizz.j function. Then go Call PlaySound(bj_dayAmbientSound).
So it just set the Correct DLS set and since you tell it to play no midi it will do...just that play nothing. Now you hit Play Music your own Midi and it will use the correct DLS file.

Either that or you can enjoy Endless Battle Sounding like a bunch of crickets chirping (eww!).
10-16-2002, 05:57 AM#8
Electromancer
Probably a stupid question, but whats an midi? Is it a type of sound, or just the set of them that are in the game already? I dont mess with sounds much, so i wouldnt know.
10-16-2002, 09:27 AM#9
BlacKDicK
So we have 2 way of doing that:

set udg_so = CreateMIDISound("Roland",1,1)
call PlaySoundBJ( udg_so )
call PlayMusicBJ( gg_snd_Aces_High )

or

call SetAmbientDaySound("Roland")
call PlayMusicBJ( gg_snd_Aces_High )

I guess second is better coz requires only 2 actions, no "sound" variable, is auto-looping and plays better coz it plays "alone".

The first one plays both the "usual daytime" and our "music" at the same time using the gm.dls, wich turns to be weird coz the "usual daytime" was not designed to play using gm.dls

archersRcheap, MIDI are synthetic music with no voices and are really small (for an example, 4 mins and 30 secs of music can be as small as 60K). They DO NOT sound great as MP3 or WAV sounds, but can be really cool to be played as "background" music. They were / are used a lot on consoles. Think of them as "someone playing on a keyboard with no voices".
01-29-2003, 10:13 PM#10
Guest
Ok, sorry to dig this up out of the grave, but I am trying to get midis to work, since it will save a LOT of space on my map if I can figure out the method.

I get the import music as *.mid part and also the Play Music - use that mid.

I also believe I think I get the midisound.slk part..

You merely modify the .dls part to c:\windows\system32\drivers\gm.dls

I used the ashenvaleday slot changed ashenvale.mid to nothing
then I merely added the slk to the map w3m file..

But I see all this other stuff I don't quite understand:
common.j? blizzard.j and that call SetAmbientDaySound("Roland")?? CreateMidiSound("Roland",20,20,20). ??

Unfortunately, w3mcampaign's files are down and I can't see what you did. If you can explain what you did exactly. Perhaps a tutorial would be nice.

You said you modified the following files:
UI\SoundInfo\MidiSounds.slk
UI\triggerdata.txt
UI\WorldEditStrings.txt
Sound\Ambient\Roland\gm.dls

I guess I don't need gm.dls if i refer to the windows one..
and I included .slk
but what would I change in triggerdata and worldeditstrings?

Any help would be highly appreciated. Thanks
01-29-2003, 11:13 PM#11
weaaddar
A nice ancient refine. This was a long time back so I'll try to explain everything.
Okay
first I suggest you add an entry to your Midisound.slk we used the entry Roland because Roland is the creator of the Standard windows Digital Libary of Sounds (DLS).
The first step is to make it point to C:\windows\system32\drivers\gm.dls and also make the mid to play none. There is a problem with this, a VERY dire one unfortuantly, everyone playing your map must be using 2000 or XP or else they won't be able to hear your midi.
I was suggesting that we as wc3campaigns would create a little program that would find your GM.DLS and copy it to your warcraft3 root directory. If you decided to you can say that you have to move the file to the war3 directory to get sound.

This is the most important step I can imagine in this process importing some of your faviorite music!! Goto the sound editor and import sounds it won't let you chose midi, but type *.* or *.mid and it will let you. Selec the mid of chose and now the next step.

Now heres why your going to go into Custom Text. Forget about modifying TriggerData.txt
First go into trigger editor and make a simply gui trigger
Create a trigger that runs at 1 second and sets a day time ambience and plays your sound. Now go into Edit->Custom Text. You will recieve a warning dialog Box that says this is irreversible. You can safely ignore it. If this trigger proves faulty hitting ctrl-Z will if done right after creation will reverse it (Real irreversible...)
Now look for this...
call SetAmbientDaySound("Ambience title here")
and replace it with this.
call SetAmbientDaySound("Roland")
Disable the trigger, then hit reenable if the trigger compiles you are set to enjoy Midi music.
Save your map and open up WinMPQ or whatever MPQ tool you use and import the SLK file into the map.
Now it will play your mid in a repeating endless loop. Sounds good right?
Also if your going to play another MIDI after the first one, you don't actually have to do that ambience crap again and just need to use Play sound becareful there seems to be a wierd 1 second pause of everything when a midi loads, so you may want to move it from 1 second in to Game Initilization, but I wouldn't suggest it because Game initilzation si reknowned to break things.
Just remember the poor 98/ME users who are suffering, so add a note to tell them that if they want music they must move there GM.Dls to C:\windows\system32\drivers\gm.dls
01-29-2003, 11:54 PM#12
Guest
Actually, I am running Win98 and it's in the same directory. I don't know about ME, but basically, i think unless they changed
c:\windows\, then it should work..

See, I tried to put in a midi without modifying anything else, and it messed up my map completely.. saying that there were all these scripting errors in my triggers and disabled them all. I'm not sure why it did that. (it only did so as soon as I imported a .mid file) and I'm using UMSWE 3.4

Anyway, I'll try the method you suggested, and hopefully I'll get it to work. If it does work, we're looking at a 2 meg difference in file size and I could probably stuff more .mids in..
01-30-2003, 03:28 AM#13
Guest
ARGH... it's not working.. and I can't figure out why.. :bangH:

here's what I have in my trigger:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call TriggerSleepAction( 2 )
call SetAmbientDaySound( "Roland" )
call PlayMusicBJ( gg_snd_BossBattle )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Untitled_Trigger_001, 5 )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

so basically I'm playing a mid called bossbattle.
I disabled and reenabled the trigger, and it was a-ok with it.
I included MIDIsounds.slk in my w3m

here's what I put in the .slk: (hope the pic works)


I run the map... the original in game music stopped (indicating the trigger did fire) but no music :(
01-30-2003, 04:45 AM#14
knightking
Geoshitties does not support remote image linking. Change the extention to .txt and it will work.
01-30-2003, 05:13 AM#15
Guest
dammit..
it showed on the preview..
must have been in my cache at the time..

anyway it's
http://www.geocities.com/moov_synergy/midisounds.jpg