//------------------------------------------------------------------------------ Header.
/*
僐乕僪僕僃僱儗乕僞亀僐乕僪俆亁
ver.1.07 LastUpdate = 2002/12/23丂傒偠傫偙

亀僥儞億儔儕僗働乕儔僒億乕僩亁
	儌乕僪宯
	僴乕儌僯僢僋宯
	儊儘僨傿僢僋宯

	奺庬僗働乕儖偼巊梡帪丄慡僩儔僢僋偵懳偟偰
	桳岠偵側傝丄壗傪巊梡偟偨偺偐偑僌儘乕僶儖
	曄悢傊巆傝傑偡丅

亀僨傿僌儕乕僱乕儉僒億乕僩亁
	僩儔僀傾僪
	俽倳倱係
	俈倲倛
	俋倲倛

	嘥,嘦,嘨,嘩,嘪,嘫,嘮偦傟偧傟偵俁榓壒丄係榓壒
	俋倲倛丄僒僗儁儞僪係偑梡堄偝傟丄慡偰偺榓壒偼
	僗働乕儖儅僋儘偵傛偭偰曄宍偟傑偡丅

亀僀儞僶乕僩僒億乕僩亁
	僩儔僀傾僪
	俈倲倛
	俋倲倛
	僆乕僾儞儃僀僔儞僌乮亄僀儞僞乕僶儖僗僾儗僢僟乯
	僋儘乕僘儃僀僔儞僌

	榓壒慡懱偺崅偝傪帺桼偵忋壓偝偣傞帠偑壜擻偱
	峏偵僆乕僾儞丒僋儘乕僘偺慖戰丄僆乕僾儞偺応崌
	偼奐偒嬶崌傪俀抜奒偱挷愡偱偒傑偡丅

亀僀儞僒乕僩僐乕僪僒億乕僩乮僆乕僩僗働乕儖乯亁
	僙僇儞僟儕僪儈僫儞僩
	棤僐乕僪
	僷僢僔儞僌僨傿儈僯僢僔儏
	嘦嘪乮恊僐乕僪儅僀僫乕帪丄嘦亖倣俈侒俆乯
	嘦嘪乮嘪亖棤僐乕僪乯
	僪僢儁儖僪儈僫儞僩
	僕儍僘僗僞僀儖偺僪儈僫儞僩奺庬

	榓壒偵懳偟丄庤慜偺彫愡傊條乆側婡擻偺僐乕僪傪
	憓擖偡傞帠偑弌棃丄偦傟偵傛偭偰惗偠偨挷崋偺
	曄壔傗堏挷偼帺摦偱慡僩儔僢僋偵揔梡偝傟傑偡丅

亀僼僃僀儞僩僒億乕僩亁
	僀儞僒乕僩僐乕僪巊梡帪丄偦傟傪屇傃弌偟偨
	恊僐乕僪傪儈儏乕僩偡傞僼僃僀儞僩偑巊梡壜擻
	偱偡丅

亀僆乕儖儈儏乕僩僒億乕僩亁
	嬋偑姰惉偟 chord5.h 偵傛傞僈僀僪壒偑
	昁梫側偔側偭偨帪丄僗働乕儖偺愝掕偩偗傪
	巆偟偰僈僀僪壒傪徚壒偡傞帠偑弌棃傑偡丅

亀俿俽俢巜掕僒億乕僩亁
	俿乮儊僕儍乕宯僩僯僢僋乯		侾俇庬
	俽乮儊僕儍乕宯僒僽僪儈僫儞僩乯	侾俁庬
	俢乮儊僕儍乕宯僪儈僫儞僩乯		侾俀庬
	俿倣乮儅僀僫乕宯僩僯僢僋乯		侾俀庬
	俽倣乮儅僀僫乕宯僒僽僪儈僫儞僩乯	侾俁庬
	俢倣乮儅僀僫乕宯僪儈僫儞僩乯		侾俆庬

	僐乕僪傪婡擻柤偱巜掕壜擻丅
	僨傿僌儕乕僱乕儉巜掕偱僒億乕僩偝傟偰偄傞
	
	丒僀儞僶乕僩
	丒僀儞僒乕僩乮僆乕僩僗働乕儖乯
	丒僼僃僀儞僩
	丒僆乕儖儈儏乕僩
	
	偙傟傜慡偰偵傾僋僙僗壜擻丄僗働乕儖偼
	帺摦愝掕偱丄挷崋偺曄壔偑慡僩儔僢僋偵
	揔梡偝傟傑偡丅

亀僆乕僩僩儔儞僗億僕僔儑儞僒億乕僩亁
	俆搙寳傊偺堏挷傪乽堏挷偡傞暆乮僉乕僔僼僩抣乯乿
	偱偼側偔乽揮挷姶偺嫮偝乿偲偟偰巜掕偡傞帠偑
	弌棃傑偡丅

	偙傟偵傛傝丄俆搙寳丄嬤恊挷丄摨庡挷偲偄偆
	奣擮傪抦傜側偔偰傕惓妋偵揮挷偡傞帠偑弌棃丄
	揮挷屻僗儉乕僘偵尦偺挷傊栠偭偰棃傞帠偑
	壜擻偱偡丅


 (Tab = 6)
*/
//------------------------------------------------------------------------------
Int Open		= 0				// 僆乕僾儞儃僀僔儞僌僼儔僌(1=open,2=more)
Int NowScale	= 0				// 尰嵼偺僗働乕儖
Int ModeNo		= 0				// 儌乕僪巜掕梡曄悢
Int RootBass	= 0				// 儀乕僗壒僈僀僪敪壒(0=on)
Int Chord5_off	= 0				// 敪壒僼儔僌乮僆僼帪丄僗働乕儔偺傒摦嶌乯
Int Feint		= 0				// 僼僃僀儞僩僼儔僌
Int Relative	= 0				// 僩儔儞僗梡曄悢
Int Shift_val	= 0				// 僩儔儞僗梡曄悢
Int InsertMode	= 0				// 僐儞儃梡曄悢
Int LenII		= 0				// 僐儞儃梡堷悢
Int InvII		= 0				// 僐儞儃梡堷悢
Int LenIII		= 0				// 僐儞儃梡堷悢
Int InvIII		= 0				// 僐儞儃梡堷悢
Int Disp		= 1				// 僿儖僾昞帵梡僼儔僌
Int Top		= 0				// 僩僢僾僲乕僩梡曄悢
//------------------------------------------------------------------------------ TransFunction.

