• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

GBA Music Looping

Status
Not open for further replies.

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
hey clonex, thanks for this tutorial, though I have some questions... :\

what voices/instruments are suitable for Ruby?
for instance, 48 and 47 sounds good with the music, but I am a bit bored using the same voices... :\

thanks~
 

Magnius

Pokemon Music Hacking Guru
295
Posts
18
Years
  • Seen Feb 17, 2014
hey clonex, thanks for this tutorial, though I have some questions... :\

what voices/instruments are suitable for Ruby?
for instance, 48 and 47 sounds good with the music, but I am a bit bored using the same voices... :\

thanks~
lol should check out my two tutorials for all that stuff. My second tutorial especially would help you as it tells you what instruments will sound good on the GBA and stuff.
 

Magnius

Pokemon Music Hacking Guru
295
Posts
18
Years
  • Seen Feb 17, 2014
lol still trying to get this right. As of now, I can loop like one or two tracks, but if I put the SAME loop at the same place on another track, it won't loop correctly.
 

~Frozen Darkness~

It's watching you...
503
Posts
15
Years
Hey for some reason this S file isn't working can someone plz tell me what's wrong? Sorry you'll have to download it the file is too big to put in one post or it would take up the whole page.
 
Last edited:

Craver

I'm From WAH!
45
Posts
15
Years
Wtf? Appearently, sappy doesnt too easy too use,. In order Clonex, can u say me how to do for make repeat's any song? C u later =)
 

Magnius

Pokemon Music Hacking Guru
295
Posts
18
Years
  • Seen Feb 17, 2014
I give up on trying to loop this midi. Sappy just crashes when I try to.

Ergh. I CAN'T loop this midi, it keeps crashing when I try.

I might need help on this.
 
Last edited:

Red Apple™

