PDA

View Full Version : [Tutorial] Converting Midis to GBA format


Supreme Dirt
September 16th, 2007, 07:02 AM
Alright, if you don't have Midi2GBA, you will have to google it. I cannot post it here do to certain... legalities.

Anyways, here is the very simple tutorial which is known by a surprisingly small percent of hackers.

1. Open the folder containing Mid2AGB.exe
2. Open the folder containing the midi to insert
3. the midi to the same folder as Mid2AGB.exe
4. Drag the midi onto Mid2AGB.exe, as if the program were a folder
5. A DOS box should appear and then vanish, and the midi (in my case A-tomb.mid) should appear as A-tomb.s, replacing A-tomb with the name of the midi.
Then, just follow the instructions in Sappy's help file.

Happy ROM Hacking

~Supreme Dirt/mandella

SephirothX
September 19th, 2007, 09:22 AM
As I'm aware, Sappy's *.s files represent a single MIDI channel, so shouldn't the MIDI you import only use one channel? Also, what would we need to do in order to make the music loop?

cooley
September 20th, 2007, 02:23 PM
And MIDI's Are....What exactly?

nrox653
September 20th, 2007, 04:27 PM
And MIDI's Are....What exactly?

Oh come on... If you don't know what MIDI's are, why are you even looking at this thread?

cooley
September 21st, 2007, 03:24 AM
AlRight, Alright, I was Just Kidding. :)

Martin Yiu
September 21st, 2007, 07:43 AM
Okay, we can figure out how to split the single *s file to multiple ones by usin Green Charizard's music editing tutorial. But one thing, a little bit more advanced, is here staying without the coverage of either tutorial. How to make song loop, and then, how to change instruments by hex. I still didn't figure this out, so if there's someone capable of doing so and active enough to make a tutorial, I would ask you to make one to make life easier :P Thanks, anyways. And about your tutorial, you should specify more details to each step, tell something about theory, what the program exactly does and WHY IT'S ILLEGAL TO HAVE IT.

Prof. 9
September 21st, 2007, 08:25 AM
It's illegal because it's part of the actual DevKit that Nintendo uses.
At least that's what I heard >_>

SephirothX
September 21st, 2007, 01:02 PM
It's illegal because it's part of the actual DevKit that Nintendo uses.
At least that's what I heard >_>
Well, you heard right. MID2AGB is part of the official Nintendo GBA devkit, and so is illegal to distribute.
As for who could improve this tut (how to loop, getting the right instruments, etc.), Zel is getting G/S/C music for ShinyGold from birthofdna and Magnius, so I assume they know how to do that... IDK how active either of them are, though.

zel 2.0
September 21st, 2007, 09:22 PM
In fact guys, the problem of looping is something that everyone has. So we are all in the same situation (so far, all I can do is extend the length of the music by looping the midi by hand before inserting... Of course this means using more rom space, so if there is a way to make a loop, at least using hex, it would be interesting to hear about it)

Mastermind_X
September 22nd, 2007, 02:35 AM
... that isn't known? I think, I saw a reference or something. Well, I'll have a closer look on it, if I find the time, but I think it's not that important.

Supreme Dirt
September 22nd, 2007, 02:37 PM
I'm currently working on finding a way to make music loop. I can loop it, but it sometimes crashes the emulator. I will update my tutorial when I find a way.

And I deal with the single track *.s thing by using Anvil Studio (anvilstudio.com) to edit the midis and save each track to a single file. I then combine them in hex. A little bit complicated, and I may post a tutorial.

SephirothX
September 26th, 2007, 07:18 AM
Well, you should have at least mentioned that in the fist place. -_-;
Good luck with the looping!

Teh Baro
September 28th, 2007, 02:44 AM
Kawa told me long ago how to loop. It was editing the *.s file by hand, adding some stuff. Anyway, when I tried to import it, somethign went wrong

-I'll look at the old chat logs for all this stuff

EDIT:

.byte GOTO
.word targetlabelorpointer

