Int LOOP=2
Int TIMIDITY=0
Tempo 260
#PEDALON={Sub {r16y64,127}}
#PEDALOFF={r-32 y64,0 r32}

//PlayFrom(100:1:1)
// シンバルのロテート
Int CYMINIT=0
Int SNAREINIT=0

Function Vibrate(delay1, depth1, delay2, depth2, delay3, depth3, delay4, depth4, delay5, depth5) {
	Int	NowTime;
	NowTime = Time;
	IF(delay1=0) {
		Modulation(depth1)
	} ELSE {
		Modulation.onNoteWave(0, 0, delay1 /2, 0, depth1, delay1/2)
		IF(delay2<>0) {
			Time=NowTime+delay1
			Modulation.onNoteWave(depth1, depth2, delay2)
			IF(delay3<>0) {
				Time=NowTime+delay1+delay2
				Modulation.onNoteWave(depth2, depth3, delay3)
				IF(delay4<>0) {
					Time=NowTime+delay1+delay2+delay3
					Modulation.onNoteWave(depth3, depth4, delay4)
					IF(delay5<>0) {
						Time=NowTime+delay1+delay2+delay3+delay4
						Modulation.onNoteWave(depth4, depth5, delay5)
					}
				}
			}
		}
	}
	Time=NowTime
}

Function Snare() {
	Int CC
	IF(TIMIDITY=0) {
		CC=Snare2
	} ELSE {
		IF(SNAREINIT=0) {
			CC=Snare1
			SNAREINIT=1
		} ELSE {
				CC=Snare2
			SNAREINIT=0
		}
	}
	Result=CC
}

Function Cymbal() {
	Int CC
	IF(CYMINIT=0) {
		CC=CrashCymbal1
		CYMINIT=1
	} ELSE {
		CC=CrashCymbal2
		CYMINIT=0
	}
	Result=CC
}

Function RandV(Int MIN, Int MAX) {
	Str MML="v"
	MML=MML+Random(MIN,MAX)
//	Print(MML)
	MML
}

Str RMML
Function RandR(Int MIN, Int MAX) {
	Str MML="r"
	IF(RANDON=1) {
		RMML=RMML+"r"
		Int VALUE=Random(0,10)
		IF(VALUE<5) {
			MML=MML+"-"
		} ELSE {
			RMML=RMML+"-"
		}
		Str RAND=Random(MIN,MAX)
		MML=MML+RAND
		RMML=RMML+RAND
//		Print(MML)
		MML
	}
}

Function SyncR() {
	Str MML=RMML
	RMML=""
//	Print(MML)
	MML
}

Function LoopPlay(Str Mml) {
	Str _MML
	For (Int i = 1; i <= LOOP; i++) {
		_MML=_MML + #STR(Mml)
	}
	_MML
}

