From b02468867a0910fa43ec254420bdef915d234428 Mon Sep 17 00:00:00 2001 From: Kizarm Date: Sun, 10 Dec 2023 10:52:48 +0100 Subject: [PATCH] spectrum blur suppression --- main.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index eec343d..cf04827 100644 --- a/main.cpp +++ b/main.cpp @@ -16,19 +16,24 @@ static constexpr int OFS = 20; static CFFT fft (ORDER); static vector mono; +static bool sign = false; 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]; memset (&data,0, TAPS * sizeof(complex)); int n = 0; while (true) { const char c = s [n]; if (c == '\0') break; - const complex fill = c == '#' ? one : zero; - const int k = n + OFS; - data[k] = fill; - data[TAPS - k] = fill; + 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; + data[k] = fill; + data[TAPS - k] = fill; + sign = ! sign; + } putchar(c); n += 1; } @@ -82,7 +87,7 @@ int main (int argc, char *argv[]) { for (const char * p = buffer; *p; p++) { banchr (*p); } - WriteSound (); + WriteSound ("test.vaw"); return 0; }