Function Trans(Value){
	TimeKey2(,,Shift_val)						// 堦扷僉乕傪尦傊栠偡
	Relative = Value * 5						// 堷悢傪俆搙寳傊曄姺
	Shift_val = Relative % 12					// 僆僋僞乕僽僔僼僩乮梋傝偑幚嵺偺Key抣乯
	If( Shift_val> 6 ){ Shift_val = Shift_val - 12 }	// 忋曽偵懳偡傞曗惓
	If( Shift_val<-6 ){ Shift_val = Shift_val + 12 }	// 壓曽偵懳偡傞曗惓
	TimeKey2(,,Shift_val)						// 栚揑偺僉乕傊僔僼僩
//	Print (Shift_val)
	Shift_val = MML(TimeKey2) - Shift_val			// 師夞尦傊栠偡堊偺忣曬傪巆偡
}

//------------------------------------------------------------------------------ InvertFunction.

//=================================
//丂僩儔僀傾僪僀儞僶乕僩
//=================================
Function Invert3(){
	Int O_value = Inv / 3;			// 僀儞僶乕僩抣偼俁扨埵偱僆僋僞乕僽傾僢僾側偺偱乧
	Int O_shift = O_value * 12;		// 俁偱妱偭偨抣偑僆僋僞乕僽抣偵側傞
	Note1 = Note1 + O_shift;		// 偦傟偧傟偺僲乕僩傪僆僋僞乕僽挷惍
	Note2 = Note2 + O_shift;
	Note3 = Note3 + O_shift;
	Int AAA = O_value * 3;			// 僆僋僞乕僽抣偵俁傪偐偗偰乧
	Inv = Inv - AAA				// 僀儞僶乕僩抣偐傜堷偔偲乽梋傝乿偑弌傞
	/* 乽梋傝乿抣偵傛偭偰僀儞僶乕僩乮夞揮乯偝偣傞 */
	If(Inv==-2){Note3 = Note3 - 12; Note2 = Note2 - 12}
	If(Inv==-1){Note3 = Note3 - 12}
	If(Inv==1){Note1 = Note1 + 12}
	If(Inv==2){Note1 = Note1 + 12; Note2 = Note2 + 12}
	/* 僆乕僾儞壔 */
	If(Open==1){
		Note3 = Note3 - 12;
	}
	If(Open==2){
		Note3 = Note3 - 12;
		Note2 = Note2 + 12;
	}
}

//=================================
//丂俈倲倛僀儞僶乕僩
//=================================
Function Invert4(){
	Int O_value = Inv / 4;			// 僀儞僶乕僩抣偼係扨埵偱僆僋僞乕僽傾僢僾側偺偱乧
	Int O_shift = O_value * 12;		// 係偱妱偭偨抣偑僆僋僞乕僽抣偵側傞
	Note1 = Note1 + O_shift;		// 偦傟偧傟偺僲乕僩傪僆僋僞乕僽挷惍
	Note2 = Note2 + O_shift;
	Note3 = Note3 + O_shift;
	Note4 = Note4 + O_shift;
	Int AAA = O_value * 4;			// 僆僋僞乕僽抣偵係傪偐偗偰乧
	Inv = Inv - AAA				// 僀儞僶乕僩抣偐傜堷偔偲乽梋傝乿偑弌傞
	/* 乽梋傝乿抣偵傛偭偰僀儞僶乕僩乮夞揮乯偝偣傞 */
	If(Inv==-3){Note4 = Note4 - 12; Note3 = Note3 - 12; Note2 = Note2 - 12}
	If(Inv==-2){Note4 = Note4 - 12; Note3 = Note3 - 12}
	If(Inv==-1){Note4 = Note4 - 12}
	If(Inv==1){Note1 = Note1 + 12}
	If(Inv==2){Note1 = Note1 + 12; Note2 = Note2 + 12}
	If(Inv==3){Note1 = Note1 + 12; Note2 = Note2 + 12; Note3 = Note3 + 12}
	/* 僆乕僾儞壔 */
	If(Open==1){
		Note3 = Note3 - 12;
	}
	If(Open==2){
		Note3 = Note3 - 12;
		Note2 = Note2 + 12;
	}
}