Banned
201
Posts
15
Years
WARNING:
The following steps may or may not affect the performance of your operating system. These may include DLL-related errors.
USE IT AT YOUR OWN RISK (But dont tell me I didn't warn you).

CREDITS:
Teh Baro, for posting the code primer (without that post, I couldn't get the idea of manual S file editing)
http://www.pokecommunity.com/showthread.php?p=2936767#post2936767
Kawa's Sappy bytecode help file

LET'S GET STARTED

- Before anything else, convert your custom MIDI to a GBA S file through the MIDI2GBA tool. After conversion, just open the text editor (you may choose WordPad or NotePad), Click File>Open, choose "All Documents" in "Files of Type" option, and select the S File.

REMINDERS: Associating S files with the text editor may affect the performance of Sappy especially in its assembling feature. You may get a permanent kernel32 error upon assembly.

Let's familiarize ourselves with the code (The items necessary for the looping procedure will be boldfaced):

Code:
 	.include "MPlayDef.s"

	.equ	frlgmbattlb_grp, voicegroup000
	.equ	frlgmbattlb_pri, 0
	.equ	frlgmbattlb_rev, 0
	.equ	frlgmbattlb_mvl, 127
	.equ	frlgmbattlb_key, 0
	.equ	frlgmbattlb_tbs, 1
	.equ	frlgmbattlb_exg, 0
	.equ	frlgmbattlb_cmp, 1

	.section .rodata
	.global	frlgmbattlb
	.align	2

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

[B]frlgmbattlb_1:   @ ------> label [/B]
	.byte	KEYSH , frlgmbattlb_key+0
[B]@ 000   -------- @ ------> measure number [/B]
	.byte	TEMPO , 182*frlgmbattlb_tbs/2
	.byte		VOICE , 33
	.byte		VOL   , 127*frlgmbattlb_mvl/mxv
	.byte		N06   , Ds1 , v104
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        En1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        Fn1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        Fs1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
@ 001   ----------------------------------------
	.byte		        Gn1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        Gs1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        An1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		N12   , As1 
	.byte	W12
	.byte		        An1 
	.byte	W12
@ 002   ----------------------------------------
[B]frlgmbattlb_1_002: @ ------> a pattern label [/B]
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 003   ----------------------------------------
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
@ 004   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		N32   , Ds2 
	.byte	W08
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-8
	.byte	W02
	.byte		        c_v-10
	.byte	W01
	.byte		        c_v-15
	.byte	W02
	.byte		        c_v-17
	.byte	W01
	.byte		        c_v-21
	.byte	W02
	.byte		        c_v-23
	.byte	W01
	.byte		        c_v-29
	.byte	W02
	.byte		        c_v-31
	.byte	W01
	.byte		        c_v-39
	.byte	W02
	.byte		        c_v-40
	.byte	W01
	.byte		        c_v-44
	.byte	W02
	.byte		        c_v-46
	.byte	W01
	.byte		        c_v-52
	.byte	W02
	.byte		        c_v-54
	.byte	W01
	.byte		        c_v-60
	.byte	W02
	.byte		        c_v-61
	.byte	W01
	.byte		        c_v-63
	.byte	W02
	.byte		        c_v-51
	.byte	W01
	.byte		        c_v+0
	.byte		N12   , Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
@ 005   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Ds2 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
@ 006   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_002
@ 007   ----------------------------------------
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
@ 008   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		N06   , Dn1 
	.byte	W06
	.byte		        Ds1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		N12   , Ds2 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
@ 009   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        Ds2 
	.byte	W12
	.byte		N06   , Ds1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		        Cn2 
	.byte	W06
	.byte		N12   , Ds2 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
@ 010   ----------------------------------------
frlgmbattlb_1_010:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N06   , Gn1 
	.byte	W06
	.byte		        Fs1 
	.byte	W06
	.byte		        En1 
	.byte	W06
	.byte		        Ds1 
	.byte	W06
	.byte	PEND
@ 011   ----------------------------------------
frlgmbattlb_1_011:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 012   ----------------------------------------
frlgmbattlb_1_012:
	.byte		N12   , Ds1 , v116
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte	PEND
@ 013   ----------------------------------------
frlgmbattlb_1_013:
	.byte		N12   , Ds1 , v116
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        Fn1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte	PEND
@ 014   ----------------------------------------
frlgmbattlb_1_014:
	.byte		N24   , Dn1 , v116
	.byte	W24
	.byte		N12   , An1 
	.byte	W12
	.byte		N18   , Dn1 
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte	PEND
@ 015   ----------------------------------------
frlgmbattlb_1_015:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W24
	.byte		N12   
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte	PEND
@ 016   ----------------------------------------
frlgmbattlb_1_016:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W24
	.byte		N12   
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 017   ----------------------------------------
frlgmbattlb_1_017:
	.byte		N24   , Dn1 , v108
	.byte	W24
	.byte		        Cn2 
	.byte	W24
	.byte		        Cn1 
	.byte	W24
	.byte		N18   , Gn1 
	.byte	W18
	.byte		N03   , Fn1 
	.byte	W03
	.byte		        En1 
	.byte	W03
	.byte	PEND
@ 018   ----------------------------------------
frlgmbattlb_1_018:
	.byte		N24   , Ds1 , v116
	.byte	W24
	.byte		N12   , As1 
	.byte	W12
	.byte		N18   , Ds1 
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		N03   , As1 
	.byte	W12
	.byte		N12   , Cn1 
	.byte	W12
	.byte	PEND
@ 019   ----------------------------------------
frlgmbattlb_1_019:
	.byte		N12   , Ds2 , v116
	.byte	W12
	.byte		N06   , Gn1 
	.byte	W12
	.byte		N12   , As1 
	.byte	W12
	.byte		N06   , Ds2 
	.byte	W12
	.byte		        Ds1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        An1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		N12   , Ds2 
	.byte	W12
	.byte		        Cs2 
	.byte	W12
	.byte	PEND
@ 020   ----------------------------------------
frlgmbattlb_1_020:
	.byte		N12   , An1 , v116
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N06   , Dn1 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte	PEND
@ 021   ----------------------------------------
frlgmbattlb_1_021:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N06   , Cs2 
	.byte	W06
	.byte		        Dn2 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		        Cn2 
	.byte	W06
	.byte		        An1 
	.byte	W06
	.byte		        Gs1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        Fs1 
	.byte	W06
	.byte	PEND
@ 022   ----------------------------------------
frlgmbattlb_1_022:
	.byte		N06   , Cn1 , v116
	.byte	W12
	.byte		N12   
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		N18   , Cn1 
	.byte	W24
	.byte		N06   
	.byte	W12
	.byte	PEND
@ 023   ----------------------------------------
frlgmbattlb_1_023:
	.byte		N12   , Cn1 , v116
	.byte	W24
	.byte		N06   
	.byte	W12
	.byte		N03   
	.byte	W06
	.byte		N03   
	.byte	W06
	.byte		N44   , Cn2 
	.byte	W11
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-6
	.byte	W02
	.byte		        c_v-7
	.byte	W01
	.byte		        c_v-10
	.byte	W02
	.byte		        c_v-12
	.byte	W01
	.byte		        c_v-17
	.byte	W02
	.byte		        c_v-19
	.byte	W01
	.byte		        c_v-23
	.byte	W02
	.byte		        c_v-25
	.byte	W01
	.byte		        c_v-31
	.byte	W02
	.byte		        c_v-32
	.byte	W01
	.byte		        c_v-35
	.byte	W02
	.byte		        c_v-37
	.byte	W01
	.byte		        c_v-42
	.byte	W02
	.byte		        c_v-43
	.byte	W01
	.byte		        c_v-47
	.byte	W02
	.byte		        c_v-51
	.byte	W01
	.byte		        c_v-64
	.byte	W11
	.byte		        c_v-52
	.byte	W01
	.byte	PEND
@ 024   ----------------------------------------
frlgmbattlb_1_024:
	.byte		BEND  , c_v+0
	.byte		N24   , An1 , v116
	.byte	W24
	.byte		N06   , Fs1 
	.byte	W12
	.byte		        An1 
	.byte	W06
	.byte		        Bn1 
	.byte	W06
	.byte		N12   , Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 025   ----------------------------------------
frlgmbattlb_1_025:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W24
	.byte		N32   
	.byte	W11
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-6
	.byte	W05
	.byte		        c_v-7
	.byte	W01
	.byte		        c_v-10
	.byte	W02
	.byte		        c_v-11
	.byte	W01
	.byte		        c_v-15
	.byte	W02
	.byte		        c_v-16
	.byte	W01
	.byte		        c_v-20
	.byte	W02
	.byte		        c_v-22
	.byte	W01
	.byte		        c_v-28
	.byte	W02
	.byte		        c_v-29
	.byte	W01
	.byte		        c_v-32
	.byte	W02
	.byte		        c_v-34
	.byte	W01
	.byte		        c_v-39
	.byte	W02
	.byte		        c_v-32
	.byte	W01
	.byte		        c_v+0
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte	PEND
@ 026   ----------------------------------------
frlgmbattlb_1_026:
	.byte		N12   , Cn2 , v116
	.byte	W36
	.byte		N03   
	.byte	W06
	.byte		N03   
	.byte	W06
	.byte		N44   , Gn1 
	.byte	W11
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-6
	.byte	W02
	.byte		        c_v-7
	.byte	W01
	.byte		        c_v-10
	.byte	W02
	.byte		        c_v-12
	.byte	W01
	.byte		        c_v-17
	.byte	W02
	.byte		        c_v-19
	.byte	W01
	.byte		        c_v-23
	.byte	W02
	.byte		        c_v-25
	.byte	W01
	.byte		        c_v-31
	.byte	W02
	.byte		        c_v-32
	.byte	W01
	.byte		        c_v-35
	.byte	W02
	.byte		        c_v-37
	.byte	W01
	.byte		        c_v-42
	.byte	W02
	.byte		        c_v-43
	.byte	W01
	.byte		        c_v-47
	.byte	W02
	.byte		        c_v-51
	.byte	W01
	.byte		        c_v-64
	.byte	W11
	.byte		        c_v-52
	.byte	W01
	.byte	PEND
@ 027   ----------------------------------------
frlgmbattlb_1_027:
	.byte		BEND  , c_v+0
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Bn1 
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte	PEND
@ 028   ----------------------------------------
frlgmbattlb_1_028:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 029   ----------------------------------------
frlgmbattlb_1_029:
	.byte		N12   , Dn2 , v116
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte		N12   , Fs1 
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte		        Cn2 
	.byte	W06
	.byte		        Dn2 
	.byte	W06
	.byte		        An1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		        Fs1 
	.byte	W06
	.byte		        Fn1 
	.byte	W06
	.byte		        En1 
	.byte	W06
	.byte		        Ds1 
	.byte	W06
	.byte	PEND
@ 030   ----------------------------------------
frlgmbattlb_1_030:
	.byte		N28   , Dn1 , v116
	.byte	W36
	.byte		N06   
	.byte	W24
	.byte		N24   
	.byte	W36
	.byte	PEND
@ 031   ----------------------------------------
frlgmbattlb_1_031:
	.byte		N12   , Cs2 , v116
	.byte	W12
	.byte		N24   , Dn2 
	.byte	W24
	.byte		N18   , Dn1 
	.byte	W24
	.byte		N06   
	.byte	W24
	.byte		N06   
	.byte	W12
	.byte	PEND
@ 032   ----------------------------------------
frlgmbattlb_1_032:
	.byte		N24   , Ds1 , v116
	.byte	W24
	.byte		N12   , Ds2 
	.byte	W12
	.byte		N18   , Ds1 
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		N24   , Ds2 
	.byte	W24
	.byte	PEND
@ 033   ----------------------------------------
	.byte		N12   , Dn2 
	.byte	W12
	.byte		        Ds2 
	.byte	W36
	.byte		        As1 
	.byte	W12
	.byte		N06   , Cn2 
	.byte	W12
	.byte		N12   , Gn1 
	.byte	W12
	.byte		N06   , As1 
	.byte	W12
@ 034   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_010
@ 035   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_011
@ 036   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_012
@ 037   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_013
@ 038   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_014
@ 039   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_015
@ 040   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_016
@ 041   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_017
@ 042   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_018
@ 043   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_019
@ 044   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_020
@ 045   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_021
@ 046   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_022
@ 047   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_023
@ 048   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_024
@ 049   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_025
@ 050   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_026
@ 051   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_027
@ 052   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_028
@ 053   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_029
@ 054   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_030
@ 055   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_031
@ 056   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_032
@ 057   ----------------------------------------
	.byte		N12   , Dn2 , v116
	.byte	W12
	.byte		        Ds2 
	.byte	W36
	.byte		        As1 
	.byte	W12
	.byte		N06   , Cn2 
	.byte	W12
	.byte		N12   , Gn1 
	.byte	W12
	.byte		N06   , As1 
	.byte	W06
[B]	.byte	FINE	@ ------> end of track [/B]

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

frlgmbattlb:
	.byte	1	@ NumTrks
	.byte	0	@ NumBlks
	.byte	frlgmbattlb_pri	@ Priority
	.byte	frlgmbattlb_rev	@ Reverb.

	.word	frlgmbattlb_grp

	.word	frlgmbattlb_1

	.end

SINGLE TRACK LOOPING

-----------

- To make the loop, you must first find the end of the track, and it usually ends with:

Code:
[B]	.byte	FINE [/B]

-Place the following code before the ".byte FINE" code line:

Code:
	[B].byte GOTO @ ----> Unconditional jump Ref. Sappy's Help file
	.word <name of loop label/pointer> @ ----> loop label name
	.byte W06 [/B]

REMINDERS: Although an option to place in the code, the purpose of the ".byte W06" after the GOTO and label statement is to give the GBA processor and memory enough time to go at the specified label's position, avoiding crashes at runtime. Adding an additional measure name before the ".byte FINE" code line is also optional, but recommended to avoid confusion. Besides the "@" sign signifies commenting in the S file. I also recommend using a label name which is similar to what is already in there (e.g. frlgmbattlb_1, newbark_2...).

The end of track must look like this:
Code:
	.byte GOTO
	.word frlgmbattlb_1_loop
	.byte W06
	.byte FINE


-and place the exact same label name (in this case, frlgmbattlb_1_loop) followed by a colon (:) in the place or measure you want to consider as the start of the loop. If a measure has a pattern statement (begins with a pattern label, format: <filename>_<track number>_<measure number>, and ends with .byte PEND), place the loop label before the pattern label.

Code:
@ 010   ----------------------------------------
frlgmbattlb_1_loop:
[B]frlgmbattlb_1_010: @ -----> start of pattern statement [/B]
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N06   , Gn1 
	.byte	W06
	.byte		        Fs1 
	.byte	W06
	.byte		        En1 
	.byte	W06
	.byte		        Ds1 
	.byte	W06
[B]	.byte	PEND @ -----> end of pattern statement [/B]

To make things simple, always remember that:
Code:
[B]frlgmbattlb_1_loop:   @ ----> start of GOTO (loop) statement [/B]

<lines of code to loop>

[B].byte GOTO			@ \
.word frlgmbattlb_1_loop	@  > ---> end of GOTO (loop statement)
.byte W06				@ /
[/B]

.byte FINE

As an end result, you must have a code that looks like this (pay attention to the boldfaced codes for further understanding):
Code:
	.include "MPlayDef.s"

	.equ	frlgmbattlb_grp, voicegroup000
	.equ	frlgmbattlb_pri, 0
	.equ	frlgmbattlb_rev, 0
	.equ	frlgmbattlb_mvl, 127
	.equ	frlgmbattlb_key, 0
	.equ	frlgmbattlb_tbs, 1
	.equ	frlgmbattlb_exg, 0
	.equ	frlgmbattlb_cmp, 1

	.section .rodata
	.global	frlgmbattlb
	.align	2

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

frlgmbattlb_1:
	.byte	KEYSH , frlgmbattlb_key+0
@ 000   ----------------------------------------
	.byte	TEMPO , 182*frlgmbattlb_tbs/2
	.byte		VOICE , 33
	.byte		VOL   , 127*frlgmbattlb_mvl/mxv
	.byte		N06   , Ds1 , v104
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        En1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        Fn1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        Fs1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
@ 001   ----------------------------------------
	.byte		        Gn1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        Gs1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		        An1 
	.byte	W12
	.byte		N06   
	.byte	W06
	.byte		        Dn1 
	.byte	W06
	.byte		N12   , As1 
	.byte	W12
	.byte		        An1 
	.byte	W12
@ 002   ----------------------------------------
frlgmbattlb_1_002:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 003   ----------------------------------------
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
@ 004   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		N32   , Ds2 
	.byte	W08
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-8
	.byte	W02
	.byte		        c_v-10
	.byte	W01
	.byte		        c_v-15
	.byte	W02
	.byte		        c_v-17
	.byte	W01
	.byte		        c_v-21
	.byte	W02
	.byte		        c_v-23
	.byte	W01
	.byte		        c_v-29
	.byte	W02
	.byte		        c_v-31
	.byte	W01
	.byte		        c_v-39
	.byte	W02
	.byte		        c_v-40
	.byte	W01
	.byte		        c_v-44
	.byte	W02
	.byte		        c_v-46
	.byte	W01
	.byte		        c_v-52
	.byte	W02
	.byte		        c_v-54
	.byte	W01
	.byte		        c_v-60
	.byte	W02
	.byte		        c_v-61
	.byte	W01
	.byte		        c_v-63
	.byte	W02
	.byte		        c_v-51
	.byte	W01
	.byte		        c_v+0
	.byte		N12   , Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
@ 005   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Ds2 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
@ 006   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_002
@ 007   ----------------------------------------
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
@ 008   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		N06   , Dn1 
	.byte	W06
	.byte		        Ds1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		N12   , Ds2 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
@ 009   ----------------------------------------
	.byte		        Ds1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        Ds2 
	.byte	W12
	.byte		N06   , Ds1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		        Cn2 
	.byte	W06
	.byte		N12   , Ds2 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
@ 010   ----------------------------------------
[B]frlgmbattlb_1_loop:[/B]
frlgmbattlb_1_010:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N06   , Gn1 
	.byte	W06
	.byte		        Fs1 
	.byte	W06
	.byte		        En1 
	.byte	W06
	.byte		        Ds1 
	.byte	W06
	.byte	PEND
@ 011   ----------------------------------------
frlgmbattlb_1_011:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 012   ----------------------------------------
frlgmbattlb_1_012:
	.byte		N12   , Ds1 , v116
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte	PEND
@ 013   ----------------------------------------
frlgmbattlb_1_013:
	.byte		N12   , Ds1 , v116
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        Ds1 
	.byte	W12
	.byte		        Fn1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        As1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte	PEND
@ 014   ----------------------------------------
frlgmbattlb_1_014:
	.byte		N24   , Dn1 , v116
	.byte	W24
	.byte		N12   , An1 
	.byte	W12
	.byte		N18   , Dn1 
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte	PEND
@ 015   ----------------------------------------
frlgmbattlb_1_015:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W24
	.byte		N12   
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte	PEND
@ 016   ----------------------------------------
frlgmbattlb_1_016:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W24
	.byte		N12   
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 017   ----------------------------------------
frlgmbattlb_1_017:
	.byte		N24   , Dn1 , v108
	.byte	W24
	.byte		        Cn2 
	.byte	W24
	.byte		        Cn1 
	.byte	W24
	.byte		N18   , Gn1 
	.byte	W18
	.byte		N03   , Fn1 
	.byte	W03
	.byte		        En1 
	.byte	W03
	.byte	PEND
@ 018   ----------------------------------------
frlgmbattlb_1_018:
	.byte		N24   , Ds1 , v116
	.byte	W24
	.byte		N12   , As1 
	.byte	W12
	.byte		N18   , Ds1 
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		N03   , As1 
	.byte	W12
	.byte		N12   , Cn1 
	.byte	W12
	.byte	PEND
@ 019   ----------------------------------------
frlgmbattlb_1_019:
	.byte		N12   , Ds2 , v116
	.byte	W12
	.byte		N06   , Gn1 
	.byte	W12
	.byte		N12   , As1 
	.byte	W12
	.byte		N06   , Ds2 
	.byte	W12
	.byte		        Ds1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        An1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		N12   , Ds2 
	.byte	W12
	.byte		        Cs2 
	.byte	W12
	.byte	PEND
@ 020   ----------------------------------------
frlgmbattlb_1_020:
	.byte		N12   , An1 , v116
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N06   , Dn1 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte	PEND
@ 021   ----------------------------------------
frlgmbattlb_1_021:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		N06   , Cs2 
	.byte	W06
	.byte		        Dn2 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		        Cn2 
	.byte	W06
	.byte		        An1 
	.byte	W06
	.byte		        Gs1 
	.byte	W06
	.byte		        Gn1 
	.byte	W06
	.byte		        Fs1 
	.byte	W06
	.byte	PEND
@ 022   ----------------------------------------
frlgmbattlb_1_022:
	.byte		N06   , Cn1 , v116
	.byte	W12
	.byte		N12   
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		N18   , Cn1 
	.byte	W24
	.byte		N06   
	.byte	W12
	.byte	PEND
@ 023   ----------------------------------------
frlgmbattlb_1_023:
	.byte		N12   , Cn1 , v116
	.byte	W24
	.byte		N06   
	.byte	W12
	.byte		N03   
	.byte	W06
	.byte		N03   
	.byte	W06
	.byte		N44   , Cn2 
	.byte	W11
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-6
	.byte	W02
	.byte		        c_v-7
	.byte	W01
	.byte		        c_v-10
	.byte	W02
	.byte		        c_v-12
	.byte	W01
	.byte		        c_v-17
	.byte	W02
	.byte		        c_v-19
	.byte	W01
	.byte		        c_v-23
	.byte	W02
	.byte		        c_v-25
	.byte	W01
	.byte		        c_v-31
	.byte	W02
	.byte		        c_v-32
	.byte	W01
	.byte		        c_v-35
	.byte	W02
	.byte		        c_v-37
	.byte	W01
	.byte		        c_v-42
	.byte	W02
	.byte		        c_v-43
	.byte	W01
	.byte		        c_v-47
	.byte	W02
	.byte		        c_v-51
	.byte	W01
	.byte		        c_v-64
	.byte	W11
	.byte		        c_v-52
	.byte	W01
	.byte	PEND
@ 024   ----------------------------------------
frlgmbattlb_1_024:
	.byte		BEND  , c_v+0
	.byte		N24   , An1 , v116
	.byte	W24
	.byte		N06   , Fs1 
	.byte	W12
	.byte		        An1 
	.byte	W06
	.byte		        Bn1 
	.byte	W06
	.byte		N12   , Dn2 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 025   ----------------------------------------
frlgmbattlb_1_025:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W24
	.byte		N32   
	.byte	W11
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-6
	.byte	W05
	.byte		        c_v-7
	.byte	W01
	.byte		        c_v-10
	.byte	W02
	.byte		        c_v-11
	.byte	W01
	.byte		        c_v-15
	.byte	W02
	.byte		        c_v-16
	.byte	W01
	.byte		        c_v-20
	.byte	W02
	.byte		        c_v-22
	.byte	W01
	.byte		        c_v-28
	.byte	W02
	.byte		        c_v-29
	.byte	W01
	.byte		        c_v-32
	.byte	W02
	.byte		        c_v-34
	.byte	W01
	.byte		        c_v-39
	.byte	W02
	.byte		        c_v-32
	.byte	W01
	.byte		        c_v+0
	.byte	W12
	.byte		N12   
	.byte	W12
	.byte	PEND
@ 026   ----------------------------------------
frlgmbattlb_1_026:
	.byte		N12   , Cn2 , v116
	.byte	W36
	.byte		N03   
	.byte	W06
	.byte		N03   
	.byte	W06
	.byte		N44   , Gn1 
	.byte	W11
	.byte		BEND  , c_v-2
	.byte	W01
	.byte		        c_v-6
	.byte	W02
	.byte		        c_v-7
	.byte	W01
	.byte		        c_v-10
	.byte	W02
	.byte		        c_v-12
	.byte	W01
	.byte		        c_v-17
	.byte	W02
	.byte		        c_v-19
	.byte	W01
	.byte		        c_v-23
	.byte	W02
	.byte		        c_v-25
	.byte	W01
	.byte		        c_v-31
	.byte	W02
	.byte		        c_v-32
	.byte	W01
	.byte		        c_v-35
	.byte	W02
	.byte		        c_v-37
	.byte	W01
	.byte		        c_v-42
	.byte	W02
	.byte		        c_v-43
	.byte	W01
	.byte		        c_v-47
	.byte	W02
	.byte		        c_v-51
	.byte	W01
	.byte		        c_v-64
	.byte	W11
	.byte		        c_v-52
	.byte	W01
	.byte	PEND
@ 027   ----------------------------------------
frlgmbattlb_1_027:
	.byte		BEND  , c_v+0
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        Dn2 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Cn2 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Bn1 
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte	PEND
@ 028   ----------------------------------------
frlgmbattlb_1_028:
	.byte		N12   , Dn1 , v116
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Gn1 
	.byte	W12
	.byte		        Dn1 
	.byte	W12
	.byte		        Fs1 
	.byte	W12
	.byte		        Gs1 
	.byte	W12
	.byte		        An1 
	.byte	W12
	.byte	PEND
@ 029   ----------------------------------------
frlgmbattlb_1_029:
	.byte		N12   , Dn2 , v116
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte		N12   , Fs1 
	.byte	W12
	.byte		N06   , An1 
	.byte	W12
	.byte		        Cn2 
	.byte	W06
	.byte		        Dn2 
	.byte	W06
	.byte		        An1 
	.byte	W06
	.byte		        As1 
	.byte	W06
	.byte		        Fs1 
	.byte	W06
	.byte		        Fn1 
	.byte	W06
	.byte		        En1 
	.byte	W06
	.byte		        Ds1 
	.byte	W06
	.byte	PEND
@ 030   ----------------------------------------
frlgmbattlb_1_030:
	.byte		N28   , Dn1 , v116
	.byte	W36
	.byte		N06   
	.byte	W24
	.byte		N24   
	.byte	W36
	.byte	PEND
@ 031   ----------------------------------------
frlgmbattlb_1_031:
	.byte		N12   , Cs2 , v116
	.byte	W12
	.byte		N24   , Dn2 
	.byte	W24
	.byte		N18   , Dn1 
	.byte	W24
	.byte		N06   
	.byte	W24
	.byte		N06   
	.byte	W12
	.byte	PEND
@ 032   ----------------------------------------
frlgmbattlb_1_032:
	.byte		N24   , Ds1 , v116
	.byte	W24
	.byte		N12   , Ds2 
	.byte	W12
	.byte		N18   , Ds1 
	.byte	W24
	.byte		N12   
	.byte	W12
	.byte		N24   , Ds2 
	.byte	W24
	.byte	PEND
@ 033   ----------------------------------------
	.byte		N12   , Dn2 
	.byte	W12
	.byte		        Ds2 
	.byte	W36
	.byte		        As1 
	.byte	W12
	.byte		N06   , Cn2 
	.byte	W12
	.byte		N12   , Gn1 
	.byte	W12
	.byte		N06   , As1 
	.byte	W12
@ 034   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_010
@ 035   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_011
@ 036   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_012
@ 037   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_013
@ 038   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_014
@ 039   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_015
@ 040   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_016
@ 041   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_017
@ 042   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_018
@ 043   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_019
@ 044   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_020
@ 045   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_021
@ 046   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_022
@ 047   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_023
@ 048   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_024
@ 049   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_025
@ 050   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_026
@ 051   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_027
@ 052   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_028
@ 053   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_029
@ 054   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_030
@ 055   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_031
@ 056   ----------------------------------------
	.byte	PATT
	 .word	frlgmbattlb_1_032
@ 057   ----------------------------------------
	.byte		N12   , Dn2 , v116
	.byte	W12
	.byte		        Ds2 
	.byte	W36
	.byte		        As1 
	.byte	W12
	.byte		N06   , Cn2 
	.byte	W12
	.byte		N12   , Gn1 
	.byte	W12
	.byte		N06   , As1 
	.byte	W06
[B]	.byte GOTO
	.word frlgmbattlb_1_loop [/B]
@ 058   ----------------------------------------
	.byte	FINE

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

frlgmbattlb:
	.byte	1	@ NumTrks
	.byte	0	@ NumBlks
	.byte	frlgmbattlb_pri	@ Priority
	.byte	frlgmbattlb_rev	@ Reverb.

	.word	frlgmbattlb_grp

	.word	frlgmbattlb_1

	.end

MULTIPLE TRACK LOOPING

-----------
Now, if you think looping a single-tracked S file is easy, think of looping a multi-tracked S file a bit complicated. Because unlike looping a single-tracked file, looping a multi-tracked file requires that you must loop EACH AND EVERY TRACK inside it. It means that if you looped one track doesn't mean that the others will loop as well. What makes it more complicated is that not all tracks end with the same number and the same W<xx> values (contrary to what I've posted previously). To know more about it, click the file tes.zip in the Attachments part of the thread (thanks to megiddo for the code). Once you've extracted it, open the file "tes.txt". Upon thorough examination of the file, you will notice that some tracks end with "@ 042" measure while others end with "@ 050". Also, some of the tracks don't have W<xx> values that equal to 96, the "whole rest" value for a 4/4 metered file (to be explained later on).

In this kind of situation, we must adjust the other tracks to align with the track which has the highest amount of length (in this case the longest track has a measure of @ 050 and has W<xx> values equal to 96).

Code:
@ 042   ----------------------------------------
	.byte		N23   , Cs3 , v064
	.byte	W24
	.byte		        As2 
	.byte	W24
	.byte		        Cn3 
	.byte	W24
	.byte		        Gs2 
	.byte	W23
	.byte	FINE

Let's say this code above (taken from Track 2 of tes.txt) is your track's last measure. To make this track equal to the longest track in the file, we will add the following code lines:

Code:
@ 043   ----------------------------------------
	.byte	W96

Do so until the track reaches the same length as the longest track. Just like:

Code:
@ 042   ----------------------------------------
	.byte		N23   , Cs3 , v064
	.byte	W24
	.byte		        As2 
	.byte	W24
	.byte		        Cn3 
	.byte	W24
	.byte		        Gs2 
	.byte	W23
@ 043   ----------------------------------------
	.byte	W96
@ 044   ----------------------------------------
	.byte	W96
@ 045   ----------------------------------------
	.byte	W96
@ 046   ----------------------------------------
	.byte	W96
@ 047   ----------------------------------------
	.byte	W96
@ 048   ----------------------------------------
	.byte	W96
@ 049   ----------------------------------------
	.byte	W96
@ 050   ----------------------------------------
	.byte	W96
	.byte	FINE

But we're not done yet. It may look aligned to the longest track for now, but let's go back to measure @ 042. If you add the W<xx> values, it would be: 24+24+24+23=95. We must also remember that the measure's meter is 4/4, which has a W<xx> value of 96. Ignoring this fact may cause crashing at runtime (which we don't want to happen). To make the W<xx> bytecodes equal to 96, simply change the value of the last W<xx> bytecode to a value that would make them equal to 96. In this code, we will change ".byte W23" to ".byte W24". You will have a code that looks like:

