#include #include #include #include double mystere2(double c) { if (c > 6.28319) return mystere2(c - 6.28319); if (c <= 1.57808) return c/1.57808; else c -= 1.57808; if (c <= 3.14159) return -(c*0.628319)+1; else c -= 3.14159; return mystere2(c) - 1; } int32_t mystere(uint32_t n) { n &= 0xFF; if (!n) return -21; if ((n & 0xC0) == 0x40) n &= 0xBF; if ((n & 0x1F) > 16) return mystere((n ^ 0x1F) + 1); if (n & 0x1C) return mystere(n - 4) + 12; if ((n & 0xC3) == 0xC0) return mystere(n & 0xBF) - 1; if ((n & 3) == 1) return mystere(n - 1) + 2 + ((n >> 7) * (((n & 0x40) >> 6) + 1)); if ((n & 3) == 2) return mystere(n - 1) + 3 + ((((n & 0xC0) == 0x80) << 1) - ((!(n & 0xC0)) * (((n & 0x20) >> 5) + 1))); if ((n & 3) == 3) return mystere(n - 1) + 4 - ((!(n & 0xE0)) + (((n & 0xC0) == 0x80) << 1)); return mystere(0) - 3 + (((n & 0xE0) == 0xA0) << 1); } int main(void) { uint32_t i, j; int16_t *buf = malloc(10584320); int16_t *p = buf; FILE *f = fopen("mystere2.bin", "wb"); for (i = 0; i < 320; i++) for (j = 0; j < 8269; j++) { double n = mystere2((double)(j) * 0.062689 * pow(2, (double)mystere(i) / 12.0)) * 16384.0; double s[2]; n *= exp((double)j * -5E-5); if (i & 0x100) n *= exp(-(double)(i & 0xFF) * 0.1); if (j < 441) n *= (double)(j) * 0.002268; if (j > 7828) n *= (double)(8269 - j) * 0.002268; s[0] = s[1] = n; if ((p - buf) > 1999) { s[0] += (double)p[-2000] * 0.3; s[1] += (double)p[-2000] * 0.3; } if (i > 1) { s[0] += (double)p[-33076] * 0.125; s[1] += (double)p[-33076] * 0.375; } if (i > 2) { s[0] += (double)p[-49614] * 0.1875; s[1] += (double)p[-49614] * 0.0625; } *p++ = (int16_t)s[0]; *p++ = (int16_t)s[1]; } fwrite(buf, 1, 10584320, f); return 0; }