//=================================
//丂俋倲倛僀儞僶乕僩
//=================================
Function Invert5(){
	Int O_value = Inv / 4;			// 僀儞僶乕僩抣偼係扨埵偱僆僋僞乕僽傾僢僾側偺偱乧
	Int O_shift = O_value * 12;		// 係偱妱偭偨抣偑僆僋僞乕僽抣偵側傞
	Note1 = Note1 + O_shift;		// 偦傟偧傟偺僲乕僩傪僆僋僞乕僽挷惍
	Note2 = Note2 + O_shift;
	Note3 = Note3 + O_shift;
	Note4 = Note4 + O_shift;
	Int AAA = O_value * 4;			// 僆僋僞乕僽抣偵係傪偐偗偰乧
	Inv = Inv - AAA				// 僀儞僶乕僩抣偐傜堷偔偲乽梋傝乿偑弌傞
	/* 乽梋傝乿抣偵傛偭偰僀儞僶乕僩乮夞揮乯偝偣傞 */
	If(Inv==-3){Note4 = Note4 - 12; Note3 = Note3 - 12; Note2 = Note2 - 12}
	If(Inv==-2){Note4 = Note4 - 12; Note3 = Note3 - 12}
	If(Inv==-1){Note4 = Note4 - 12}
	If(Inv==1){Note1 = Note1 + 12}
	If(Inv==2){Note1 = Note1 + 12; Note2 = Note2 + 12}
	If(Inv==3){Note1 = Note1 + 12; Note2 = Note2 + 12; Note3 = Note3 + 12}
	/* 僆乕僾儞壔 */
	If(Open==1){
		Note3 = Note3 - 12;
	}
	If(Open==2){
		Note3 = Note3 - 12;
		Note2 = Note2 + 12;
	}
}
//------------------------------------------------------------------------------ KeyMacro.
/* chord3.h compatible */
#KEY_C	= {TimeKey(,,0)}
#KEY_Cp	= {TimeKey(,,1)}
#KEY_D	= {TimeKey(,,2)}
#KEY_Dp	= {TimeKey(,,3)}
#KEY_E	= {TimeKey(,,4)}
#KEY_F	= {TimeKey(,,5)}
#KEY_Fp	= {TimeKey(,,6)}
#KEY_G	= {TimeKey(,,-5)}
#KEY_Gp	= {TimeKey(,,-4)}
#KEY_A	= {TimeKey(,,-3)}
#KEY_Ap	= {TimeKey(,,-2)}
#KEY_B	= {TimeKey(,,-1)}
/* extension */
#KEY_Dm	= {TimeKey(,,1)}
#KEY_Em	= {TimeKey(,,3)}
#KEY_Gm	= {TimeKey(,,6)}
#KEY_Am	= {TimeKey(,,-4)}
#KEY_Bm	= {TimeKey(,,-2)}
//------------------------------------------------------------------------------ ModeMacro.
/* Major scale */
#Major = {
	TimeKeyFlag(,,0,0,0,0,0,0,0);			/* Major scale */
	NowScale = 0
}

/* Minor scale */
#Minor = {
	TimeKeyFlag(,,-1,-1,0,0,-1,0,0);		/* Minor scale */
	NowScale = 5
}

/* Mode */
#Mode = {
	ModeNo = #?1
	If(ModeNo==0){
	TimeKeyFlag(,,0,0,0,0,0,0,0);			/* Ionian */
	NowScale = 0
	}
	If(ModeNo==1){
	TimeKeyFlag(,,0,-1,0,0,-1,0,0);		/* Dorian */
	NowScale = 1
	}
	If(ModeNo==2){
	TimeKeyFlag(,,-1,-1,0,-1,-1,0,0);		/* Phrygian */
	NowScale = 2
	}
	If(ModeNo==3){
	TimeKeyFlag(,,0,0,0,0,0,1,0);			/* Lydian */
	NowScale = 3
	}
	If(ModeNo==4){
	TimeKeyFlag(,,0,-1,0,0,0,0,0);		/* Mixo-Lydian */
	NowScale = 4
	}
	If(ModeNo==5){
	TimeKeyFlag(,,-1,-1,0,0,-1,0,0);		/* Aeolian */
	NowScale = 5
	}
	If(ModeNo==6){
	TimeKeyFlag(,,-1,-1,0,-1,-1,0,-1);		/* Locrian */
	NowScale = 6
	}
	If(ModeNo==7){
	TimeKeyFlag(,,1,0,0,1,1,1,0);			/* Pentatonic minor blues */
	NowScale = 7
	}
}

/* Harmonic minor class */
#HMinor = {
	ModeNo = #?1
	If(ModeNo==0){
	TimeKeyFlag(,,-1,0, 0,0,-1,0,0);		/* Harmonic minor */
	NowScale = 10
	}
	If(ModeNo==1){
	TimeKeyFlag(,,0,-1,0,-1,-1,0,-1);		/* Locrian natural13 */
	NowScale = 11
	}
	If(ModeNo==2){
	TimeKeyFlag(,,0,0,0,0,0,0,1);			/* Ionian #5 */
	NowScale = 12
	}
	If(ModeNo==3){
	TimeKeyFlag(,,0,-1,0,0,-1,1,0);		/* Dorian #11 */
	NowScale = 13
	}
	If(ModeNo==4){
	TimeKeyFlag(,,-1,-1,0,-1,0,0,0);		/* Harmonic minor perfect 5th below */
	NowScale = 14
	}
	If(ModeNo==5){
	TimeKeyFlag(,,0,0,0,1,0,1,0);			/* Lydian #9 */
	NowScale = 15
	}
	If(ModeNo==6){
	TimeKeyFlag(,,-1,-2,0,-1,-1,-1,-1);		/* Altered -7 */
	NowScale = 16
	}
}

/* Melodic minor class */
#MMinor = {
	ModeNo = #?1
	If(ModeNo==0){
	TimeKeyFlag(,,0,0,0,0,-1,0,0);		/* Melodic minor */
	NowScale = 20
	}
	If(ModeNo==1){
	TimeKeyFlag(,,0,-1,0,-1,-1,0,0);		/* Dorian -9 */
	NowScale = 21
	}
	If(ModeNo==2){
	TimeKeyFlag(,,0,0,0,0,0,1,1);			/* Lydian #5 */
	NowScale = 22
	}
	If(ModeNo==3){
	TimeKeyFlag(,,0,-1,0,0,0,1,0);		/* Mixo-Lydian #11 (Lydian 7) */
	NowScale = 23
	}
	If(ModeNo==4){
	TimeKeyFlag(,,-1,-1,0,0,0,0,0);		/* Mixo-Lydian -13 */
	NowScale = 24
	}
	If(ModeNo==5){
	TimeKeyFlag(,,-1,-1,0,0,-1,0,-1);		/* Aeolian -5 (Super Locrian) */
	NowScale = 25
	}
	If(ModeNo==6){
	TimeKeyFlag(,,-1,-1,0,-1,-1,-1,-1);		/* Altered */
	NowScale = 26
	}
	If(ModeNo==7){
	TimeKeyFlag(,,-1,-1,-1,-1,-1,0,0);		/* G Altered */
	NowScale = 27
	}
}