Code:
@ 042   ----------------------------------------
	.byte		N23   , Cs3 , v064
	.byte	W24
	.byte		        As2 
	.byte	W24
	.byte		        Cn3 
	.byte	W24
	.byte		        Gs2 
	.byte	W24
@ 043   ----------------------------------------
	.byte	W96
@ 044   ----------------------------------------
	.byte	W96
@ 045   ----------------------------------------
	.byte	W96
@ 046   ----------------------------------------
	.byte	W96
@ 047   ----------------------------------------
	.byte	W96
@ 048   ----------------------------------------
	.byte	W96
@ 049   ----------------------------------------
	.byte	W96
@ 050   ----------------------------------------
	.byte	W96
	.byte	FINE


After that, you may start looping the file. Always remember upon looping a multi-tracked S file, you must loop each and every track of the file. Open "tes_r.txt" to see the results.

WHAT'S IN THE W<xx>?

-----------
You may ask "You keep mentioning about this W<xx> and the 4/4 meter stuff, but what exactly is it?"

Actually, here's the definition for the W<xx> from Sappy 2006's help file:

Wxx (0x80++)
Wait for the specified number of clock ticks

The value of W<xx> varies on its use, and it adds up to a total of:

96 – for 4/4 metered measure (4 beats per measure/beat value of 4)
72 – for 3/4 metered measure, and
48 – for 3/4 metered measure

