spectrum blur suppression
This commit is contained in:
parent
8a067fe04f
commit
b02468867a
1 changed files with 11 additions and 6 deletions
11
main.cpp
11
main.cpp
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue