spectrum blur suppression
This commit is contained in:
parent
8a067fe04f
commit
b02468867a
1 changed files with 11 additions and 6 deletions
17
main.cpp
17
main.cpp
|
@ -16,19 +16,24 @@ static constexpr int OFS = 20;
|
|||
|
||||
static CFFT fft (ORDER);
|
||||
static vector<double> 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue