Ejemplo n.º 1
0
    void init(int _channels, double _sampleRate) override {
        AKSoundpipeKernel::init(_channels, _sampleRate);

        sp_lpf18_create(&lpf180);
        sp_lpf18_create(&lpf181);
        sp_lpf18_init(sp, lpf180);
        sp_lpf18_init(sp, lpf181);
        lpf180->dist = 0.5;
        lpf181->dist = 0.5;
        lpf180->cutoff = 1500;
        lpf181->cutoff = 1500;
        lpf180->res = 0.5;
        lpf181->res = 0.5;

        distortionRamper.init();
        cutoffFrequencyRamper.init();
        resonanceRamper.init();
    }
    void init(int channelCount, double inSampleRate) {
        channels = channelCount;

        sampleRate = float(inSampleRate);

        sp_create(&sp);
        sp->sr = sampleRate;
        sp->nchan = channels;
        sp_lpf18_create(&lpf18);
        sp_lpf18_init(sp, lpf18);
        lpf18->dist = 0.5;
        lpf18->cutoff = 1500;
        lpf18->res = 0.5;
    }
    void init(int channelCount, double inSampleRate) {
        channels = channelCount;

        sampleRate = float(inSampleRate);

        sp_create(&sp);
        sp->sr = sampleRate;
        sp->nchan = channels;
        sp_lpf18_create(&lpf18);
        sp_lpf18_init(sp, lpf18);
        lpf18->dist = 0.5;
        lpf18->cutoff = 1500;
        lpf18->res = 0.5;

        distortionRamper.init();
        cutoffFrequencyRamper.init();
        resonanceRamper.init();
    }
Ejemplo n.º 4
0
int main() {
    srand(time(NULL));
    int i;
    UserData ud;
    sp_data *sp;
    sp_create(&sp);
    sp_ftbl_create(sp, &ud.ft, 4096);
    for(i = 0; i < 3; i++) sp_osc_create(&ud.osc[i]);
    sp_lpf18_create(&ud.lpf);
    sp_osc_create(&ud.lfo);
    sp_ftbl_create(sp, &ud.sine_ft, 4096);
    sp_gen_sine(sp, ud.sine_ft);

    sp_gen_line(sp, ud.ft, "0 1 4096 -1");
    sp_osc_init(sp, ud.osc[0], ud.ft);
    ud.osc[0]->freq = sp_midi2cps(40 - 0.05);
    sp_osc_init(sp, ud.osc[1], ud.ft);
    ud.osc[1]->freq = sp_midi2cps(40 - 12);
    sp_osc_init(sp, ud.osc[2], ud.ft);
    ud.osc[2]->freq = sp_midi2cps(40 + 0.05);
    sp_lpf18_init(sp, ud.lpf);
    sp_osc_init(sp, ud.lfo, ud.sine_ft);
    ud.lfo->freq = 0.4;

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

    sp_ftbl_destroy(&ud.ft);
    for(i = 0; i < 3; i++) sp_osc_destroy(&ud.osc[i]);
    sp_lpf18_destroy(&ud.lpf);
    sp_osc_destroy(&ud.lfo);
    sp_ftbl_destroy(&ud.sine_ft);

    sp_destroy(&sp);
    return 0;
}