In a W96 measure:

96 – whole (note if .byte W96 has N<xx> line before it/rest if none)
48 – half
24 – quarter
12 – half quarter


- Save the file when you're done. The next step is to insert it in Sappy. Follow the help file or Search the Forum for instructions.

NOTES:
  • You may preview the S file using Sappy. Just be warned that it may close the program upon playing the file on the first run. Preview using GBA emulator for safety.
  • If you are about to use a multi-track S file, you may want to shorten the length of your MIDI to a single repetition for easier loop coding.
  • Always check everything about the loop statement (the spelling, location, etc.) to avoid crashes or erroneous loops at runtime. Do so by pressing Ctrl+F, typing the loop label name, and cilck Find Next.
  • You must also refer to the "Event List" of your MIDI software to know where to loop in your S file (e.g. knowing the measure number, the formula is (MIDI measure number)-1).
  • About knowing where to (start and end a) loop, always ask yourself: "Which part of this song do I want to hear over and over again?" and "Which particular measure number does the looping start?" Simple questions that need tough answers, but you'll be able to push through when you do.
  • Always backup your files.

EXAMPLES:

I have included some reference files and examples below. Use them as guides for music looping.

GOOD LUCK IN YOUR GBA MUSIC LOOPING!!!
hey clonex25 do u have anyother midi files with s file in it? except the new bark and goldenrod
 