In notepad, open the .s files and write it, changing the targetlabelorpointer for a label you insert.
Example:
Iloled_3:
.byte KEYSH , Iloled_key+0
@ 000 ----------------------------------------
.byte VOICE , 0
.byte VOL , 104*Iloled_mvl/mxv
.byte PAN , c_v+0
.byte BEND , c_v+0
.byte W24
.byte N24 , An3 , v096
.byte W24
.byte N24
.byte W24
@ 001 ----------------------------------------
Iloled_3_001:
.byte N12 , An3 , v096
.byte W12
.byte N12
.byte W12
.byte N12
.byte W12
.byte N12
.byte W12
.byte N12
.byte W12
.byte N12
.byte W12
.byte N06
.byte W06
.byte N06
.byte W06
.byte N06
.byte W06
.byte N06
.byte W06
.byte PEND
@ 002 ----------------------------------------
.byte PATT
.word Iloled_3_001
@ 003 ----------------------------------------
.byte PATT
.word Iloled_3_001
@ 004 ----------------------------------------
.byte PATT
.word Iloled_3_001
@ 005 ----------------------------------------
.byte GOTO
.word Iloled_3_001
.byte FINE



When more stuff in the game is done (and I have more free time, I'll try to hack music again... I think I know what went wrong last time...

DracoMalfoy88
September 28th, 2007, 05:52 PM
.include "MPlayDef.s"

.equ sadbgm_grp, voicegroup000
.equ sadbgm_pri, 0
.equ sadbgm_rev, 0
.equ sadbgm_mvl, 127
.equ sadbgm_key, 0
.equ sadbgm_tbs, 1
.equ sadbgm_exg, 0
.equ sadbgm_cmp, 1

.section .rodata
.global sadbgm
.align 2

@**************** Track 1 (Midi-Chn.1) ****************@

sadbgm_1:
.byte VOL , 127*sadbgm_mvl/mxv
.byte KEYSH , sadbgm_key+0
@ 000 ----------------------------------------
.byte TEMPO , 88*sadbgm_tbs/2
.byte VOICE , 5
.byte PAN , c_v-1
.byte N08 , Cn3 , v092
.byte W12
.byte Fn3
.byte W12
.byte Gs3
.byte W12
@ 001 ----------------------------------------
.byte TEMPO , 88*sadbgm_tbs/2
.byte N96 , Fn2
.byte N12 , Cn3
.byte N24 , Gs3
.byte N24 , Cn4
.byte W12
.byte N48 , Cn3
.byte W12
.byte N12 , Fn3
.byte W12
.byte Gs3
.byte N12 , Cn4
.byte W12
.byte N24 , Gn3
.byte N24 , As3
.byte W12
.byte Cn3
.byte W12
.byte Fn3
.byte N24 , Gs3
.byte W12
.byte N12 , Cn3
.byte W11
.byte W01
@ 002 ----------------------------------------
.byte N24 , En2
.byte N24 , Gn2
.byte N24 , As2
.byte N24 , En3
.byte N24 , Gn3
.byte W24
.byte Gn2
.byte N24 , As2
.byte N72 , Cs3
.byte N72 , Gn3
.byte N72 , As3
.byte W72
@ 003 ----------------------------------------
.byte N24 , Cn2
.byte N24 , Cs3
.byte N24 , Gn3
.byte N24 , As3
.byte W12
.byte N12 , Cn1
.byte W12
.byte En1
.byte N12 , Cs3
.byte N12 , Gn3
.byte N12 , As3
.byte W11
.byte W01
.byte Gn1
.byte N24 , Cn3
.byte N24 , Fn3
.byte N24 , Gs3
.byte W12
.byte Cn2
.byte N24 , En2
.byte W12
.byte N12 , Cn3
.byte N12 , Fn3
.byte N12 , Gs3
.byte W12
.byte N24 , Cn2
.byte N24 , As2
.byte N24 , En3
.byte N24 , Gn3
.byte W23
.byte W01
@ 004 ----------------------------------------
.byte N12 , Fn1
.byte N24 , Gs2
.byte N24 , Cn3
.byte N24 , Fn3
.byte W12
.byte N12 , Gs1
.byte W12
.byte Cn2
.byte N72 , Cn3
.byte N72 , Fn3
.byte N72 , Gs3
.byte W12
.byte N12 , Fn2
.byte W56
.byte W03
.byte W01
@ 005 ----------------------------------------
.byte N12
.byte N24 , Gs2
.byte N24 , Cn3
.byte N24 , Fn3
.byte W12
.byte N12 , Fn1
.byte W12
.byte Gs1
.byte N12 , Gs2
.byte N12 , Cn3
.byte N12 , Fn3
.byte W12
.byte Fn2
.byte N24 , Cn3
.byte N24 , Fn3
.byte N24 , Gs3
.byte W12
.byte N12 , En2
.byte W12
.byte Fn1
.byte TIE , Cn3
.byte N12 , Fn3
.byte W12
.byte Ds2
.byte N12 , Gs3
.byte W12
.byte Fn1
.byte N12 , Cn4
.byte W11
.byte W01
@ 006 ----------------------------------------
.byte N24 , Fn1
.byte N24 , Gn1
.byte N24 , Cs2
.byte N24 , As3
.byte N24 , Ds4
.byte W23
.byte W01
.byte Fn1
.byte N24 , Cs2
.byte N24 , As3
.byte N24 , Cs4
.byte W36
.byte N12
.byte W12
.byte Cn4
.byte W12
.byte As3
.byte W12
.byte EOT , Cn3
@ 007 ----------------------------------------
.byte TEMPO , 81*sadbgm_tbs/2
.byte N24 , En2
.byte N24 , Gn2
.byte TIE , Cn3
.byte N24 , Cn4
.byte W24
.byte TEMPO , 69*sadbgm_tbs/2
.byte Fn2
.byte N24 , Gs2
.byte N24 , Cs3
.byte N24 , As3
.byte W24
.byte TEMPO , 54*sadbgm_tbs/2
.byte Fs2
.byte N24 , An2
.byte N24 , Dn3
.byte N24 , Gs3
.byte W24
.byte TEMPO , 48*sadbgm_tbs/2
.byte Gn2
.byte N24 , As2
.byte N24 , En3
.byte N24 , Gn3
.byte W23
.byte W01
@ 008 ----------------------------------------
.byte TEMPO , 77*sadbgm_tbs/2
.byte N12 , Fn2
.byte N96 , Ds3
.byte N96 , Gn3
.byte W12
.byte N12 , Fn1
.byte W12
.byte Gs1
.byte W12
.byte Cn2
.byte W12
.byte TEMPO , 70*sadbgm_tbs/2
.byte Fn2
.byte W12
.byte Gn2
.byte W12
.byte Gs2
.byte W12
.byte EOT , Cn3
.byte TIE
.byte W11
.byte W01
@ 009 ----------------------------------------
.byte TEMPO , 88*sadbgm_tbs/2
.byte N48 , Cs1
.byte N96 , Fn2
.byte N96 , Gs2
.byte N96 , Cs3
.byte W48
.byte N12 , Cs2
.byte W12
.byte N12
.byte W12
.byte Cn2
.byte W12
.byte As1
.byte W11
.byte W01
.byte EOT , Cn3
@ 010 ----------------------------------------
.byte TEMPO , 84*sadbgm_tbs/2
.byte N96 , Cn1
.byte N12 , Cn2
.byte N24 , Cn3
.byte W24
.byte TEMPO , 68*sadbgm_tbs/2
.byte N12 , Cs2
.byte N24 , As2
.byte W23
.byte W01
.byte TEMPO , 59*sadbgm_tbs/2
.byte N12 , Dn2
.byte N24 , Gs2
.byte W24
.byte TEMPO , 46*sadbgm_tbs/2
.byte N12 , En2
.byte N24 , Gn2
.byte W24
@ 011 ----------------------------------------
.byte FINE

@**************** Track 2 (Midi-Chn.2) ****************@

sadbgm_2:
.byte KEYSH , sadbgm_key+0
@ 000 ----------------------------------------
.byte VOICE , 68
.byte PAN , c_v-1
.byte W36
@ 001 ----------------------------------------
.byte VOL , 127*sadbgm_mvl/mxv
.byte W96
@ 002 ----------------------------------------
.byte W96
@ 003 ----------------------------------------
.byte W96
@ 004 ----------------------------------------
.byte W96
@ 005 ----------------------------------------
.byte N21 , Fn3 , v056
.byte W24
.byte N12
.byte W12
.byte N22 , Gs3
.byte W24
.byte N09 , Fn3
.byte W12
.byte Gs3
.byte W12
.byte Cn4
.byte W12
@ 006 ----------------------------------------
.byte N24 , Ds4
.byte W24
.byte N72 , Cs4
.byte W72
@ 007 ----------------------------------------
.byte N24 , Cn4
.byte W24
.byte As3
.byte W24
.byte Gs3
.byte W24
.byte Gn3
.byte W24
@ 008 ----------------------------------------
.byte N96
.byte W16
.byte VOL , 100*sadbgm_mvl/mxv
.byte W17
.byte 90*sadbgm_mvl/mxv
.byte W23
.byte 80*sadbgm_mvl/mxv
.byte W40
@ 009 ----------------------------------------
.byte N96 , Fn3 , v048
.byte W96
@ 010 ----------------------------------------
.byte W72
.byte FINE

@**************** Track 3 (Midi-Chn.3) ****************@

sadbgm_3:
.byte VOL , 127*sadbgm_mvl/mxv
.byte KEYSH , sadbgm_key+0
@ 000 ----------------------------------------
.byte VOICE , 49
.byte PAN , c_v+2
.byte W36
@ 001 ----------------------------------------
.byte N96 , Gs2 , v064
.byte N96 , Fn3
.byte W96
@ 002 ----------------------------------------
.byte TIE , Gn2
.byte N96 , En3
.byte W96
@ 003 ----------------------------------------
.byte Cn3
.byte W96
.byte EOT , Gn2
@ 004 ----------------------------------------
.byte N96 , Cn3
.byte TIE , Fn3
.byte W96
@ 005 ----------------------------------------
.byte W96
.byte EOT
@ 006 ----------------------------------------
.byte N96 , Gs3
.byte W96
@ 007 ----------------------------------------
.byte Cn3
.byte N96 , Gn3
.byte W96
@ 008 ----------------------------------------
.byte Cn3
.byte N96 , Gn3
.byte W48
.byte N48 , Ds4 , v092
.byte W48
@ 009 ----------------------------------------
.byte N96 , Cs3
.byte N96 , Fn3
.byte N48 , Cs4
.byte W60
.byte N12
.byte W12
.byte Cn4
.byte W12
.byte As3
.byte W12
@ 010 ----------------------------------------
.byte N96 , Cn3
.byte N22 , Cn4
.byte W24
.byte Cs4
.byte W24
.byte Dn4
.byte W24
.byte En4
.byte W24
@ 011 ----------------------------------------
.byte FINE

@**************** Track 4 (Midi-Chn.4) ****************@

sadbgm_4:
.byte KEYSH , sadbgm_key+0
@ 000 ----------------------------------------
.byte VOICE , 68
.byte PAN , c_v-19
.byte W36
@ 001 ----------------------------------------
.byte W12
.byte VOL , 127*sadbgm_mvl/mxv
.byte W84
@ 002 ----------------------------------------
.byte W96
@ 003 ----------------------------------------
.byte W96
@ 004 ----------------------------------------
.byte W96
@ 005 ----------------------------------------
.byte W12
.byte N21 , Fn3 , v028
.byte W24
.byte N12
.byte W12
.byte N22 , Gs3
.byte W24
.byte N09 , Fn3
.byte W12
.byte Gs3
.byte W12
@ 006 ----------------------------------------
.byte Cn4
.byte W12
.byte N24 , Ds4
.byte W24
.byte N72 , Cs4
.byte W60
@ 007 ----------------------------------------
.byte W12
.byte N24 , Cn4
.byte W24
.byte As3
.byte W24
.byte Gs3
.byte W24
.byte Gn3
.byte W12
@ 008 ----------------------------------------
.byte W12
.byte N96
.byte W16
.byte VOL , 100*sadbgm_mvl/mxv
.byte W17
.byte 90*sadbgm_mvl/mxv
.byte W23
.byte 80*sadbgm_mvl/mxv
.byte W28
@ 009 ----------------------------------------
.byte W12
.byte N96 , Fn3 , v024
.byte W84
@ 010 ----------------------------------------
.byte W72
.byte FINE

@**************** Track 5 (Midi-Chn.5) ****************@

sadbgm_5:
.byte KEYSH , sadbgm_key+0
@ 000 ----------------------------------------
.byte VOICE , 68
.byte PAN , c_v+63
.byte W36
@ 001 ----------------------------------------
.byte W24
.byte VOL , 127*sadbgm_mvl/mxv
.byte W72
@ 002 ----------------------------------------
.byte W96
@ 003 ----------------------------------------
.byte W96
@ 004 ----------------------------------------
.byte W96
@ 005 ----------------------------------------
.byte W24
.byte N21 , Fn3 , v012
.byte W24
.byte N12
.byte W12
.byte N22 , Gs3
.byte W24
.byte N09 , Fn3
.byte W12
@ 006 ----------------------------------------
.byte Gs3
.byte W12
.byte Cn4
.byte W12
.byte N24 , Ds4
.byte W24
.byte N72 , Cs4
.byte W48
@ 007 ----------------------------------------
.byte W24
.byte N24 , Cn4
.byte W24
.byte As3
.byte W24
.byte Gs3
.byte W24
@ 008 ----------------------------------------
.byte Gn3
.byte W24
.byte N96
.byte W16
.byte VOL , 100*sadbgm_mvl/mxv
.byte W17
.byte 90*sadbgm_mvl/mxv
.byte W23
.byte 80*sadbgm_mvl/mxv
.byte W16
@ 009 ----------------------------------------
.byte W24
.byte N96 , Fn3
.byte W72
@ 010 ----------------------------------------
.byte W72
.byte FINE

@******************************************************@
.align 2

sadbgm:
.byte 5 @ NumTrks
.byte 0 @ NumBlks
.byte sadbgm_pri @ Priority
.byte sadbgm_rev @ Reverb.

.word sadbgm_grp

.word sadbgm_1
.word sadbgm_2
.word sadbgm_3
.word sadbgm_4
.word sadbgm_5

.end


This is my .s file, what's wrong?

zel 2.0
October 7th, 2007, 02:43 PM
I have been editting a midi and I didn't have any problems making it loop (so your example worked for me, Baro), the problem about it is that you need to make that for each track, which will get kinda tiring if you have to do lots of music (I wonder if there could be a better and more direct way...)
The other problem I seem to have is when the tracks don't seem to have the same ammount of @ values. Say I have one track that ends at @040, while other at @036, so if I try to make them loop with the GOTO command before the FINE, they end up (obviously) looping in a way the tempo between the tracks gets destroyed... How is the exact way in which I could make all the tracks have the same ammount of @ values? (And would that work to make all the tracks coincide again?) Is it done with?:

@ xxx ----------------------------------------
.byte W96

Martin Yiu
October 8th, 2007, 09:02 AM
Oh great! Someone making the way to loop! Good luck boys, I would help you but I am total n00b at these things (but I am not that n00b in the other parts XD) so I'm crossing fingers ;)

~Martin

Supreme Dirt
November 12th, 2007, 05:39 PM
alrighty. I now see why the emulator kept crashing.

thetribemaster
November 22nd, 2007, 01:27 PM
Aha here comes the part that sucks... One of my friends showed me once but I forgot and he moved. If I see how again I'll report back.
Anyway... Thx for the tut man. Its a great one!

mcrc
November 24th, 2007, 11:53 AM
this is great i can start up making music for hacks again, i'll try out the looping thing tomorrow