fof
Files: fof.h, fof.c
Produces sinusoid bursts for granular and formant synthesis
sp_fof_create(sp_fof **fof)
sp_fof_init(sp_data *sp, sp_fof *fof, sp_ftbl *sine, sp_ftbl *win, int iolaps, SPFLOAT iphs)
sp_fof_compute(sp_data *sp, sp_fof *fof, SPFLOAT *out)
sp_fof_destroy(sp_fof **fof)
Mandatory Parameters
sine: ftable for sine wave.
(Recommended value: N/A)
win: Ftable for envelope function (use either gen_line or gen_sinecomp)
(Recommended value: N/A)
iolaps: Maximum number of foflet overlaps.
(Recommended value: 100)
iphs: Phase
(Recommended value: 0)
Optional Parameters
amp: Overall amplitude
(Default value: 0.5)
fund: Fundamental frequency
(Default value: 100)
form: Formant frequency.
(Default value: 500)
oct: Octaviation index, if greater than zero, lowers the effective fund frequency by attenuating odd-numbered sine bursts. whole numbers are full octaves. fractions transpositional.
(Default value: 0)
band: Bandwidth (in -6db) expressed in Hz. The bandwidth determines the rate of exponential decay throughout the sineburst, before the enveloping is applied.
(Default value: 50)
ris: Rise of sinusoid burst (in seconds)
(Default value: 0.003)
dec: Decay of the sinusoid burst (in seconds).
(Default value: 0.0007)
dur: OVerall duration of sinusoid burst (in seconds).
(Default value: 0.02)
Outputs
out: Signal output.
Example Code
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "soundpipe.h"
typedef struct {
sp_fof *fof;
sp_ftbl *sine;
sp_ftbl *win;
} UserData;
void process(sp_data *sp, void *udata) {
UserData *ud = udata;
SPFLOAT osc = 0, fof = 0;
sp_fof_compute(sp, ud->fof, &osc, &fof);
sp->out[0] = fof;
}
int main() {
srand(1234567);
UserData ud;
sp_data *sp;
sp_create(&sp);
sp_ftbl_create(sp, &ud.sine, 2048);
sp_ftbl_create(sp, &ud.win, 1024);
sp_fof_create(&ud.fof);
sp_gen_sine(sp, ud.sine);
sp_gen_composite(sp, ud.win, "0.5 0.5 270 0.5");
sp_fof_init(sp, ud.fof, ud.sine, ud.win, 100, 0);
sp->len = 44100 * 10;
sp_process(sp, &ud, process);
sp_fof_destroy(&ud.fof);
sp_ftbl_destroy(&ud.sine);
sp_ftbl_destroy(&ud.win);
sp_destroy(&sp);
return 0;
}