98
Posts
16
Years
Hey, I get this a little bit now. I didn't successfully loop my song because it didn't go to the place I wanted it to loop and it didn't continue on. I'm going to look more into this. Thanks clonex25!
Edit: Actually this is pretty tough. Can someone tell me what I'm doing wrong?
Spoiler:
 
Last edited:
7
Posts
15
Years
  • Seen Sep 24, 2016
hey,i think i maked all right,but it doesn't sounds good,it loops but whit beeps xD
where i'm wrong?

.include "MPlayDef.s"

.equ DKC2_-_Forest_Interlude_grp, voicegroup000
.equ DKC2_-_Forest_Interlude_pri, 0
.equ DKC2_-_Forest_Interlude_rev, 0
.equ DKC2_-_Forest_Interlude_mvl, 127
.equ DKC2_-_Forest_Interlude_key, 0
.equ DKC2_-_Forest_Interlude_tbs, 1
.equ DKC2_-_Forest_Interlude_exg, 0
.equ DKC2_-_Forest_Interlude_cmp, 1

.section .rodata
.global DKC2_-_Forest_Interlude
.align 2

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

DKC2_-_Forest_Interlude_1:
.byte KEYSH , DKC2_-_Forest_Interlude_key+0
@ 000 ----------------------------------------
.byte TEMPO , 95*DKC2_-_Forest_Interlude_tbs/2
.byte VOICE , 1
.byte VOL , 127*DKC2_-_Forest_Interlude_mvl/mxv
.byte PAN , c_v+0
.byte VOL , 92*DKC2_-_Forest_Interlude_mvl/mxv
.byte N12 , Gs3 , v127
.byte W12
.byte Cn4
.byte W12
.byte Ds4
.byte W12
.byte Cn4
.byte W12
.byte N03 , Fn4
.byte W03
.byte N09 , Gn4
.byte W09
.byte N03 , Fn4
.byte W03
.byte N09 , Gn4
.byte W09
.byte N12 , Ds4
.byte W12
.byte Fn4
.byte W12
@ 001 ----------------------------------------
.word forest_interlude_loop
DKC2_-_Forest_Interlude_1_001:
.byte N12 , Gs3 , v127
.byte W12
.byte Cn4
.byte W12
.byte Ds4
.byte W12
.byte Cn4
.byte W12
.byte N03 , Fn4
.byte W03
.byte N09 , Gn4
.byte W09
.byte N03 , Fn4
.byte W03
.byte N09 , Gn4
.byte W09
.byte N12 , Ds4
.byte W12
.byte Fn4
.byte W12
.byte PEND
@ 002 ----------------------------------------
.byte PATT
.word DKC2_-_Forest_Interlude_1_001
@ 003 ----------------------------------------
.byte PATT
.word DKC2_-_Forest_Interlude_1_001
@ 004 ----------------------------------------
.byte FINE

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

