
	Playstation's  SQUARE game music format


̎́ATAB=Xy[X8ŋLqĂ܂B

^ɂ
	BYTE	1byte (char^)
	WORD	2byte (short^ / pointer^)
	DWORD	4byte (long^)

(1) wb_[

1-1.) First() Akao format (24 tracks)	(Final Fantasy 7, Saga Frontier, etc..)
========================================
Address		type	e
+-------+-------+-------+-------+-------
0x0000`0x0003	char[4]	"AKAO" strings
			4Byte̕Bȃf[^ł鎖B
+-------+-------+-------+-------+-------
0x0004`0x0005	word	File serial ID numberH
+-------+-------+-------+-------+-------
0x0006`0x0007	word	File size iheaders of 16[byte] were excluded.j
			t@CTCYi16[byte]̃wb_[͏OBj
+-------+-------+-------+-------+-------
0x0008`0x0009		unknown
+-------+-------+-------+-------+-------
0x000A`0x000F		Time stamp
+-------+-------+-------+-------+-------
0x0010`0x0013	dword	{ȃf[^Ŏgp`l(32bit)
			eBitꂼ̃`lɑΉB
+-------+-------+-------+-------+-------
0x0014`0x0015	word	ȃf[^̂鑊΃AhX{Q@Track 1	c(5)Q
0x0016`0x0017	word	ȃf[^̂鑊΃AhX{Q@Track 2	c(5)Q
0x0018`0x0019	word	ȃf[^̂鑊΃AhX{Q@Track 3	c(5)Q
EEE		word	EEE
0x0030`0x0031	word	ȃf[^̂鑊΃AhX{Q@Track15	c(5)Q
0x0032`0x0033	word	ȃf[^̂鑊΃AhX{Q@Track16	c(5)Q
EEE		word	EEE
0x0040`0x0041	word	ȃf[^̂鑊΃AhX{Q@Track23	c(5)Q
0x0042`0x0043	word	ȃf[^̂鑊΃AhX{Q@Track24	c(5)Q
			Pointer of music tracks.

قƂǂ̃f[^́A16chȓł邪Aꕔ17chȏ゠ȃf[^B
jFINAL FANTASY 7 ẘ@(24ch)xAwX^bt[i20chjx
AKAȎ΃AhX́AĂAhX2Byte_ƂB
========================================



1-2.) Late() Akao format (32 tracks)	(Final Fantasy 2,8,9)
========================================
Address		type	e
+-------+-------+-------+-------+-------
0x0000`0x0003	char[4]	"AKAO" strings.
			4Byte̕Bȃf[^ł鎖B
+-------+-------+-------+-------+-------
0x0004`0x0005	word	File serial ID numberH
+-------+-------+-------+-------+-------
0x0006`0x0007	word	File size
			Yt@C̃TCYB
			"AKAO"N_ƂTCY
+-------+-------+-------+-------+-------
0x0008`0x000F		unknown
+-------+-------+-------+-------+-------
0x0010`0x0013		unknown
+-------+-------+-------+-------+-------
0x0014`0x0017		Instrument set number
+-------+-------+-------+-------+-------
0x0018`0x001F		unknown
+-------+-------+-------+-------+-------
0x0020`0x0023	dword	{ȃf[^Ŏgp`l(32bit)
			eBitꂼ̃`lɑΉB
+-------+-------+-------+-------+-------
0x0024`0x002F		unknown
+-------+-------+-------+-------+-------
0x0030`0x0033	word	Pointer of multi sampling instrument struct.
			gFf[^̑΃AhX	c(2)Q
+-------+-------+-------+-------+-------
0x0034`0x0037	word	Pointer of percussion instrument struc.
			p[JbVFf[^̑΃AhX	c(4)Q
+-------+-------+-------+-------+-------
0x0038`0x003F		unknown
+-------+-------+-------+-------+-------
0x0040`0x0041	word	ȃf[^̂鑊΃AhX@Track 1	c(5)Q
0x0042`0x0043	word	ȃf[^̂鑊΃AhX@Track 2	c(5)Q
0x0044`0x0045	word	ȃf[^̂鑊΃AhX@Track 3	c(5)Q
EEE		word	EEE
0x007C`0x007D	word	ȃf[^̂鑊΃AhX@Track31	c(5)Q
0x007E`0x007F	word	ȃf[^̂鑊΃AhX@Track32	c(5)Q
			Pointer of music tracks.
========================================
΃AhXƂ́ÄʒũItZbgʂB
Ƃ΁A0x0040ɏĂch1̑΃AhX0x0010łꍇA
0x0040{0x00100x0050ԒnAch1̃f[^Ă鎖B
AKAȎ΃AhX́AĂAhX_ƂB





(2) Ff[^@@@ciAKAO wb_[0x0030̓ej

2[Byte]~16̍\(Struct)	iv(total)32Bytej
ȃf[^"0xFE 0x14"Ŏw肳A
wFf[^̏񂪂鑊΃AhX|0x0020x̒l16LڂBc(3)
l0xFFFF̏ꍇ́AYԍ̉F͖gpł鎖B





(3) Ff[^@@@@@@ci(2)̍\̂̓eAyсj
@ciAKAO 0xFCR}ḧ̓ej
8[Byte]~(n)̍\́B\͈ȉ̒ʂ
	+0	Fԍ			Instrument number
	+1	Kṕ͈@Jnm[gԍ	Start applying note number
	+2	Kṕ͈@Im[gԍ	Etart applying note number
	+3	Gx[v֘A		ADSR
	+4	Gx[v֘A		ADSR
	+5	Gx[v֘A		ADSR
	+6	Gx[v֘A		ADSR
	+7	{[			Volume
A8Byte̍\̂S0x00̂Ƃ́A\̂̏Ił鎖B




(4) p[JbVFf[^@@@ciAKAO wb_[0x0034̓ej

8[Byte]~(128)̍\́B
擪8ByteAIN^[u0C,Cis,D,Dis,Ec̉Ff[^B
8Byte̍\͈ȉ̒ʂB
	+0	p[JbVFԍ		Instrument number
	+1	鉹im[gԍj	Note number
	+2	s				unknown
	+3	{[			Volume
	+4	Gx[v֘A		ADSR
	+5	Gx[v֘A		ADSR
	+6	Gx[v֘A		ADSR
	+7	p|bg			Panpot
A8Byte̍\̂S0x00̂Ƃ́Agpł鎖B
\A0x00Ԏ邪AwāAAKAOf[^̏Ił͂Ȃx̂ŁAo͒ӁB
ꕔɂ́Aw0x00AAKAOf[^IxƂĂǁAȎ͖B





(5) `l

========================================
Command	param		MML	@\
+-------+-------+-------+-------+-------
0x00			c1	b
0x01			c2	h
0x02			c4
0x03			c8
0x04			c16
0x05			c32
0x06			c64
0x07			c6
0x08			c12
0x09			c24
0x0A			c48
+-------+-------+-------+-------+-------
0x0B			c+1	bis, cs
0x0C			c+2	h
0x0D			c+4
0x0E			c+8
0x0F			c+16
0x10			c+32
0x11			c+64
0x12			c+6
0x13			c+12
0x14			c+24
0x15			c+48
+-------+-------+-------+-------+-------
0x16			d1	c
0x17			d2	
0x18			d4
0x19			d8
0x1A			d16
0x1B			d32
0x1C			d64
0x1D			d6
0x1E			d12
0x1F			d24
0x20			d48
+-------+-------+-------+-------+-------
0x21			d+1	cis ds
0x22			d+2	
0x23			d+4
0x24			d+8
0x25			d+16
0x26			d+32
0x27			d+64
0x28			d+6
0x29			d+12
0x2A			d+24
0x2B			d+48
+-------+-------+-------+-------+-------
0x2C			e1	d
0x2D			e2	~
0x2E			e4
0x2F			e8
0x30			e16
0x31			e32
0x32			e64
0x33			e6
0x34			e12
0x35			e24
0x36			e48
+-------+-------+-------+-------+-------
0x37			f1	e
0x38			f2	t@
0x39			f4
0x3A			f8
0x3B			f16
0x3C			f32
0x3D			f64
0x3E			f6
0x3F			f12
0x40			f24
0x41			f48
+-------+-------+-------+-------+-------
0x42			f+1	eis, fs
0x43			f+2	t@
0x44			f+4
0x45			f+8
0x46			f+16
0x47			f+32
0x48			f+64
0x49			f+6
0x4A			f+12
0x4B			f+24
0x4C			f+48
+-------+-------+-------+-------+-------
0x4D			g1	f
0x4E			g2	\
0x4F			g4
0x50			g8
0x51			g16
0x52			g32
0x53			g64
0x54			g6
0x55			g12
0x56			g24
0x57			g48
+-------+-------+-------+-------+-------
0x58			g+1	fis, `s
0x59			g+2	\
0x5A			g+4
0x5B			g+8
0x5C			g+16
0x5D			g+32
0x5E			g+64
0x5F			g+6
0x60			g+12
0x61			g+24
0x62			g+48
+-------+-------+-------+-------+-------
0x63			a1	`
0x64			a2	
0x65			a4
0x66			a8
0x67			a16
0x68			a32
0x69			a64
0x6A			a6
0x6B			a12
0x6C			a24
0x6D			a48
+-------+-------+-------+-------+-------
0x6E			a+1	aiaj
0x6F			a+2	
0x70			a+4
0x71			a+8
0x72			a+16
0x73			a+32
0x74			a+64
0x75			a+6
0x76			a+12
0x77			a+24
0x78			a+48
+-------+-------+-------+-------+-------
0x79			b1	giaj
0x7A			b2	V
0x7B			b4
0x7C			b8
0x7D			b16
0x7E			b32
0x7F			b64
0x80			b6
0x81			b12
0x82			b24
0x83			b48
+-------+-------+-------+-------+-------
0x84			^1	^C(Tie)
0x85			^2	
0x86			^4	Ӂ
0x87			^8	R}ȟɂoĂ̂ŁA
0x88			^16	MML2MID@ɂɂ́A
0x89			^32	ỎɃ^C(&)t
0x8A			^64	(r)ɂǂ
0x8B			^6	
0x8C			^12	
0x8D			^24	
0x8E			^48	
+-------+-------+-------+-------+-------
0x8F			r1	x(rest)
0x90			r2
0x91			r4
0x92			r8
0x93			r16
0x94			r32
0x95			r64
0x96			r6
0x97			r12
0x98			r24
0x99			r48
+-------+-------+-------+-------+-------
0x9A			
0x9B			
0x9C			
0x9D			
0x9E			
0x9F			
+-------+-------+-------+-------+-------
0xA0				`lIi[vj
				Music end.

+-------+-------+-------+-------+-------
0xA1			@	F(Instrument)
	bVoice		c	Fԍ

+-------+-------+-------+-------+-------
0xA2				̉ExẢKpB
				This length apply to next note/rest.
	bStep		c	(length) [ticks]

+-------+-------+-------+-------+-------
0xA3	vol			(Volume)
				0xA8Ƃ̂ZsĂ炵B
				ƂƁAMIDI͒ʏ[dB]ł̎w肾A
				wjAlւ̕ϊvB

+-------+-------+-------+-------+-------
0xA4				|^g(Portamento)
	bLength		c	ω̎ [ticks]
	bDepth		c	ω[100cent]

+-------+-------+-------+-------+-------
0xA5	bOctave		o	Octavei4bj
0xA6			>	Octave Up
0xA7			<	Octave Down

+-------+-------+-------+-------+-------
0xA8	bExp		E	Expression

0xA9			UE	Expression move
	bLength		c	ωɗv鎞 [ticks]
	bExp		c	ω̖ڕWl

+-------+-------+-------+-------+-------
0xAA	bPan		p	Panpot

0xAB			UP	Panpot move
	bLength		c	ωɗv鎞 [ticks]
	bPan		c	ω̖ڕWl

+-------+-------+-------+-------+-------
0xAC	b
+-------+-------+-------+-------+-------
	ADSR Gx[v֘A

0xAD	b			Atack Level
0xAE	b			Decay Level
0xAF	b			Sustain Level
0xB0	b1			
	b2			
0xB1	b			
0xB2	b			
0xB3				Gx[vftHgɖ߂(return to default ADSR)

+-------+-------+-------+-------+-------
	ken֘A

	MML2MID@ւ̕ϊ
	@IB n1,n2,n3,n4,n5	c LFO of PitchBend
	@IE n1,n2,n3,n4,n5	c LFO of Expression
	@IP n1,n2,n3,n4,n5	c LFO of Panpot

	@n1 	bDepth		[
	@n2 	1		ݕpx	[ticks]
	@n3 	bDelay		fBC	[ticks]	AǍD
	@n4 	bCount ~2			[ticks]	AǍD
	@n5 	0		fBCQ	[ticks]

	- - - - - - - - - - - - - - - - -
0xB4			IB	kenH
	bDelay		c	fBC [ticks]
	b2		c	H
	bCount		c	̒ [ticks]
0xB5	bDepth		c	őω
0xB6			IB0	~
0xB7	b			

	- - - - - - - - - - - - - - - - -
0xB8			IE	ʂkenH
	bDelay		c	fBC [ticks]
	b2		c	H
	bCount		c	̒ [ticks]
0xB9	bDepth		c	őωʁ@̂܂ExpressionɂƐU
0xBA			IE0	~
0xBB	b			

	- - - - - - - - - - - - - - - - -
0xBC			IP	pken
	b1		c	H
	bCount		c	̒ [ticks]
0xBD	bDepth		c	őωʁ@̂܂PanpotɂƐU
0xBE			IP0	~
0xBF	b		

+-------+-------+-------+-------+-------
0xC0	bTrance		_	Transposition [100cent]
0xC1	bTrance		__	Transposition move [100cent]

+-------+-------+-------+-------+-------
0xC2			y91,100	Reverb on
0xC3			y91,0	Reverb off

+-------+-------+-------+-------+-------
0xC4				Noise on
0xC5				Noise off

+-------+-------+-------+-------+-------
0xC6				FM modulation on
0xC7				FM modulation off

+-------+-------+-------+-------+-------
0xC8			[	Repear start point
0xC9			]	Repeat end point
	bCo		c	Repeat times
0xCA			]2	Repeat end pointirepeat is 2 timesj

+-------+-------+-------+-------+-------
0xCB

+-------+-------+-------+-------+-------
0xCC				Slur(X[) on
0xCD				Slur(X[) off

+-------+-------+-------+-------+-------
0xCE				
0xCF
0xD0				H
0xD1				H
0xD2	b			H
0xD3	b			H
0xD4
0xD5
0xD6
0xD7

+-------+-------+-------+-------+-------
0xD8	bPitch		BS	sb`xhiPitch bendj
				BŔA8ƂĂƁAǂH
0xD9	bPitch		BS	΃sb`xhiPitch bend movej
0xDA				sb`xh֘AH
	b1		c	

+-------+-------+-------+-------+-------
0xDB
0xDC
	b1
+-------+-------+-------+-------+-------
	ken̗LԁiLFO effective timesj
	̖߁i0xDD`0xDFjoꍇAw肳ꂽԂ݂̂kensA
	ȌAkenw(0xB4`0xBER}h)܂łken~B

	MML2MIDɁA̋@\߁AB

0xDD				ken
	wTime		c	L[ticks]i2bytej
0xDE				ʂken
	wTime		c	L[ticks]i2bytej
0xDF				pken
	wTime		c	L[ticks]i2bytej

========================================
Akao for 24ch
+-------+-------+-------+-------+-------
0xE0				End of Channel ?
0xE1				End of Channel ?
0xE2				End of Channel ?
0xE3				End of Channel ?
0xE4				End of Channel ?
0xE5				End of Channel ?
0xE6				End of Channel ?
0xE7				End of Channel ?

+-------+-------+-------+-------+-------
0xE8	wTempo		t	e|(tempo)
				wTempo218 [bpm]

0xE9			t	΃e|(tempo move)
	bLength		c	ωɗv鎞 [ticks]
	wTempo			e|̖ڕWl wTempo218[bpm]

+-------+-------+-------+-------+-------
0xEA	wReverb		Rev()	o[u̐[(Reberb depth)
				

0xEB			Rev()	΃o[u(Reberb depth move)
	bLength		c	ωɗv鎞 [ticks]
	wReverb			o[u̐[(16bit)

+-------+-------+-------+-------+-------
0xEC				percussion on
	wAddress		p[JbV`\̂ւ̑΃AhX
				(Offset address to percussion struct)
				\̂́A5[Byte]~12[]ŁA擪5ByteA
				C,Cis,D,Dis,Ec̉Ff[^B
				@+0 :	p[JbVFԍ		Instrument number
				@+1 :	鉹im[gԍj	Note number
				@+2 :	s				unknown
				@+3 :	{[ijAlj		Volume
				@+4 :	p|bg			Panpot

0xED				percussion off

+-------+-------+-------+-------+-------
0xEE				WviJumpj
				[vɎgiThis used permanent loopj
	wOffset			߂摊΃AhXi2BytẽAhX_ƂBj
				Offset address

+-------+-------+-------+-------+-------
0xEF				s
	b1		c
	b2		c
	b3		c

+-------+-------+-------+-------+-------
0xF0			:	s[g(Repeat break)
	b1		c	s[gڂŕ򂷂邩(Repeat times)
	ptAddr		c	s摊΃AhXi2BytẽAhX_ƂBj
				(Offset address)
+-------+-------+-------+-------+-------
0xF1				s
	b1		c
	b2		c
	b3		c
+-------+-------+-------+-------+-------
0xF2	bVoice		@	FiA^bNj
				Instrument without atack rate of ADSR.
+-------+-------+-------+-------+-------
0xF3				
0xF4	word			H
0xF5				
0xF6	byte			H
0xF7	word			H
0xF8	byte			H
0xF9	byte			H
0xFA				
0xFB				
+-------+-------+-------+-------+-------
0xFC				gFiMulti sampling instrument.j
	wAddress	c	F`\̂ւ̑΃AhX(offset address to struct.)
				\̂̍\(3)QƁB

+-------+-------+-------+-------+-------
0xFD			BT	q(Time Signature)
	bTimebase		̃Xebvi484^248j
	bTime			q

	MML2MID@ւ̕ϊ
	BT n1,n2
		n1 c bTime
		n2 c (192bTimebase)

+-------+-------+-------+-------+-------
0xFE			WC	(Rehearsal number)
	wMeasure		ߔԍi郊n[Tԍj

	MML2MID@ւ̕ϊ
	WC"(wMeasure)10iɃfR[h"

+-------+-------+-------+-------+-------
0xFF				

========================================
Akao for 32ch
+-------+-------+-------+-------+-------
0xE0
0xE1	b1			s
0xE2
0xE3
0xE4
0xE5
0xE6				sifor 32bitj
	b1		c	
	b2		c	
0xE8	
0xE9	
0xEA	
0xEB	
0xEC	
0xED	
0xEE	
0xEF	

+-------+-------+-------+-------+-------
0xF0	bLngth		c%	Xebvw肵Ex
0xF1	bLngth		c+%	
0xF2	bLngth		d%	
0xF3	bLngth		d+%	
0xF4	bLngth		e%	
0xF5	bLngth		f%	
0xF6	bLngth		f+%	
0xF7	bLngth		g%	
0xF8	bLngth		g+%	
0xF9	bLngth		a%	
0xFA	bLngth		a+%	
0xFB	bLngth		b%	
0xFC	bLngth		^%	
0xFD	bLngth		r%	

+-------+-------+-------+-------+-------
0xFE	0x00	wTempo	t	tempo	2byte
				BPMւ̕ΐA218ŊƗǂB

	- - - - - - - - - - - - - - - - -
	0x01	Tempo		tempo moveH

	- - - - - - - - - - - - - - - - -
	0x02			Reverb depthH
		wReverb	c

	- - - - - - - - - - - - - - - - -
	0x03			Reverb depth moveH
		wReverb	c

	- - - - - - - - - - - - - - - - -
	0x04		RT	percussion on

	- - - - - - - - - - - - - - - - -
	0x05			percussion offH

	- - - - - - - - - - - - - - - - -
	0x06			WviJumpj
				[vɎgiThis used permanent loopj
		ptAddr	c	s摊΃AhX(offset address)
				FF9̃X{X́A1`lɂ̃R}h
				QĂB
				@Pst	c@Cxg̖߂
				@Qnd	c@X{X풆̖߂

	- - - - - - - - - - - - - - - - -
	0x07			Q[tOɂicondition jumpj
				iPermanent loop breakj
		b1	c	H@(condition)@H
		ptAddr	c	s摊΃AhX(offset address)
				FF9X{XŎgĂB
				CxgIƁAŏ̖[v𔲂B
				́Äׂ̃R}hƎvB
				xCOgXg[ɂgpĂ͗lB

	- - - - - - - - - - - - - - - - -
	0x09			s[giRepeat breakj
		b1	c	s[gڂŕ򂷂邩(repeat times)
		ptAddr	c	s摊΃AhX(offset address)

	- - - - - - - - - - - - - - - - -
	0x10			s
	(16)	b1	c	

	- - - - - - - - - - - - - - - - -
	0x14		@	gFiMulti sampling instrumentj
	(20)	bPatch	c	number
				0x00̓XgOXł鎖B(OL)

	- - - - - - - - - - - - - - - - -
	0x15			q(Time Signature)
	(21)	bTimeb	c	̃Xebvi484^248j
		bTime	c	q

	MML2MID@ւ̕ϊ
	BT n1,n2
		n1 c bTime
		n2 c (192bTimebase)

	- - - - - - - - - - - - - - - - -
	0x16			ߔԍ(Rehearsal number)
	(22)	wMea	c	ߔԍi郊n[Tԍj

	MML2MID@ւ̕ϊ
	WC"(wMeasure)10iɃfR[h"

	- - - - - - - - - - - - - - - - -
	0x1C			s
	(28)	b1	c	

	- - - - - - - - - - - - - - - - -
	0x1D			s
	(29)

	- - - - - - - - - - - - - - - - -
	0x1E			s
	(30)

	- - - - - - - - - - - - - - - - -
	0x1F			s
	(31)

+-------+-------+-------+-------+-------
0xFF

========================================


