#include #include #include "h.h" void Prel(char * fn, int emp1, int emp2, int dur, int tem, int qd){ int const mpq = tem; note * k = 0; int tm[] = {0, 0, 0}, track; BP bp = {1, 3, 16}; void tempo(int s){note n; uchar * stuff = malloc(3); if(!stuff) ex(30); stuff[0] = s>>16; stuff[1] = s>>8; stuff[2] = s; n.start = tm[2-1]; n.dur = OpaqueStuff; n.chan = 1; n.trk = 1; n.o.opaque.odp = stuff; n.o.opaque.cc = 3; n.o.opaque.subtype = 81; aug(n, &k);} void Nx(int x, int d, int a, int l){note n; n.start = tm[track-1]; tm[track-1] += a; n.dur = d; n.chan = 1; n.trk = track; n.o.n.freq = x; n.o.n.loud = l; n.o.n.quit = 64; aug(n, &k);} void N(int x, int d, int a){ Nx(x, d, a, 64);} void r(int d){tm[track -1] += d;} void n(int x){N(x, qd, 4);} void q(int a, int b){n(a); n(b); n(a);} void m(int a, int b, int c, int d) {Nx(a, dur, 4, emp1); q(b, c); Nx(d, 4, 4, emp2); q(b, c);} void dp(int a, int b, int c, int d){m(a, b, c, d); m(a, b, c, d);} void t(int T){track = T;} void d(int a, int b, int c, int d, int e, int f, int g, int h){ t(2); dp(a, b, c, d); t(3); dp(e, f, g, h);} void f(int a, int b, int c, int d){n(a); n(b); n(c); n(d);} void g(int a, int b, int c){n(a); q(b, c);} tempo(mpq); d(72, 63, 62, 60, 48, 55, 57, 51); d(68, 65, 64, 60, 48, 56, 55, 53); d(71, 65, 63, 62, 48, 56, 55, 53); d(72, 67, 65, 63, 48, 51, 50, 55); d(75, 68, 67, 63, 48, 60, 58, 56); d(74, 66, 64, 62, 48, 57, 55, 54); d(74, 67, 66, 62, 46, 58, 57, 55); d(72, 64, 62, 60, 46, 55, 53, 52); d(72, 65, 64, 60, 44, 56, 55, 53); d(70, 65, 63, 62, 44, 50, 48, 53); d(70, 67, 65, 63, 43, 51, 50, 55); d(68, 67, 65, 63, 48, 51, 50, 56); d(68, 62, 60, 58, 50, 53, 51, 56); d(67, 58, 56, 63, 51, 55, 53, 56); d(65, 60, 58, 57, 51, 57, 55, 53); d(65, 62, 60, 59, 50, 53, 51, 56); d(65, 62, 60, 59, 48, 53, 52, 56); d(63, 60, 59, 55, 48, 51, 50, 53); d(53, 63, 62, 65, 44, 48, 47, 50); d(54, 60, 59, 63, 45, 51, 50, 48); d(63, 60, 59, 55, 43, 51, 50, 53); d(66, 60, 59, 57, 43, 51, 50, 48); d(67, 60, 59, 62, 43, 51, 50, 53); d(68, 60, 59, 62, 43, 51, 50, 53); t(3); f(43, 47, 50, 53); g(56, 53, 52); f(59, 53, 62, 59); g(56, 53, 52); f(43, 48, 51, 55); g(60, 55, 54); f(63, 60, 67, 63); g(60, 56, 55); f(43, 45, 54, 60); g(63, 60, 59); f(66, 60, 69, 66); g(63, 60, 59); tm[2-1] = tm[3-1]+bp.den/4; N(43, 4*17, 4*17); t(2); n(74); n(72); n(74); f(75, 72, 71, 72); f(69, 72, 71, 72); f(74, 71, 69, 71); t(2); g(67, 71, 69); g(72, 69, 67); g(66, 69, 67); g(71, 67, 66); t(3); q(62, 60); g(63, 60, 59); g(57, 60, 59); g(62, 59, 57); t(2); g(62, 79, 77); g(80, 77, 75); g(74, 77, 75); g(79, 75, 74); t(3); g(55, 59, 57); g(60, 56, 55); g(53, 57, 55); g(59, 55, 53); t(2); g(72, 75, 74); g(77, 74, 72); g(71, 74, 72); g(75, 72, 71); t(3); g(51, 67, 65); g(68, 65, 63); g(62, 65, 63); g(67, 63, 62); t(2); g(67, 72, 71); g(68, 77, 75); g(67, 75, 74); g(65, 74, 72); t(3); g(60, 63, 62); g(65, 62, 60); g(63, 60, 59); g(62, 59, 57); t(2); g(63, 72, 71); g(68, 65, 63); g(67, 63, 62); g(65, 62, 60); t(3); g(60, 63, 62); g(53, 62, 60); g(51, 60, 59); g(50, 59, 57); tempo(mpq*3.1); t(2); N(60, 8, 0); N(64, 8, 0); r(8); t(3); N(48, 16, 0); N(55, 16, 0); N(58, 16, 0); r(32); {void x(int j){N(j, 2, 2);} void y(int j){N(j, 1, 1);} t(2); x(64); x(60); x(62); x(64); y(65); y(67); y(68); y(70); y(72); y(70); y(68); y(67); n(65); x(67); x(64); N(60, 8, 0); N(65, 8, 0); r(8); t(3); N(48, 16, 0); N(55, 16, 0); N(56, 16, 0); r(32); t(2); x(65); x(67); x(65); x(64); x(65); x(67); x(68); x(67); y(65); y(63); y(62); y(63); y(65); y(62); y(63); y(65);} tempo(mpq*2.4); t(2); N(59, 12, 12); n(50); f(53, 56, 55, 53); f(59, 53, 62, 53); f(59, 56, 55, 53); t(3); r(4); N(36, 60, 4); N(47, 56, 56); t(2); f(52, 61, 58, 55); f(60, 56, 53, 56); f(55, 58, 55, 52); f(56, 53, 50, 53); t(3); N(48, 64, 0); N(36, 96, 0); r(96); tempo(mpq*2.8); t(2); f(52, 55, 52, 48); f(53, 50, 47, 50); r(4); n(43); N(48, 88, 4); n(50); f(52, 55, 58, 55); t(3); N(36, 96, 96); printf("x %d %d\n", tm[2-1], tm[3-1]); t(2); f(56, 60, 65, 62); f(65, 68, 72, 71); f(72, 67, 65, 62); N(55, 16, 0); N(60, 16, 0); N(64, 16, 0); Write(fn, k, &bp);} int main(){ Prel("PreludeII.midi", 64, 64, 4, 600000, 4); Prel("PreludeIIx.midi", 100, 80, 24, 600000, 4); Prel("PreludeIIf.midi", 100, 80, 24, 450000, 4); Prel("PreludeIIfs.midi", 100, 80, 24, 450000, 6); Prel("PreludeIIst.midi", 100, 80, 12, 550000, 2); return 0;}