0 EPIANO      = 0
0 BASS        = 1
0 BRASS       = 2
0 ORCHESTRA   = 3
0 ORGAN       = 4
0 STRINGS     = 5
0 GUITAR      = 6
0 HARP        = 7
0 TUBULARBELL = 8

0 MAINPART    = EPIANO
0 BASEPART    = BRASS
0 HARMONYPART = ORCHESTRA
0 CODEPART    = GUITAR

0 ACLEAR()

# epiano

0 AUNITSET(EPIANO)

0 O1 = AUNIT(  , 512, A_ENVFIXED)
0 O2 = AUNIT(O1,    , A_ENVFIXED)
0 O3 = AUNIT(  , 512, A_ENVFIXED)
0 O4 = AUNIT(O3,    , A_ENVFIXED)

0 AOSC(O1)
0 AOSC(O2)
0 AOSC(O3)
0 AOSC(O4,, 1024*14)

0 AENVPOINT(O1,,   0,1000)
0 AENVPOINT(O1,,1000,   0)

0 AENVPOINT(O2,,   0,1000)
0 AENVPOINT(O2,, 500,   0)

0 AENVPOINT(O3,,   0,1000)
0 AENVPOINT(O3,, 250,   0)

0 AENVPOINT(O4,,   0,1000)
0 AENVPOINT(O4,, 250,   0)

# bass

0 AUNITSET(BASS)

0 O1 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)
0 O2 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)
0 O3 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)
0 O4 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)

0 AOSC(O1, 1000, 1024/4,, A_SIN)
0 AOSC(O2,  900, 1024/3,, A_SIN)
0 AOSC(O3,  800, 1024/2,, A_SIN)
0 AOSC(O4,  700, 1024  ,, A_SIN)

0 AADDOUT(O1, O1, 400)
0 AADDOUT(O2, O2, 300)
0 AADDOUT(O3, O3, 200)
0 AADDOUT(O4, O4, 100)

0 AENVPOINT(O1,,   0,1000)
0 AENVPOINT(O1,, 250, 900)
0 AENVPOINT(O1,,4000,   0)

0 AENVPOINT(O2,,   0,1000)
0 AENVPOINT(O2,, 125, 900)
0 AENVPOINT(O2,,2000,   0)

0 AENVPOINT(O3,,   0,1000)
0 AENVPOINT(O3,,  75, 900)
0 AENVPOINT(O3,,1200,   0)

0 AENVPOINT(O4,,   0,1000)
0 AENVPOINT(O4,,  50, 900)
0 AENVPOINT(O4,, 800,   0)

# brass

0 AUNITSET(BRASS)

0 O1 = AUNIT(A_OUTPUT, 256)
0 O2 = AUNIT(A_OUTPUT, 256)
0 O3 = AUNIT(A_OUTPUT, 256)
0 O4 = AUNIT(A_OUTPUT, 256)

0 AOSC(O1,  800, 1024/2,, A_SIN)
0 AOSC(O2,  700, 1024  ,, A_SIN)
0 AOSC(O3, 1000, 1024  ,, A_SIN)
0 AOSC(O4,  600, 1024*2,, A_SIN)

0 AADDOUT(O1, O1, 500)
0 AADDOUT(O2, O2, 600)
0 AADDOUT(O3, O3, 400)
0 AADDOUT(O4, O4, 300)

0 AENVPOINT(O1,,   0,   0)
0 AENVPOINT(O1,, 100,1000)
0 AENVPOINT(O1,, 700,1000)
0 AENVPOINT(O1,,1000,   0)

0 AENVPOINT(O2,,   0,   0)
0 AENVPOINT(O2,, 200,1000)
0 AENVPOINT(O2,, 600,1000)
0 AENVPOINT(O2,,1000,   0)

0 AENVPOINT(O3,,   0,   0)
0 AENVPOINT(O3,, 300,1000)
0 AENVPOINT(O3,, 500,1000)
0 AENVPOINT(O3,,1000,   0)

0 AENVPOINT(O4,,   0,   0)
0 AENVPOINT(O4,, 350,1000)
0 AENVPOINT(O4,, 450,1000)
0 AENVPOINT(O4,,1000,   0)

# orchestra

0 AUNITSET(ORCHESTRA)

