revsc

Files: revsc.h, revsc.c

8 FDN stereo reverb

Functions

sp_revsc_create(sp_revsc **revsc)
sp_revsc_init(sp_data *sp, sp_revsc *revsc)
sp_revsc_compute(sp_data *sp, sp_revsc *revsc, SPFLOAT *input_1, SPFLOAT *input_2, SPFLOAT *out_1, SPFLOAT *out_2)
sp_revsc_destroy(sp_revsc **revsc)

Optional Parameters

feedback: Value between 0-1 that sets feedback value. The larger the value, the longer the decay.
(Default value: 0.97)
lpfreq: low pass cutoff frequency.
(Default value: 10000)

Inputs

input_1: First input.
input_2: Second input.

Outputs

out_1: Channel 1 output. Most likely for the left channel.
out_2: Channel 2 output. Mose likely for the right channel.

Example Code

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "soundpipe.h"

typedef struct {
    sp_noise *ns;
    sp_revsc *rev;
    int counter;
} UserData;

void process(sp_data *data, void *ud) {
    UserData *udata = ud;
    SPFLOAT in = 0;
    SPFLOAT out = 0;
    SPFLOAT foo = 0;
    sp_noise_compute(data, udata->ns, NULL, &in);
    
    if(udata->counter < 2000) {
        udata->counter = (udata->counter + 1) % 5000;
    }else{
        in = 0;
    }
    sp_revsc_compute(data, udata->rev, &in, &in, &data->out[0], &foo); 
}

int main() {
    srand(time(NULL));
    UserData ud;
    ud.counter = 0;
    sp_data *sp;
    sp_create(&sp);
    sp_noise_create(&ud.ns);
    sp_revsc_create(&ud.rev);
    sp_noise_init(sp, ud.ns);
    sp_revsc_init(sp, ud.rev);

    sp->len = 44100 * 5;
    sp_process(sp, &ud, process);

    sp_noise_destroy(&ud.ns);
    sp_revsc_destroy(&ud.rev);
    sp_destroy(&sp);
    return 0;
}