DKC2_-_Forest_Interlude_2:
.byte KEYSH , DKC2_-_Forest_Interlude_key+0
@ 000 ----------------------------------------
.byte VOICE , 56
.byte VOL , 127*DKC2_-_Forest_Interlude_mvl/mxv
.byte PAN , c_v+0
.byte N96 , Gs2 , v092
.byte TIE , Ds3
.byte W96
@ 001 ----------------------------------------
.byte N96 , Cn3
.byte W96
.byte EOT , Ds3
@ 002 ----------------------------------------
.byte TIE , As2
.byte TIE , Dn3
.byte W96
@ 003 ----------------------------------------
.byte W96
.byte EOT , As2
.byte Dn3
@ 004 ----------------------------------------
.byte FINE

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

DKC2_-_Forest_Interlude_3:
.byte KEYSH , DKC2_-_Forest_Interlude_key+0
@ 000 ----------------------------------------
.byte VOICE , 80
.byte VOL , 127*DKC2_-_Forest_Interlude_mvl/mxv
.byte PAN , c_v+0
.byte N96 , Gs0 , v092
.byte N96 , Gs1
.byte W96
@ 001 ----------------------------------------
.byte Fn0
.byte N96 , Fn1
.byte W96
@ 002 ----------------------------------------
.byte TIE , As0
.byte TIE , As1
.byte W96
@ 003 ----------------------------------------
.byte W96
.byte EOT , As0
.byte As1
@ 004 ----------------------------------------
.byte FINE

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