0 O1 = AUNIT(A_OUTPUT, 256)
0 O2 = AUNIT(A_OUTPUT, 256)
0 O3 = AUNIT(A_OUTPUT, 256)
0 O4 = AUNIT(A_OUTPUT, 256)

0 AOSC(O1,  800, 1024/2   ,, A_SAWTOOTH)
0 AOSC(O2,  700, 1024  -10,, A_SAWTOOTH)
0 AOSC(O3, 1000, 1024     ,, A_SAWTOOTH)
0 AOSC(O4,  600, 1024*2+10,, A_SAWTOOTH)

0 AADDOUT(O1, O1, 500)
0 AADDOUT(O2, O2, 600)
0 AADDOUT(O3, O3, 400)
0 AADDOUT(O4, O4, 300)

0 AENVPOINT(O1,,   0,   0)
0 AENVPOINT(O1,, 100,1000)
0 AENVPOINT(O1,, 700,1000)
0 AENVPOINT(O1,,1000,   0)

0 AENVPOINT(O2,,   0,   0)
0 AENVPOINT(O2,, 200,1000)
0 AENVPOINT(O2,, 600,1000)
0 AENVPOINT(O2,,1000,   0)

0 AENVPOINT(O3,,   0,   0)
0 AENVPOINT(O3,, 300,1000)
0 AENVPOINT(O3,, 500,1000)
0 AENVPOINT(O3,,1000,   0)

0 AENVPOINT(O4,,   0,   0)
0 AENVPOINT(O4,, 350,1000)
0 AENVPOINT(O4,, 450,1000)
0 AENVPOINT(O4,,1000,   0)

# organ

0 AUNITSET(ORGAN)

0 O1 = AUNIT(A_OUTPUT, 256)
0 O2 = AUNIT(A_OUTPUT, 256)
0 O3 = AUNIT(A_OUTPUT, 256)
0 O4 = AUNIT(A_OUTPUT, 256)

0 AOSC(O1, 1000, 1024  ,, A_SIN)
0 AOSC(O2,  700, 1024*2,, A_SIN)
0 AOSC(O3,  700, 1024*4,, A_SIN)
0 AOSC(O4,  700, 1024*8,, A_SIN)

0 AADDOUT(O1, O1, 200)
0 AADDOUT(O2, O2, 200)
0 AADDOUT(O3, O3, 200)
0 AADDOUT(O4, O4, 200)

# strings

0 AUNITSET(STRINGS)

0 O1 = AUNIT(A_OUTPUT, 256)
0 O2 = AUNIT(A_OUTPUT, 256)
0 O3 = AUNIT(A_OUTPUT, 256)
0 O4 = AUNIT(A_OUTPUT, 256)

0 AOSC(O1,  800, 1024  ,, A_SQUARE)
0 AOSC(O2,  700, 1024+3,, A_SQUARE)
0 AOSC(O3, 1000, 1024*2,, A_SQUARE)
0 AOSC(O4,  600, 1024*3,, A_SQUARE)

0 AADDOUT(O1, O1, 500)
0 AADDOUT(O2, O2, 600)
0 AADDOUT(O3, O3, 400)
0 AADDOUT(O4, O4, 300)

0 AENVPOINT(O1,,   0,   0)
0 AENVPOINT(O1,, 200,1000)
0 AENVPOINT(O1,, 700,1000)
0 AENVPOINT(O1,,1000,   0)

0 AENVPOINT(O2,,   0,   0)
0 AENVPOINT(O2,, 250,1000)
0 AENVPOINT(O2,, 600,1000)
0 AENVPOINT(O2,,1000,   0)

0 AENVPOINT(O3,,   0,   0)
0 AENVPOINT(O3,, 300,1000)
0 AENVPOINT(O3,, 500,1000)
0 AENVPOINT(O3,,1000,   0)

0 AENVPOINT(O4,,   0,   0)
0 AENVPOINT(O4,, 350,1000)
0 AENVPOINT(O4,, 450,1000)
0 AENVPOINT(O4,,1000,   0)

# guitar

0 AUNITSET(GUITAR)

0 O1 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)
0 O2 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)
0 O3 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)
0 O4 = AUNIT(A_OUTPUT, 256, A_ENVFIXED)

0 AOSC(O1, 1000, 1024  ,, A_SIN)
0 AOSC(O2,  500, 1024*2,, A_SIN)
0 AOSC(O3,  333, 1024*3,, A_SIN)
0 AOSC(O4,  250, 1024*4,, A_SIN)

