예제 #1
0
파일: growl.c 프로젝트: andreamazz/AudioKit
void growl_compute(sp_data *sp, growl_d *form, SPFLOAT *in, SPFLOAT *out)
{
    int i;
    SPFLOAT tmp_in = *in;
    SPFLOAT tmp_out = *in;
    SPFLOAT tf = 0.0;
    SPFLOAT bf = 0.0;
    SPFLOAT freq = 0.0;
    SPFLOAT *x = &form->x;
    SPFLOAT *y = &form->y;
//    *out = 0.0;
//
    for(i = 0; i < 4; i++) {
        tf = (*x) *
            (formants[i + 3] - formants[i]) +
            formants[i];
        bf = (*x) *
            (formants[i + 11] - formants[i + 7]) +
            formants[i + 7];
        freq = (*y) * (bf - tf) + tf;
        form->filt[i]->freq = freq;
        form->filt[i]->bw =
            ((freq * 0.02) + 50);
        sp_reson_compute(sp, form->filt[i], &tmp_in, &tmp_out);
        tmp_in = tmp_out;
    }
    *out = *in;
    sp_bal_compute(sp, form->bal, &tmp_out, in, out);
    tmp_out = *out;
    sp_dcblock_compute(sp, form->dcblk, &tmp_out, out);
}
예제 #2
0
void write_noise(sp_data *data, void *ud) {
    udata *udata = ud;
    SPFLOAT in = 0;
    SPFLOAT out = 0;
    sp_noise_compute(data, udata->ns, NULL, &in);
    udata->reson->freq = 4000;
    udata->reson->bw = 1000;
    sp_reson_compute(data, udata->reson, &in, &out); 
    data->out[0] = out * 0.1;
}