#include #include #include #include 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; int16_t *buf = malloc(10584320); int16_t *p = buf; FILE *f = fopen("mystere.bin", "wb"); for (i = 0; i < 320; i++) { uint32_t j; for (j = 0; j < 8269; j++) { double n = sin((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; }