#back={
	q50
	#gce={'g>ce<'}
	#amcf={'a->cf<'}
	#gcf={'g>cf<'}
	#acf={'a>cf<'}
	#acpf={'a>c#f<'}
	#gbf={'gb>f<'}
	#gbe={'gb>e<'}
	#acpe={'a>c#e<'}
	#ace={'a>ce<'}
	#gcd={'g>cd<'}
	#bdg={'b>dg<'}
	#cdg={'>cdg<'}
	#bdg={'b>dg<'}
	#gbf={'gb>f<'}
	#adf={'a>df<'}
	#gbmem={'gb->e-<'}

	l4q50
	l4q50 [3 #gce ]r8 l8q70 #amcf
	[r #amcf ] l4q50 #amcf r4

	l4q50 [3 #gce ]r8 l8q70 #amcf
	r4 l2 q95 #gcf l4 #gbf
}

#back1={
	l4q50 [3 #gce] r8l8q70 #gce
	[r #gce] #gce rrr

	l4q50 [3 #gcf] r8l8q70 #gcf
	[r #gbf] #gbf rrr

	l4q50 [3 #gce] r8l8q70 #gce
	[r #gce] #gce rrr

	l4q50 [3 #gbe] r8l8q70 #gbe
	[r #gbe] #gbe rrr

	l4q50 [3 #acf] r8l8q70 #acf
	[r #acf] #acf rrr

	l4q50 [3 #gbe] r8l8q70 #gbe
	[r #acpe] #acpe rrr

	l4q50 [3 #acf] r8l8q70 #ace
	[r #ace] #ace rrr

	l4q50 [3 #gcd] r8l8q70 #cdg
	[r #cdg] #bdg rrr


	//
	l4q50 [3 #gce] r8l8q70 #gce
	[r #gce] #gce rrr

	l4q50 [3 #gcf] r8l8q70 #gcf
	[r #gbf] #gbf rrr

	l4q50 [3 #gce] r8l8q70 #gce
	[r #gce] #gce rrr

	l4q50 [3 #gbe] r8l8q70 #acpf
	[r #acpf] #acpe rrr

	//
	l4q50 [3 #acf] r8l8q70 #acf
	[r #acf] #acf rrr

	l4q50 [3 #gbe] r8l8q70 #gbe
	[r #acpe] #acpe rrr

	l4q50 [3 #gbmem] r8l8q70 #gbmem
	[r #gbmem] #gbmem rrr

	l4q50 [3 #gcd] r8l8q70 #cdg
	[r #bdg] #bdg rrr

}

#back2={
	[
		l4q50 [3 #acf] r8l8q70 #acf
		[r #acf] #acf rrr
		l4q50 [3 #gbe] r8l8q70 #ace
		[r #ace] #ace rrr
		:

		l4q50 [3 #adf] r8l8q70 #gbf
		[r #gbf] #gbf rrr

		l4q50 [3 #gce] r8l8q70 #gce
		[r #gce] #gce rrr
	]

	l4q50 [3 #adf] r8l8q70 #adf
	[r #adf] #adf rrr

	l4q50 [3 #gbf] r8l8q70 #gbf
	[r #gbf] #gbf rrr
}

#melody={
		[4 r1]
		l8
		rrrg arbr>
		drcr <b>c rf^2e2d2c2<

		rrrg arbr>
		drcr <b>c rb^1.r2<

		rrr>c fr>cr<
		brar gf4r<

		rrrb >ergr
		frer de4r

		f2 ^ q80 <a>cf
		e2 ^ q80<a>ce

		q100 d2.^8g8^2.r4<
		//
		rrrg arbr>
		drcr <b>c rf^2^2^2^8e8d8c8<

		rrrg arbr>
		drcr <b>c rb^1.r2

		rrrc fr>cr<
		bagf ef4r

		rrr<b> ergr
		fedc# de4r

		rrr<b-> e-rgr
		fre-r drcr

		// ここが、Give Me Merorinとそっくりなの；；ぐすぐす；；
		q90 d2e2f2g2

		l8
		a2f4.c8
		r2rcfa
		g2e4.c^2r2
		f2d4.<b
		r2rb>df
		q90 e2f2f#2g2

		q100 a2f4.c8
		r2rcfa
		q90 g2a2b2>c2
		q100 d2^c<b>c ^2 ^<bab ^1^2.r4
		// ここまで
		>Sub{c1^1^1}<<
}

TR(1)
	@(Clarinet)
	Vibrate(!4,20)
	o5q100
	//
	LoopPlay(
		#melody
	)

TR(11)
	@(Piccolo)
	o6q100
	Vibrate(!4,20)
	LoopPlay(
		#melody
	)

TR(2)
	@(NylonGuitar)
	o4
	LoopPlay(
		#back
		#back1
		#back2
	)
	#back
	q100 r2 #PEDALON l28 o4 g>cdeg

TR(3)
	@(AcousticBass)
	o3

	q60
	LoopPlay(
		l4q50
		l4 q50 [3 c]r8 l8q70 c
		[r c] l4q50 c < f > 
		l4 q50 [3 c]r8 l8q70 c
		r4 l2 q95 <g.>

		q55
		c<g>c<g>
		c<g>d<g>
		c<g>c<g>
		e<b>e<b>
		fcfc
		e<b>e<a>
		d<a>d<a>
		gdg<g>

		c<g>c<g>
		c<g>d<g>
		c<g>c<g>
		e<b>e<a>

		fcfc
		e<b>e<a>
		e-<b->e-<b->
		d<g>g2^8d8<b8g8

		>
		fcfc
		e<b>e<a>
		d<a>d<g>
		c<g>ce

		fcfc
		e<b>e<a>
		d<a>d<a>
		d<g>d<g>
	)

	[
		l4 q50 [3 c]r8 l8q70 c
		[r c] l4q50 c < f > 
	]
	#PEDALON q100r2 c1.^2 #PEDALOFF

TR(10)

		$b{Sub{RandR(999,1728) RandV(124,127) n(Kick1),16}r}//36
		$B{Sub{RandR(999,1728) RandV(124,127) n(Kick2),16}r}//35
		$S{Sub{RandR(999,1728) RandV(60,70) n(Snare()),16}r}//38
		$s{Sub{RandR(999,1728) RandV(90,127) n(Snare()),16}r}//40

		$L{Sub{RandR(999,1728) RandV(120,127) n(LowTom2),16}r}//41
		$l{Sub{RandR(999,1728) RandV(120,127) n(LowTom1),16}r}//43
		$M{Sub{RandR(999,1728) RandV(120,127) n(MidTom2),16}r}//45
		$L{Sub{RandR(999,1728) RandV(60,80) n(LowTom1),16}r}//41
		$l{Sub{RandR(999,1728) RandV(120,127) n(LowTom1),16}r}//43
		$M{Sub{RandR(999,1728) RandV(60,80) n(MidTom1),16}r}//45
		$m{Sub{RandR(999,1728) RandV(120,127) n(MidTom1),16}r}//47
		$T{Sub{RandR(999,1728) RandV(60,80) n(HighTom1),16}r}//48
		$t{Sub{RandR(999,1728) RandV(120,127) n(HighTom1),16}r}//50
		$c{Sub{RandR(999,1728) RandV(115,127) n(Cymbal()),16}r}//49 or 57
		$p{Sub{RandR(999,1728) RandV(115,127) n(44),16}r}//49 or 57
	
		$Q{Sub{RandR(999,1728) RandV(110,127) n(HighBongo),16}r}//60
		$W{Sub{RandR(999,1728) RandV(110,127) n(LowBongo),16}r}//61
		$Z{Sub{RandR(999,1728) RandV(120,127) n(MuteHighConga),16}r}//62
		$X{Sub{RandR(999,1728) RandV(110,127) n(OpenHighConga),16}r}//63
		$V{Sub{RandR(999,1728) RandV(110,127) n(LowConga),16}r}//64

		$R{Sub{RandR(999,1728) RandV(115,127) n(RideCymbal1),16}r}//51
		$E{Sub{RandR(999,1728) RandV(115,127) n(RideBell),16}r}//53

	#r1={
		Sub{[4 r4 Rythm{p4}]}
		Sub{[2 Rythm{b1}]}
		Rythm{
			s8
			S8
			s8
			S8
			l8
			[S8]
			s8
			S8
			s8
			S8
			s8
			l8
			S8
			S8
			S8
		}
	}

	#r2={
		Sub{[4 r4 Rythm{p4}]}
		Sub{[2 Rythm{b1}]}
		Rythm{
			s8
			S8
			s8
			S8
			l8
			[S8]
			s8

			s8
			S8
			T8
			t8
			m8M8
			l8M8
		}
		Sub{Rythm{c1}}
	}

		#rr={
			Rythm {
				X8Z8V8Z8 X8Z8V8V8
			}
		}
		#rr1={
			Rythm {
				X8Z8Z12Q12Q12 Q8W8W8V8
			}
		}

		#rr2={
			Rythm {
				X8Z8V8Z8 X8Z8V8V8
			}
		}
	LoopPlay(
		Sub {
			[3 #rr]
			[1 #rr1]
			[3
				[15 #rr] [1 #rr1]
			]
		}
			[1 #r1]
			[1 #r2]
	
			[3
				[7 #r1] [1 #r2]
			]
	)
			Sub{[4 #rr]}
			[2 #r1]
		Tempo 130
		Rythm {
			E9E10E11E12E13E14E15E16E17E18E19E20E21E22E21E20E19E18E17E16E15E14E13E12E11E10E9E87E6E5
		}
		r2.
		Expression(127)
		REV(127)
		Tempo 170
		Sub {r2.^8 Expression.onTime(127,0,!2)}
		Rythm {
			m24t24m24 'b1s1o1c1'
		}

End

##############################################################################
# TiMidiTy Config (v2.0)

dir ../patches/guspat/izumo/inst
dir ../patches/guspat/izumo
dir ../patches/guspat
dir ../patches/sf2_all
dir ../patches/sf2_all/atomic
dir ../patches/sf2_all/fluid3
dir ../patches/sf2_all/realgs
dir ../patches/sf2_all/ultimate
dir ../patches/sf2_all/scc
dir ../patches/sf2_all/GMRBasico
dir ../patches/sf2_all/ForClassicalMusic
dir ../patches/sf2_all/bank48
dir ../patches/sf2_part/drumkit
dir ../patches/sf2_part/piano
dir ../patches/sf2_part/guitar
dir ../patches/sf2_part/harpsichord
dir ../patches/sf2_part/ORCHESTRAL
dir ../patches/sf2_part/Clarinet
dir ../patches/sf2_part/chipfont
dir ../patches/sf2_part/drum
dir ../patches/sf2_drum/drum/pettinhouse

dir ../patches/sf2_part/famicom
dir ../patches/sf2_all/musix
dir ../patches/sf2_all/Musyng
dir ../patches/sf2_all/Evanessence2

dir ../patches/sf2_all/Giant
dir ../patches/sf2_all/Titanic
dir "../patches/sf2_drum/drum/MPC Drum Library"
dir "../patches/sf2_part/Sonatina Symphonic Orchestra"
dir "../patches/nanako"
dir "../patches/wood"
dir "../patches/sf2_part/Anthonys Philharmonic"
dir "../patches/sf2_all/Timbres Of Heaven"

##############################################################################
soundfont "Titanic_200_GMGS_1.2.sf2"
bank 0
# clarinet
	71 %font "Timbres Of Heaven GM_GS_XG_SFX V 2.0.2.sf2" 0 71 amp=100 pan=-20 keep=loop rate=255:10:20:210:210:210 offset=255:200:150

# piccolo
	72 %font "Timbres Of Heaven GM_GS_XG_SFX V 2.0.2.sf2" 0 72 amp=100 pan=30 keep=loop rate=255:10:20:210:210:210 offset=255:200:150

	32 %font "Timbres Of Heaven GM_GS_XG_SFX V 2.0.2.sf2" 0 32 amp=90 rate=:::240:240:240

##############################################################################

# Standard drums

drumset 0

	# stick
#	31 %font "Roland SC-55.sf2" 128 0 31 amp=130
	31 %font "Musyng Kite.sf2" 128 8 31 amp=260 pan=90

	# bd
	36 %font "0_Yamaha9000.sf2" 128 0 34 amp=375 tune=-3
#	36 %font "0_Judd-Madden-Drum-S.sf2" 128 0 56 amp=200

	# sd
	38 %font "0_Yamaha9000.sf2" 128 0 32 amp=100 pan=30
	40 %font "0_Yamaha9000.sf2" 128 0 31 amp=100 pan=40

	# hihat
	# close
	42 %font "0_Yamaha9000.sf2" 128 0 50 amp=65
	# pedal
	44 %font "0_Yamaha9000.sf2" 128 0 45 amp=130
	# open
	46 %font "0_Yamaha9000.sf2" 128 0 51 amp=105
	87 %font "0_Yamaha9000.sf2" 128 0 47 amp=115
	88 %font "0_Yamaha9000.sf2" 128 0 48 amp=115
	89 %font "0_Yamaha9000.sf2" 128 0 49 amp=115
	90 %font "0_Yamaha9000.sf2" 128 0 50 amp=115

	# tom
	50 %font "Musyng original.sf2" 128 16 50 amp=175 tune=2
	48 %font "Musyng original.sf2" 128 16 48 amp=135 tune=2
	47 %font "Musyng original.sf2" 128 16 47 amp=130 tune=3
	45 %font "Musyng original.sf2" 128 16 45 amp=130 tune=3
	43 %font "Musyng original.sf2" 128 16 43 amp=130 tune=3
	41 %font "Musyng original.sf2" 128 16 41 amp=130 tune=3

#extension altassign 42 44 46 87 88 89 90

	# cymbal
	49 %font Titanic_200_GMGS_1.2.sf2 128 0 57 amp=200 pan=10 tune=0
	57 %font Titanic_200_GMGS_1.2.sf2 128 0 57 amp=200 pan=+100 tune=+0.5

	# Splash
	55 %font "atomic.sf2" 128 0 55 amp=140 pan=-30 tune=0
	52 %font "atomic.sf2" 128 0 55 amp=140 pan=+70 tune=+0.5

	# Ride
	51 %font "0_Yamaha9000.sf2" 128 0 53 amp=200
	53 %font "0_Yamaha9000.sf2" 128 0 52 amp=200

	# Crap
	39 %font "0_MPC Claps01.sf2" 128 0 66 amp=180 tune=+0.5


	# belltree
	84 %font "Percussion - All Percussion.sf2" 128 0 48 keep=loop amp=350

	# conga & bongo
	60 %font atomic.sf2 128 0 60 amp=120
	61 %font atomic.sf2 128 0 61 amp=105
	62 %font atomic.sf2 128 0 62 amp=150
	63 %font atomic.sf2 128 0 63 amp=110
	64 %font atomic.sf2 128 0 64 amp=90