DKC2_-_Forest_Interlude_4:
.byte KEYSH , DKC2_-_Forest_Interlude_key+0
@ 000 ----------------------------------------
.byte VOICE , 0
.byte VOL , 127*DKC2_-_Forest_Interlude_mvl/mxv
.byte PAN , c_v+0
.byte N12 , Gs0 , v112
.byte W12
.byte N06
.byte W06
.byte N06
.byte W24
.byte N06
.byte W06
.byte N12
.byte W12
.byte N12
.byte W12
.byte N12
.byte W24
@ 001 ----------------------------------------
.byte Fn0
.byte W12
.byte N06
.byte W06
.byte N06
.byte W24
.byte N06
.byte W06
.byte N12
.byte W12
.byte N12
.byte W12
.byte Gs0
.byte W12
.byte An0
.byte W12
@ 002 ----------------------------------------
.byte As0
.byte W12
.byte N06
.byte W06
.byte N06
.byte W24
.byte N06
.byte W06
.byte N12
.byte W12
.byte N12
.byte W12
.byte N12
.byte W24
@ 003 ----------------------------------------
.byte N12
.byte W12
.byte N06
.byte W06
.byte N06
.byte W24
.byte N06
.byte W06
.byte N12
.byte W12
.byte N12
.byte W12
.byte N12
.byte W12
.byte Gs0
.byte W12
.byte GOTO
.word forest_interlude_loop
.byte W06
@ 004 ----------------------------------------
.byte FINE

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

DKC2_-_Forest_Interlude:
.byte 4 @ NumTrks
.byte 0 @ NumBlks
.byte DKC2_-_Forest_Interlude_pri @ Priority
.byte DKC2_-_Forest_Interlude_rev @ Reverb.

.word DKC2_-_Forest_Interlude_grp

.word DKC2_-_Forest_Interlude_1
.word DKC2_-_Forest_Interlude_2
.word DKC2_-_Forest_Interlude_3
.word DKC2_-_Forest_Interlude_4

.end
 
Status
Not open for further replies.
Back
Top