wpkorg35

Files: wpkorg35.h, wpkorg35.c

Analogue model of the Korg 35 Lowpass Filter
Original port done by Will Pirkle: http://www.willpirkle.com/Downloads/AN-5Korg35_V3.pdf

Functions

sp_wpkorg35_create(sp_wpkorg35 **wpkorg35)
sp_wpkorg35_init(sp_data *sp, sp_wpkorg35 *wpkorg35)
sp_wpkorg35_compute(sp_data *sp, sp_wpkorg35 *wpkorg35, SPFLOAT *input, SPFLOAT *out)
sp_wpkorg35_destroy(sp_wpkorg35 **wpkorg35)

Optional Parameters

cutoff: Filter cutoff
(Default value: 1000)
res: Filter resonance (should be between 0-2)
(Default value: 1.0)
saturation: Filter saturation.
(Default value: 0.0)

Inputs

input: Audio input.

Outputs

out: Signal output.

Example Code

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

typedef struct {
    sp_wpkorg35 *wpkorg35;
    sp_noise *noise;
    sp_randi *randi;
} UserData;

void process(sp_data *sp, void *udata) {
    UserData *ud = udata;
    SPFLOAT noise = 0, wpkorg35 = 0, randi = 0;
    sp_randi_compute(sp, ud->randi, NULL, &randi);
    sp_noise_compute(sp, ud->noise, NULL, &noise);
    ud->wpkorg35->cutoff = randi;
    sp_wpkorg35_compute(sp, ud->wpkorg35, &noise, &wpkorg35);
    sp->out[0] = wpkorg35;
}

int main() {
    srand(1234567);
    UserData ud;
    sp_data *sp;
    sp_create(&sp);

    sp_wpkorg35_create(&ud.wpkorg35);
    sp_noise_create(&ud.noise);
    sp_randi_create(&ud.randi);

    sp_wpkorg35_init(sp, ud.wpkorg35);
    ud.wpkorg35->res = 1.99;
    sp_noise_init(sp, ud.noise);
    ud.noise->amp = 0.01;
    sp_randi_init(sp, ud.randi);
    ud.randi->min = 100;
    ud.randi->max = 3000;
    ud.randi->cps = 10;

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

    sp_wpkorg35_destroy(&ud.wpkorg35);
    sp_noise_destroy(&ud.noise);
    sp_randi_destroy(&ud.randi);

    sp_destroy(&sp);
    return 0;
}