gen_composite
Files: ftbl.h, ftbl.c
Generate a composite waveform of sinusoids
sp_gen_composite(sp_data *sp, sp_ftbl *ft , char *argstring)
Parameters
argstring: a string of space-separated parameters, in groups of four:
arg 1 is the partial number. must be positive, but it doesn't need to be a whole number.
arg 2 is the strength.
arg 3 is the initial phase (expressed in degrees)
arg 4 is the dc offset. A dc offset of 2 will put a 2-strength sinusoid in the range
from (-2,2) to (0, 4)
(Recommended value: 0.5 0.5 270 0.5)
Example Code
#include <stdio.h>
#include "soundpipe.h"
int main() {
sp_data *sp;
sp_create(&sp);
sp_ftbl *ft;
sp_ftbl_create(sp, &ft, 1024);
sp_gen_composite(sp, ft, "0.5 0.5 270 0.5");
int i;
FILE *fp= fopen("plot.dat", "w");
for(i = 0; i < ft->size; i++) {
fprintf(fp, "%d %g\n", i, ft->tbl[i]);
}
printf("%d plot points written to plot.dat. Run write_plot.sh to see the result.\n", ft->size);
fclose(fp);
sp_ftbl_destroy(&ft);
sp_destroy(&sp);
return 0;
}