0 AADDOUT(O1, O1, 400)
0 AADDOUT(O2, O2, 400)
0 AADDOUT(O3, O3, 400)
0 AADDOUT(O4, O4, 400)

0 AENVPOINT(O1,,   0,1000)
0 AENVPOINT(O1,, 100, 500)
0 AENVPOINT(O1,,4000,   0)

0 AENVPOINT(O2,,   0,1000)
0 AENVPOINT(O2,, 100, 500)
0 AENVPOINT(O2,,2000,   0)

0 AENVPOINT(O3,,   0,1000)
0 AENVPOINT(O3,, 100, 500)
0 AENVPOINT(O3,,1333,   0)

0 AENVPOINT(O4,,   0,1000)
0 AENVPOINT(O4,, 100, 500)
0 AENVPOINT(O4,,1000,   0)

# harp

0 AUNITSET(HARP)

0 O1 = AUNIT(A_OUTPUT, 512, A_ENVFIXED)
0 O2 = AUNIT(A_OUTPUT, 512, A_ENVFIXED)

0 AOSC(O1, 1000, 1024  ,, A_SIN)
0 AOSC(O2,  500, 1024*2,, A_SIN)

0 AADDOUT(O1, O1, 100)
0 AADDOUT(O2, O2, 100)

0 AENVPOINT(O1,,   0,1000)
0 AENVPOINT(O1,, 100, 500)
0 AENVPOINT(O1,,4000,   0)

0 AENVPOINT(O2,,   0,1000)
0 AENVPOINT(O2,, 100, 500)
0 AENVPOINT(O2,, 800,   0)

# tubular bell

0 AUNITSET(TUBULARBELL)

0 O1 = AUNIT(  ,    , A_ENVFIXED)
0 O2 = AUNIT(O1,1000, A_ENVFIXED)

0 AOSC(O1)
0 AOSC(O2,,1024*35/10)

0 AENVPOINT(O1,,   0,1000)
0 AENVPOINT(O1,, 100, 900)
0 AENVPOINT(O1,,4000,   0)

0 AENVPOINT(O2,,   0,1000)
0 AENVPOINT(O2,,2000,   0)



# tempo

0 APLAY("T90", A_SAVE)

# main part

0 AUNITSET(MAINPART)

0 APLAY("V60L8 R2.CD", A_SAVE|A_NEW)
0 APLAY("E2RAAG", A_SAVE)
0 APLAY("A2.FG", A_SAVE)
0 APLAY("A2.AA", A_SAVE)
0 APLAY("G2.G4", A_SAVE)
0 APLAY("A2.>C<A", A_SAVE)
0 APLAY("G2.CD", A_SAVE)
0 APLAY("E2.ED", A_SAVE)
0 APLAY("C1", A_SAVE)

# base part

0 AUNITSET(BASEPART)

0 APLAY("V140L1 R", A_SAVE|A_NEW)
0 APLAY("EAAGAGEC", A_SAVE)

# harmony part

0 AUNITSET(HARMONYPART)

0 APLAY("V160L8 R1", A_SAVE|A_NEW)
0 APLAY("R1R1R1R1", A_SAVE)
0 APLAY("A1G1E1C1", A_SAVE)

# code part

0 AUNITSET(CODEPART)

0 APLAY("V200L4", A_SAVE|A_NEW)
0 APLAY("(CEG)(CEG)(CEG)(CEG)", A_SAVE)
0 APLAY("(EGB)(EGB)(EGB)(EGB)", A_SAVE)
0 APLAY("(ACE)(ACE)(ACE)(ACE)", A_SAVE)
0 APLAY("(ACE)(ACE)(ACE)(ACE)", A_SAVE)
0 APLAY("(GBD)(GBD)(GBD)(GBD)", A_SAVE)
0 APLAY("(ACE)(ACE)(ACE)(ACE)", A_SAVE)
0 APLAY("(GBD)(GBD)(GBD)(GBD)", A_SAVE)
0 APLAY("(EGB)(EGB)(EGB)(EGB)", A_SAVE)
0 APLAY("(CEG)(CEG)(C2E2G2)", A_SAVE)

# play

#0 APLAY("",,,"mamaday.wav")
0 APLAY("")
