spectrum blur suppression

This commit is contained in:
Kizarm 2023-12-10 10:52:48 +01:00
parent 8a067fe04f
commit b02468867a

View file

@ -16,19 +16,24 @@ static constexpr int OFS = 20;
static CFFT fft (ORDER); static CFFT fft (ORDER);
static vector<double> mono; static vector<double> mono;
static bool sign = false;
void cputs (const char * s) { void cputs (const char * s) {
const complex one (0.0, 256.0), zero (0.0, 0.0); const complex plus (0.0, 256.0), minus (0.0, -256.0);
complex data [TAPS]; complex data [TAPS];
memset (&data,0, TAPS * sizeof(complex)); memset (&data,0, TAPS * sizeof(complex));
int n = 0; int n = 0;
while (true) { while (true) {
const char c = s [n]; const char c = s [n];
if (c == '\0') break; if (c == '\0') break;
const complex fill = c == '#' ? one : zero; if (c == '#' ) {
// Střídání fáze 0/180 dost potlačí rozmazání spektra.
const complex fill = sign ? plus : minus;
const int k = n + OFS; const int k = n + OFS;
data[k] = fill; data[k] = fill;
data[TAPS - k] = fill; data[TAPS - k] = fill;
sign = ! sign;
}
putchar(c); putchar(c);
n += 1; n += 1;
} }
@ -82,7 +87,7 @@ int main (int argc, char *argv[]) {
for (const char * p = buffer; *p; p++) { for (const char * p = buffer; *p; p++) {
banchr (*p); banchr (*p);
} }
WriteSound (); WriteSound ("test.vaw");
return 0; return 0;
} }