/* Mode Undo */
#ModeUndo = {
	If(NowScale==0){ #Mode(0) }
	If(NowScale==1){ #Mode(1) }
	If(NowScale==2){ #Mode(2) }
	If(NowScale==3){ #Mode(3) }
	If(NowScale==4){ #Mode(4) }
	If(NowScale==5){ #Mode(5) }
	If(NowScale==6){ #Mode(6) }
	If(NowScale==7){ #Mode(7) }
	If(NowScale==10){ #HMinor(0) }
	If(NowScale==11){ #HMinor(1) }
	If(NowScale==12){ #HMinor(2) }
	If(NowScale==13){ #HMinor(3) }
	If(NowScale==14){ #HMinor(4) }
	If(NowScale==15){ #HMinor(5) }
	If(NowScale==16){ #HMinor(6) }
	If(NowScale==20){ #MMinor(0) }
	If(NowScale==21){ #MMinor(1) }
	If(NowScale==22){ #MMinor(2) }
	If(NowScale==23){ #MMinor(3) }
	If(NowScale==24){ #MMinor(4) }
	If(NowScale==25){ #MMinor(5) }
	If(NowScale==26){ #MMinor(6) }
	If(NowScale==27){ #MMinor(7) }
}

//------------------------------------------------------------------------------ MainFunction.

/* 嘦 */
Function Two(Len,Inv){
	Int Note0 = NoteNo(o4d);
	Int Note1 = NoteNo(o5d);
	Int Note2 = NoteNo(o5f);
	Int Note3 = NoteNo(o5a);
	Int Note4 = NoteNo(o6c);
	Invert4()
	If(Len==0){Len = MML(l)};			// 傕偟儗儞僌僗偑徣棯偝傟偰偨傜俴抣偐傜庢摼
	If(Chord5_off==0){
		If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}Else{
		r%(Len);
	}
}

/* 嘪 */
Function Domi(Len,Inv){
	Int Note0 = NoteNo(o3g);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Invert4()
	If(Len==0){Len = MML(l)};			// 傕偟儗儞僌僗偑徣棯偝傟偰偨傜俴抣偐傜庢摼
	If(Chord5_off==0){
		If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}Else{
		r%(Len);
	}
}

/* dim */
Function Dimi(Len,Inv){
	Int Note0 = NoteNo(o3b);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Invert4()
	If(Len==0){Len = MML(l)};			// 傕偟儗儞僌僗偑徣棯偝傟偰偨傜俴抣偐傜庢摼
	If(Chord5_off==0){
		If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}Else{
		r%(Len)
	}
}



/* Secondry dominant insert */
Function SecD(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	/* 尦僐乕僪偑儅僀僫乕偩偭偨傜僪儈僫儞僩偼僴乕儌僯僢僋 */
	If(Which_is==4){TimeKeyFlag(,,0,0,0,0,0,0,0)}
	If(Which_is==3){TimeKeyFlag(,,-1,0,0,0,-1,0,0)}
	If(Which_is==-8){TimeKeyFlag(,,0,0,0,0,0,0,0)}
	If(Which_is==-9){TimeKeyFlag(,,-1,0,0,0,-1,0,0)}
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒丂Combo!!"} }
	Domi(LenII,InvII+DefInv+Inv)			// 僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}

/* Secondry dominant sub-chord insert */
Function SubD(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,-1,-1,-1,-1,-1,0,0)		// 僆儖僞乕僪丒僷乕僼僃僋僩俆th價儘僂
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒丂Combo!!"} }
	Two(LenII,InvII+DefInv+Inv)			// 棤僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}

/* Passing diminished insert */
Function P_Dim(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,-1,0,0,0,-1,0,0)		// 僴乕儌僯僢僋儅僀僫乕
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖僔丂丂僔丒儗丒僼傽丒儔偺榓壒丂Combo!!"} }
	Dimi(LenII,InvII+DefInv+Inv)			// 僷僢僔儞僌傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}

/* 嘦嘪 insert */
Function SecD_2(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	/* 尦僐乕僪偑儅僀僫乕偩偭偨傜僪儈僫儞僩偼僴乕儌僯僢僋 */
	//Int Which_is = 4
	If(Which_is==4){TimeKeyFlag(,,0,0,0,0,0,0,0)}
	If(Which_is==3){TimeKeyFlag(,,-1,0,0,0,-1,0,0)}
	If(Which_is==-8){TimeKeyFlag(,,0,0,0,0,0,0,0)}
	If(Which_is==-9){TimeKeyFlag(,,-1,0,0,0,-1,0,0)}
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒丂Combo!!"} }
	Two(LenII,InvII+DefInv+Inv)			// 嘦傪憓擖
	If(LenIII==0){LenIII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒丂Cool!!"} }
	Domi(LenIII,InvIII+DefInv+Inv)		// 僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
	LenIII = 0
	InvIII = 0
}

/* 嘦 + Secondry dominant sub-chord insert */
Function SubD_2(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,0,0,0,0,0,0,0)			// 傾僀僆僯傾儞
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒丂Combo!!"} }
	Two(LenII,InvII+DefInv+Inv)			// 嘦傪憓擖
	TimeKeyFlag(,,-1,-1,-1,-1,-1,0,0)		// 嘪僆儖僞乕僪
	If(LenIII==0){LenIII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒丂Cool!!"} }
	Two(LenIII,InvIII+DefInv+Inv)			// 棤僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
	LenIII = 0
	InvIII = 0
}

/* Doppel insert */
Function DopD(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,0,0,0,0,0,1,0)			// 儕僨傿傾儞
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒丂Combo!!"} }
	Two(LenII,InvII+DefInv+Inv)			// 嘦傪憓擖
	If(LenIII==0){LenIII = MML(l)}
	/* 尦僐乕僪偑儅僀僫乕偩偭偨傜僪儈僫儞僩偼僴乕儌僯僢僋 */
	If(Which_is==4){TimeKeyFlag(,,0,0,0,0,0,0,0)}
	If(Which_is==3){TimeKeyFlag(,,-1,0,0,0,-1,0,0)}
	If(Which_is==-8){TimeKeyFlag(,,0,0,0,0,0,0,0)}
	If(Which_is==-9){TimeKeyFlag(,,-1,0,0,0,-1,0,0)}
	If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒丂Cool!!"} }
	Domi(LenIII,InvIII+DefInv+Inv)		// 僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
	LenIII = 0
	InvIII = 0
}

/* Secondry dominant insert (For jazz) */
Function JazzD1(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,0,0,1,0,0,0,0)			// 嘪7儕僨傿傾儞俈倲倛
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒丂Jazzy!!"} }
	Domi(LenII,InvII+DefInv+Inv)			// 僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}

/* Secondry dominant insert (For jazz) */
Function JazzD2(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,-1,-1,-1,-1,-1,0,0)		// 嘪m7侒5僆儖僞乕僪
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒丂Jazzy!!"} }
	Domi(LenII,InvII+DefInv+Inv)			// 僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}

/* Secondry dominant insert (For jazz) */
Function JazzD3(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,0,-1,0,-1,-1,0,0)		// 嘪m7侒5僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒丂Jazzy!!"} }
	Domi(LenII,InvII+DefInv+Inv)			// 僪儈僫儞僩傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}

/* Secondry dominant insert (For jazz) */
Function JazzD4(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,0,0,1,0,0,0,0)			// 嘪7儕僨傿傾儞俈倲倛
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒丂Jazzy!!"} }
	Two(LenII,InvII+DefInv+Inv)			// 嘦mM7傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}

/* Secondry dominant insert (For jazz) */
Function JazzD5(){
	Int KSValue = Note0 - NoteNo(o4c);		// 僪偲儖乕僩偺僀儞僞乕僶儖傪挷傋傞
	If(KSValue<-4){KSValue=KSValue+12}		// 儀乕僗偑掅夁偓偨傜僆僋僞乕僽傾僢僾
	Int NowKey = MML(TimeKey);			// 僉乕僔僼僩抣傪挷傋偰
	Int KSTrue = KSValue + NowKey			// 僙僇儞僟儕偺僗働乕儖奐巒抧揰傪弌偡
	TimeKey(,,KSTrue);				// 僙僇儞僟儕偺儖乕僩傊堏挷
	TimeKeyFlag(,,0,-1,0,-1,-1,0,0)		// 嘪m7侒5僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(LenII==0){LenII = MML(l)}
	If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒丂Jazzy!!"} }
	Two(LenII,InvII+DefInv+Inv)			// 嘦augM7傪憓擖
	TimeKey(,,NowKey)					// 挷傪尦傊栠偡
	#ModeUndo						// 僗働乕儖傕尦傊栠偡
	LenII = 0
	InvII = 0
}



/* C_ */
Function C_(Len,Inv){
	Int Note0 = NoteNo(o4c);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o6c);
	Int Which_is = NoteNo(o4e) - NoteNo(o4c)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僪丂丂僪丒儈丒僜偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僪丂丂僪丒儈丒僜偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* D_ */
Function D_(Len,Inv){
	Int Note0 = NoteNo(o4d);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6d);
	Int Which_is = NoteNo(o4f) - NoteNo(o4d)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* E_ */
Function E_(Len,Inv){
	Int Note0 = NoteNo(o4e);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o5b);
	Int Which_is = NoteNo(o4g) - NoteNo(o4e)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -2; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -2; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -2; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -2; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -2; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儈丂丂儈丒僜丒僔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儈丂丂儈丒僜丒僔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* F_ */
Function F_(Len,Inv){
	Int Note0 = NoteNo(o4f);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6c);
	Int Which_is = NoteNo(o4a) - NoteNo(o4f)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -2; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僼傽丂僼傽丒儔丒僪偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僼傽丂僼傽丒儔丒僪偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* G_ */
Function G_(Len,Inv){
	Int Note0 = NoteNo(o3g);
	Int Note1 = NoteNo(o5g);
	Int Note2 = NoteNo(o5b);
	Int Note3 = NoteNo(o6d);
	Int Which_is = NoteNo(o4b) - NoteNo(o4g)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -2; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -2; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -2; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -2; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -2; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* A_ */
Function A_(Len,Inv){
	Int Note0 = NoteNo(o3a);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6c);
	Int Which_is = NoteNo(o5c) - NoteNo(o4a)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儔丂丂儔丒僪丒儈偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儔丂丂儔丒僪丒儈偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* B_ */
Function B_(Len,Inv){
	Int Note0 = NoteNo(o3b);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5b);
	Int Note3 = NoteNo(o6d);
	Int Which_is = NoteNo(o5d) - NoteNo(o4b)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僔丂丂僔丒儗丒僼傽偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僔丂丂僔丒儗丒僼傽偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Csus4 */
Function C_4(Len,Inv){
	Int Note0 = NoteNo(o4c);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o6c);
	Int Which_is = NoteNo(o4e) - NoteNo(o4c)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僪丂丂僪丒僼傽丒僜偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僪丂丂僪丒僼傽丒僜偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Dsus4 */
Function D_4(Len,Inv){
	Int Note0 = NoteNo(o4d);
	Int Note1 = NoteNo(o5g);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6d);
	Int Which_is = NoteNo(o4f) - NoteNo(o4d)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僜丒儔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僜丒儔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Esus4 */
Function E_4(Len,Inv){
	Int Note0 = NoteNo(o4e);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o5b);
	Int Which_is = NoteNo(o4g) - NoteNo(o4e)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -2; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -2; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -2; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儈丂丂儈丒儔丒僔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儈丂丂儈丒儔丒僔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Fsus4 */
Function F_4(Len,Inv){
	Int Note0 = NoteNo(o4f);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5b);
	Int Note3 = NoteNo(o6c);
	Int Which_is = NoteNo(o4a) - NoteNo(o4f)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -2; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -2; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -2; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僼傽丂僼傽丒僔丒僪偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僼傽丂僼傽丒僔丒僪偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Gsus4 */
Function G_4(Len,Inv){
	Int Note0 = NoteNo(o3g);
	Int Note1 = NoteNo(o5g);
	Int Note2 = NoteNo(o6c);
	Int Note3 = NoteNo(o6d);
	Int Which_is = NoteNo(o4b) - NoteNo(o4g)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -2; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -2; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -2; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -2; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -2; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僪丒儗偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僪丒儗偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Asus4 */
Function A_4(Len,Inv){
	Int Note0 = NoteNo(o3a);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6d);
	Int Which_is = NoteNo(o5c) - NoteNo(o4a)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儔丂丂儔丒儗丒儈偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儔丂丂儔丒儗丒儈偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Bsus4 */
Function B_4(Len,Inv){
	Int Note0 = NoteNo(o3b);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5f);
	Int Note3 = NoteNo(o5b);
	Int Which_is = NoteNo(o5d) - NoteNo(o4b)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert3()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僔丂丂僔丒儈丒僼傽偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僔丂丂僔丒儈丒僼傽偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* C7 */
Function C_7(Len,Inv){
	Int Note0 = NoteNo(o4c);
	Int Note1 = NoteNo(o5c);
	Int Note2 = NoteNo(o5e);
	Int Note3 = NoteNo(o5g);
	Int Note4 = NoteNo(o5b);
	Int Which_is = NoteNo(o4e) - NoteNo(o4c)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert4()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僪丂丂僪丒儈丒僜丒僔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僪丂丂僪丒儈丒僜丒僔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* D7 */
Function D_7(Len,Inv){
	Int Note0 = NoteNo(o4d);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o5c);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o4f) - NoteNo(o4d)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert4()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儗丂丂儗丒僼傽丒儔丒僪偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* E7 */
Function E_7(Len,Inv){
	Int Note0 = NoteNo(o4e);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o4g) - NoteNo(o4e)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert4()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儈丂丂儈丒僜丒僔丒儗偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儈丂丂儈丒僜丒僔丒儗偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* F7 */
Function F_7(Len,Inv){
	Int Note0 = NoteNo(o4f);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6c);
	Int Note4 = NoteNo(o6e);
	Int Which_is = NoteNo(o4a) - NoteNo(o4f)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert4()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僼傽丂僼傽丒儔丒僪丒儈偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僼傽丂僼傽丒儔丒僪丒儈偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* G7 */
Function G_7(Len,Inv){
	Int Note0 = NoteNo(o3g);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o4b) - NoteNo(o4g)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -3; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -2; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -2; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -2; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -2; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert4()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僜丒僔丒儗丒僼傽偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* A7 */
Function A_7(Len,Inv){
	Int Note0 = NoteNo(o3a);
	Int Note1 = NoteNo(o5g);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o5c);
	Int Note4 = NoteNo(o6e);
	Int Which_is = NoteNo(o5c) - NoteNo(o4a)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  2; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert4()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儔丂丂儔丒僪丒儈丒僜偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儔丂丂儔丒僪丒儈丒僜偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* B7 */
Function B_7(Len,Inv){
	Int Note0 = NoteNo(o3b);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o5d) - NoteNo(o4b)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert4()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僔丂丂僔丒儗丒僼傽丒儔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僔丂丂僔丒儗丒僼傽丒儔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* C9 */
Function C_9(Len,Inv){
	Int Note0 = NoteNo(o4c);
	Int Note1 = NoteNo(o5e);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o4e) - NoteNo(o4c)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert5()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僪丂丂儈丒僜丒僔丒儗偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僪丂丂儈丒僜丒僔丒儗偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* D9 */
Function D_9(Len,Inv){
	Int Note0 = NoteNo(o4d);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6c);
	Int Note4 = NoteNo(o6e);
	Int Which_is = NoteNo(o4f) - NoteNo(o4d)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  0; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  0; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  0; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  0; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert5()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儗丂丂僼傽丒儔丒僪丒儈偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儗丂丂僼傽丒儔丒僪丒儈偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* E9 */
Function E_9(Len,Inv){
	Int Note0 = NoteNo(o4e);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o4g) - NoteNo(o4e)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert5()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儈丂丂僜丒僔丒儗丒僼傽偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儈丂丂僜丒僔丒儗丒僼傽偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* F9 */
Function F_9(Len,Inv){
	Int Note0 = NoteNo(o4f);
	Int Note1 = NoteNo(o5g);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o6c);
	Int Note4 = NoteNo(o6e);
	Int Which_is = NoteNo(o4a) - NoteNo(o4f)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert5()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僼傽丂儔丒僪丒儈丒僜偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僼傽丂儔丒僪丒儈丒僜偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* G9 */
Function G_9(Len,Inv){
	Int Note0 = NoteNo(o3g);
	Int Note1 = NoteNo(o5f);
	Int Note2 = NoteNo(o5a);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o4b) - NoteNo(o4g)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv = -2; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv = -1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv = -2; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv = -2; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv = -1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv = -2; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv = -2; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv = -2; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv = -2; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv = -1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv = -1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert5()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僔丒儗丒僼傽丒儔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僜丂丂僔丒儗丒僼傽丒儔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* A9 */
Function A_9(Len,Inv){
	Int Note0 = NoteNo(o3a);
	Int Note1 = NoteNo(o5c);
	Int Note2 = NoteNo(o5g);
	Int Note3 = NoteNo(o5b);
	Int Note4 = NoteNo(o6e);
	Int Which_is = NoteNo(o5c) - NoteNo(o4a)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  1; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  1; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  1; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  2; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  1; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  1; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  1; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  1; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert5()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖儔丂丂僪丒儈丒僜丒僔偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖儔丂丂僪丒儈丒僜丒僔偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* B9 */
Function B_9(Len,Inv){
	Int Note0 = NoteNo(o3b);
	Int Note1 = NoteNo(o5c);
	Int Note2 = NoteNo(o5f);
	Int Note3 = NoteNo(o5a);
	Int Note4 = NoteNo(o6d);
	Int Which_is = NoteNo(o5d) - NoteNo(o4b)		// 儊僕儍乕偐儅僀僫乕偐傪巆偡
	If(InsertMode==1){ Int DefInv =  0; SecD() }	// 僙僇儞僟儕僪儈僫儞僩
	If(InsertMode==2){ Int DefInv =  1; SubD() }	// 棤僐乕僪
	If(InsertMode==3){ Int DefInv =  0; P_Dim() }	// 僷僢僔儞僌僨傿儈僯僢僔儏
	If(InsertMode==4){ Int DefInv =  0; SecD_2() }	// 嘦嘪
	If(InsertMode==5){ Int DefInv =  1; SubD_2() }	// 嘦嘪乮棤僐乕僪乯
	If(InsertMode==6){ Int DefInv =  0; DopD() }	// 僪僢儁儖僪儈僫儞僩
	If(InsertMode==7){ Int DefInv =  0; JazzD1() }	// 嘪儕僨傿傾儞俈倲倛
	If(InsertMode==8){ Int DefInv =  0; JazzD2() }	// 嘪僆儖僞乕僪
	If(InsertMode==9){ Int DefInv =  0; JazzD3() }	// 嘪僗乕僷乕儘僋儕傾儞乮摨僪儕傾儞侒俋乯
	If(InsertMode==10){Int DefInv =  1; JazzD4() }	// 嘪儕僨傿傾儞俈倲倛嘦mM7
	If(InsertMode==11){Int DefInv =  1; JazzD5() }	// 嘪僗乕僷乕儘僋儕傾儞嘦augM7
	Inv = Inv + Top
	Invert5()
	InsertMode = 0
	If(Len==0){Len = MML(l)}
	If(Chord5_off==0){
		If(Feint==0){
			If(Disp==1){ MetaText={"儀乕僗亖僔丂丂儗丒僼傽丒儔丒僪偺榓壒"} }
			If(RootBass==0){n(Note0),0}; n(Note1),0; n(Note2),0; n(Note3),0; n(Note4),%(Len);
		}
		}Else{
		If(Disp==1){ MetaText={"儀乕僗亖僔丂丂儗丒僼傽丒儔丒僪偺榓壒"} }
		r%(Len)
	}
	Feint = 0
}

/* Insert */
Function Combo1(val1,val2,val3,val4){
	InsertMode = 1
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo2(val1,val2,val3,val4){
	InsertMode = 2
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo3(val1,val2,val3,val4){
	InsertMode = 3
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo4(val1,val2,val3,val4){
	InsertMode = 4
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo5(val1,val2,val3,val4){
	InsertMode = 5
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo6(val1,val2,val3,val4){
	InsertMode = 6
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo7(val1,val2,val3,val4){
	InsertMode = 7
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo8(val1,val2,val3,val4){
	InsertMode = 8
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo9(val1,val2,val3,val4){
	InsertMode = 9
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo10(val1,val2,val3,val4){
	InsertMode = 10
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}

Function Combo11(val1,val2,val3,val4){
	InsertMode = 11
	LenII = val1
	InvII = val2
	LenIII = val3
	InvIII = val4
}


/* 嘥 */		Function T1(val1,val2){#Mode(0) C_(val1,val2)}
/* 嘫m */		Function T2(val1,val2){#Mode(0) A_(val1,val2)}
/* 嘨m */		Function T3(val1,val2){#Mode(0) E_(val1,val2)}
/* 嘥sus4 */	Function T4(val1,val2){#Mode(0) C_4(val1,val2)}
/* 嘫sus4 */	Function T5(val1,val2){#Mode(0) A_4(val1,val2)}
/* 嘨sus4 */	Function T6(val1,val2){#Mode(0) E_4(val1,val2)}
/* 嘥maj7 */	Function T7(val1,val2){#Mode(0) C_7(val1,val2)}
/* 嘫m7 */		Function T8(val1,val2){#Mode(0) A_7(val1,val2)}
/* 嘨m7 */		Function T9(val1,val2){#Mode(0) E_7(val1,val2)}
/* 嘥maj9 */	Function T10(val1,val2){#Mode(0) C_9(val1,val2)}
/* 嘫m9 */		Function T11(val1,val2){#Mode(0) A_9(val1,val2)}
/* 嘨m9 */		Function T12(val1,val2){#Mode(0) E_9(val1,val2)}
/* 嘥7(-7) */	Function T13(val1,val2){#Mode(4) C_(val1,val2)}
/* 嘥7 */		Function T14(val1,val2){#Mode(4) C_7(val1,val2)}
/* 嘨7 */		Function T15(val1,val2){#HMinor(2) E_7(val1,val2)}
/* 嘥aug */		Function T16(val1,val2){#HMinor(2) C_(val1,val2)}

/* 嘩 */		Function S1(val1,val2){#Mode(0) F_(val1,val2)}
/* 嘦m */		Function S2(val1,val2){#Mode(0) D_(val1,val2)}
/* 嘦 */		Function S3(val1,val2){#Mode(3) D_(val1,val2)}
/* 嘩sus4 */	Function S4(val1,val2){#Mode(4) F_4(val1,val2)}
/* 嘦sus4 */	Function S5(val1,val2){#Mode(0) D_4(val1,val2)}
/* 嘩maj7 */	Function S6(val1,val2){#Mode(0) F_7(val1,val2)}
/* 嘦m7 */		Function S7(val1,val2){#Mode(0) D_7(val1,val2)}
/* 嘩#m7侒5 */	Function S8(val1,val2){#MMinor(3) F_7(val1,val2)}
/* 嘩maj9 */	Function S9(val1,val2){#Mode(0) F_9(val1,val2)}
/* 嘦m9 */		Function S10(val1,val2){#Mode(0) D_9(val1,val2)}
/* 嘦9 */		Function S11(val1,val2){#Mode(3) D_9(val1,val2)}
/* 嘩7 */		Function S12(val1,val2){#MMinor(0) F_7(val1,val2)}
/* 嘦7 */		Function S13(val1,val2){#Mode(3) D_7(val1,val2)}

/* 嘪 */		Function D1(val1,val2){#Mode(0) G_(val1,val2)}
/* 嘮m侒5 */	Function D2(val1,val2){#Mode(0) B_(val1,val2)}
/* 嘮侒 */		Function D3(val1,val2){#Mode(4) B_(val1,val2)}
/* 嘪sus4 */	Function D4(val1,val2){#Mode(0) G_4(val1,val2)}
/* 嘪7 */		Function D5(val1,val2){#Mode(0) G_7(val1,val2)}
/* 嘮m7侒5 */	Function D6(val1,val2){#Mode(0) B_7(val1,val2)}
/* 嘮侒maj7 */	Function D7(val1,val2){#Mode(4) B_7(val1,val2)}
/* 嘪9 */		Function D8(val1,val2){#Mode(0) G_9(val1,val2)}
/* 嘮侒maj9 */	Function D9(val1,val2){#Mode(4) B_9(val1,val2)}
/* 嘪maj7 */	Function D10(val1,val2){#Mode(3) G_7(val1,val2)}
/* 嘮m */		Function D11(val1,val2){#Mode(3) B_(val1,val2)}
/* 嘮m7 */		Function D12(val1,val2){#Mode(3) B_7(val1,val2)}

/* 嘥m */		Function Tm1(val1,val2){#Mode(5) C_(val1,val2)}
/* 嘨侒 */		Function Tm2(val1,val2){#Mode(5) E_(val1,val2)}
/* 嘥sus4 */	Function Tm3(val1,val2){#Mode(5) C_4(val1,val2)}
/* 嘨侒sus4 */	Function Tm4(val1,val2){#Mode(5) E_4(val1,val2)}
/* 嘥m7 */		Function Tm5(val1,val2){#Mode(5) C_7(val1,val2)}
/* 嘨侒maj7 */	Function Tm6(val1,val2){#Mode(5) E_7(val1,val2)}
/* 嘥m9 */		Function Tm7(val1,val2){#Mode(5) C_9(val1,val2)}
/* 嘨侒maj9 */	Function Tm8(val1,val2){#Mode(5) E_9(val1,val2)}
/* 嘥mM7 */		Function Tm9(val1,val2){#MMinor(0) C_7(val1,val2)}
/* 嘨侒7 */		Function Tm10(val1,val2){#Mode(2) E_7(val1,val2)}
/* 嘥dim */		Function Tm11(val1,val2){#HMinor(6) C_7(val1,val2)}
/* 嘨侒augM7 */	Function Tm12(val1,val2){#MMinor(0) E_7(val1,val2)}

/* 嘩m */		Function Sm1(val1,val2){#Mode(5) F_7(val1,val2)}
/* 嘫侒 */		Function Sm2(val1,val2){#Mode(5) A_(val1,val2)}
/* 嘦m侒5 */	Function Sm3(val1,val2){#Mode(5) D_(val1,val2)}
/* 嘩sus4 */	Function Sm4(val1,val2){#Mode(5) F_4(val1,val2)}
/* 嘫侒sus4 */	Function Sm5(val1,val2){#Mode(2) A_4(val1,val2)}
/* 嘩m7 */		Function Sm6(val1,val2){#Mode(5) F_7(val1,val2)}
/* 嘫侒maj7 */	Function Sm7(val1,val2){#Mode(5) A_7(val1,val2)}
/* 嘦m7侒5 */	Function Sm8(val1,val2){#Mode(5) D_7(val1,val2)}
/* 嘩m9 */		Function Sm9(val1,val2){#Mode(5) F_9(val1,val2)}
/* 嘫侒maj9 */	Function Sm10(val1,val2){#Mode(5) A_9(val1,val2)}
/* 嘩7 */		Function Sm11(val1,val2){#Mode(1) F_7(val1,val2)}
/* 嘫m7侒5 */	Function Sm12(val1,val2){#Mode(1) A_7(val1,val2)}
/* 嘦m7 */		Function Sm13(val1,val2){#Mode(1) D_7(val1,val2)}

/* 嘪m */		Function Dm1(val1,val2){#Mode(5) G_(val1,val2)}
/* 嘪 */		Function Dm2(val1,val2){#HMinor(0) G_(val1,val2)}
/* 嘮侒 */		Function Dm3(val1,val2){#Mode(5) B_(val1,val2)}
/* 嘦侒 */		Function Dm4(val1,val2){#Mode(2) D_(val1,val2)}
/* 嘪sus4 */	Function Dm5(val1,val2){#Mode(5) G_4(val1,val2)}
/* 嘮侒sus4 */	Function Dm6(val1,val2){#Mode(5) B_4(val1,val2)}
/* 嘪m7 */		Function Dm7(val1,val2){#Mode(5) G_7(val1,val2)}
/* 嘪7 */		Function Dm8(val1,val2){#HMinor(0) G_7(val1,val2)}
/* 嘮侒7 */		Function Dm9(val1,val2){#Mode(5) B_7(val1,val2)}
/* 嘦侒maj7 */	Function Dm10(val1,val2){#Mode(2) D_7(val1,val2)}
/* 嘮侒maj7 */	Function Dm11(val1,val2){#Mode(1) B_7(val1,val2)}
/* 嘪m9 */		Function Dm12(val1,val2){#Mode(1) G_9(val1,val2)}
/* 嘦侒maj9 */	Function Dm13(val1,val2){#Mode(2) D_9(val1,val2)}
/* 嘮侒m7 */	Function Dm14(val1,val2){#Mode(2) B_7(val1,val2)}
/* 嘮dim */		Function Dm15(val1,val2){#HMinor(0) B_7(val1,val2)}

Function TopNote(val){ Top = val }



