#include <stdio.h>
#include <stdlib.h>
#define A (0.0)
int main(int argc, char *argv[])
{
double in, out=0, a;
a = A;
if (argc>1)
a = atof(argv[1]);
while (scanf("%lf", &in) != EOF) {
out = a*out + (1-a)*in;
printf("%f\n",out);
}
return 0;
}
% white 1000 | rcf 0.5 | fftw | gp_fft > rcf_fft.png
% white 1000 | rcf 0.9 | fftw | gp_fft > rcf09_fft.png
% white 1000 | rcf 0.99 | fftw | gp_fft > rcf099_fft.png
#include <stdio.h>
#include <stdlib.h>
#define N0 (3)
double x[256];
int main(int argc, char *argv[])
{
int i, N;
double in, out=0;
N = N0;
if (argc>1)
N = atoi(argv[1]);
if (N>255) exit(1);
for (i=0; i<N ;i++) x[i] = 0;
while (scanf("%lf", &in) != EOF) {
out = 0;
x[N] = in;
for (i=0; i<N ;i++) {
x[i] = x[i+1];
out += x[i];
}
printf("%f\n",out/N);
}
return 0;
}
% white 1000 | mavgf 3 | fftw | gp_fft > mavgf3_fft.png
% white 1000 | mavgf 2 | fftw | gp_fft > mavgf2_fft.png
% white 1000 | mavgf 4 | fftw | gp_fft > mavgf4_fft.png
% white 1000 | mavgf 8 | fftw | gp_fft > mavgf8_fft.png
% white 1000 | mavgf 10 | fftw | gp_fft > mavgf10_fft.png
#include <stdio.h>
#define M (16)
double line[256];
int main(int argc, char *argv[])
{
int i, m;
double in, out;
m = M;
if (argc>1)
m = atoi(argv[1]);
for (i=0; i<m ;i++) line[i]=0;
i=0;
while (scanf("%lf", &in) != EOF) {
out = in - line[i];
line[i] = in;
i = (i+1)%m;
printf("%f\n",out);
}
return 0;
}
% white 1000 | bibun 16 | fftw | gp_fft > bibun_fft.png
#include <stdio.h>
#define M (1)
double line[256];
int main(int argc, char *argv[])
{
int i, m;
double in, out;
m = M;
if (argc>1)
m = atoi(argv[1]);
for (i=0; i<m ;i++) line[i]=0;
i=0;
while (scanf("%lf", &in) != EOF) {
out = line[i];
line[i] += in;
i = (i+1)%m;
printf("%f\n",out);
}
return 0;
}
% white 1000 | sekibun | fftw | gp_fft > sekibun_fft.png
% rand 1000 | sekibun | fftw | gp_fft > sekibunx_fft.png
% white 1000 | sekibun 16 | fftw | gp_fft > sekibun16_fft.png
% rand 1000 | sekibun 16 | fftw | gp_fft > sekibun16x_fft.png
% white 1000 | sekibun | bibun 16 | fftw | gp_fft > sinc_fft.png
% rand 1000 | sekibun | bibun 16 | fftw | gp_fft > sincx_fft.png
#include <stdio.h>
#define M (16)
int main(int argc, char *argv[])
{
int i=0, m;
double in;
m = M;
if (argc>1)
m = atoi(argv[1]);
while (scanf("%lf", &in) != EOF) {
if (!(i++%m)) printf("%f\n",in);
}
return 0;
}
% white 1000 40 10 | fftw | gp_fftl > downs0_fftl.png
% white 1000 40 10 | downs 10 | fftw | gp_fftl > downs_fftl.png
% white 1000 60 10 | fftw | gp_fftl > downs0x_fftl.png
% white 1000 60 10 | downs 10 | fftw | gp_fftl > downsx_fftl.png
#include <stdio.h>
#define L (16)
int main(int argc, char *argv[])
{
int i, l;
double in;
l = L;
if (argc>1)
l = atoi(argv[1]);
while (scanf("%lf", &in) != EOF) {
for (i=0; i<l ;i++)
if (!i)
printf("%f\n",in);
else
printf("%f\n",0.0); // 最初、誤って、printf("%f\n",0);と記述していた。。
}
return 0;
}
% white 1000 | ups 10 | fftw | gp_fft > ups_fftx.png
% rand 1000 | ups 10 | fftw | gp_fft > upsx_fftx.png
% white 1000 | ups 10 | head -500| gp_wav > upsx.png
printf("%f\n",0);
printf("%f\n",0.0);
% white 1000 | ups 10 | head -500| gp_wav > ups.png
% white 1000 | ups 10 | fftw | gp_fft > ups_fft.png
% rand 1000 | ups 10 | fftw | gp_fft > upsx_fft.png
% white 1000 100 10 | fftw | gp_fftl > ups02_fftl.png
% white 1000 100 10 | ups 10 | fftw | gp_fftl > ups2_fftl.png
% dds 10 1000 | fftw | gp_fftl > ups010_fftl.png
% dds 10 1000 | ups 10 | fftw | gp_fftl > ups10_fftl.png
dds 10 1000 | gp_wav > ups010.png
dds 10 1000 | ups 10 | gp_wav > ups10.png
white 1000 | sekibun | bibun 10 | fftw | gp_fftl > sinc10_fftl.png
dds 10 1000 | ups 10 | sekibun | bibun 10 | fftw | gp_fftl > ups010sinc_fftl.png
dds 10 1000 | ups 10 | sekibun | bibun 10 | gp_wav > ups010sinc.png
dds 10 1000 | head -20 | gp_wavp > dds10x.png
dds 10 1000 | ups 10 | sekibun | bibun 10 | head -200 | gp_wavp > ups010sincx.png
dds 10 1000 | ups 10 | sekibun | bibun 10 | sekibun | bibun 10 | fftw | gp_fftl > ups010sinc2_fftl.png
dds 10 1000 | ups 10 | sekibun | bibun 10 | sekibun | bibun 10 | gp_wav > ups010sinc2.png
dds 10 1000 | head -20 | gp_wavp > dds10x.png
dds 10 1000 | ups 10 | sekibun | bibun 10 | sekibun | bibun 10 | head -200 | gp_wavp > ups010sinc2x.png
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SAMPLE (1000)
int main(int argc, char *argv[])
{
int S;
double x, y, y1, y2;
double B0, a1, a2, b0, F0, T;
S = SAMPLE;
F0 = S/10.;
B0 = 1;
if (argc>1)
F0 = atof(argv[1]);
if (argc>2)
B0 = atof(argv[2]);
if (argc>3)
S = atoi(argv[3]);
y1 = y2 = 0;
T = 1./S;
a1 = 2*exp(-M_PI*B0*T)*cos(2*M_PI*F0*T);
a2 = -exp(-2*M_PI*B0*T);
b0 = 1-a1-a2;
while (scanf("%lf", &x) != EOF) {
y = a1*y1+a2*y2+b0*x;
y2 = y1;
y1 = y;
printf("%f\n",y);
}
return 0;
}
% white 1000 | resonator 100 1 | fftw | gp_fft > resonator_fft.png
% white 1000 | resonator 100 10 | fftw | gp_fft > resonator10_fft.png
% white 1000 | resonator 100 20 | fftw | gp_fft > resonator20_fft.png
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SAMPLE (1000)
int main(int argc, char *argv[])
{
int S;
double x, y, x1, x2, y1, y2;
double B0, a1, a2, b1, c0, F0, T;
S = SAMPLE;
F0 = S/10.;
B0 = 1;
if (argc>1)
F0 = atof(argv[1]);
if (argc>2)
B0 = atof(argv[2]);
if (argc>3)
S = atoi(argv[3]);
x1 = x2 = y1 = y2 = 0;
T = 1./S;
a1 = 2*exp(-M_PI*B0*T)*cos(2*M_PI*F0*T);
a2 = -exp(-2*M_PI*B0*T);
b1 = -2*cos(2*M_PI*F0*T);
c0 = (1-a1-a2)/(2+b1);
while (scanf("%lf", &x) != EOF) {
y = a1*y1+a2*y2+c0*(x+b1*x1+x2);
x2 = x1;
x1 = x;
y2 = y1;
y1 = y;
printf("%f\n",y);
}
return 0;
}
% white 1000 | notchf 100 1 | fftw | gp_fft > notchf_fft.png
% white 1000 | notchf 100 10 | fftw | gp_fft > notchf10_fft.png
% white 1000 | notchf 100 20 | fftw | gp_fft > notchf20_fft.png
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char *argv[])
{
double x, y, x1, y1;
double a;
a = 0.;
if (argc>1)
a = atof(argv[1]);
x1 = y1 = 0;
while (scanf("%lf", &x) != EOF) {
y = a*y1-a*x+x1;
x1 = x;
y1 = y;
printf("%f\n",y);
}
return 0;
}
% white 1000 | allpassf 0.5 | fftw | gp_fft > allpassf05_fft.png
% white 1000 | allpassf 0.7 | fftw | gp_fft > allpassf07_fft.png
% white 1000 | allpassf 0.9 | fftw | gp_fft > allpassf09_fft.png
% white 1000 | head -50 | allpassf 0.5 | gp_wav > allpassf05_wav.png
% white 1000 | head -50 | allpassf 0.7 | gp_wav > allpassf07_wav.png
% white 1000 | head -50 | allpassf 0.9 | gp_wav > allpassf09_wav.png
% white 1000 | head -50 | gp_wav > white1000_wav.png
% white 1000 | head -50 | allpassf 0 | gp_wav > allpassf0_wav.png
% white0 1000 | fftw | fftw_unwrap | gp_ang > white01000_ang.png
% white0 1000 | allpassf 0 | fftw | fftw_unwrap | gp_ang > allpassf0_ang.png
% white0 1000 | allpassf 0.5 | fftw | fftw_upwrap | gp_ang > allpassf05_ang.png
% white0 1000 | allpassf 0.7 | fftw | fftw_upwrap | gp_ang > allpassf07_ang.png
% white0 1000 | allpassf 0.9 | fftw | fftw_upwrap | gp_ang > allpassf09_ang.png