many tweaks to things like time constants

This commit is contained in:
Gordon JC Pearce 2023-07-11 23:03:24 +01:00
parent 08db6cf19e
commit f1d5279535
4 changed files with 11 additions and 9 deletions

View File

@ -275,8 +275,8 @@ void DistrhoPluginNekobi::setParameterValue(uint32_t index, float value)
break; break;
case paramResonance: case paramResonance:
fParams.resonance = value; fParams.resonance = value;
fSynth.resonance = value/100.0f; fSynth.resonance = value/29.82f;
DISTRHO_SAFE_ASSERT(fSynth.resonance >= 0.0f && fSynth.resonance <= 0.95f); DISTRHO_SAFE_ASSERT(fSynth.resonance >= 0.0f && fSynth.resonance <= 3.4f);
break; break;
case paramEnvMod: case paramEnvMod:
fParams.envMod = value; fParams.envMod = value;

View File

@ -122,6 +122,8 @@ void nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param,
signed int value) { signed int value) {
synth->cc[param] = value; synth->cc[param] = value;
printf("%0d %d\n", param, value);
switch (param) { switch (param) {
case MIDI_CTL_MSB_MAIN_VOLUME: case MIDI_CTL_MSB_MAIN_VOLUME:
case MIDI_CTL_LSB_MAIN_VOLUME: case MIDI_CTL_LSB_MAIN_VOLUME:

View File

@ -184,7 +184,7 @@ nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice,
unsigned char previous_top_key; unsigned char previous_top_key;
//printf("voice->vca_tc=%f", voice->vca_tc); //printf("voice->vca_tc=%f", voice->vca_tc);
voice->vca_tc = (10) * synth->deltat; voice->vca_tc = (101) * synth->deltat;
/* save release velocity */ /* save release velocity */

View File

@ -154,7 +154,7 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
// .3 is 300k expressed as MOhm // .3 is 300k expressed as MOhm
// if we expressed it in Ohms output would be in A // if we expressed it in Ohms output would be in A
float IcQ10 = (Vcutoff - 0.65) / .3; // 100k + TM3, IcQ10 in uA float IcQ10 = (Vcutoff - 0.65) / .29; // 100k + TM3, IcQ10 in uA
float IcQ11 = IcQ10 * exp(Vbe1 / 26.0); // in uA float IcQ11 = IcQ10 * exp(Vbe1 / 26.0); // in uA
// printf("Vbe1 = %04f, IcQ10 = %04f, IcQ11 = %04f\n", Vbe1, IcQ10, IcQ11); // printf("Vbe1 = %04f, IcQ10 = %04f, IcQ11 = %04f\n", Vbe1, IcQ10, IcQ11);
@ -167,7 +167,7 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
ct = ct / (1 + ct); ct = ct / (1 + ct);
// printf("cutoff = %04fHz, ct=%f\n", cutoff, ct); // printf("cutoff = %04fHz, ct=%f\n", cutoff, ct);
float hpc = 6.28 * 16 * synth->deltat; float hpc = 6.28 * 50 * synth->deltat;
float fout, fb, hp; float fout, fb, hp;
for (uint32_t i = 0; i < count; i++) { for (uint32_t i = 0; i < count; i++) {
@ -175,7 +175,7 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
float in = voice->osc_audio[i]; float in = voice->osc_audio[i];
float clip = 1.0; float clip = 1.0;
fb = (in - ((fout - .33*in) * synth->resonance * 4)) / clip; fb = (in - ((fout - .133*in) * synth->resonance)) / clip;
//fb = in * synth->resonance*5; //fb = in * synth->resonance*5;
@ -197,7 +197,7 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
fout = delay4-hp; fout = delay4-hp;
} }
vca_slug = ((vca_eg - vca_slug)*(3000*synth->deltat))+vca_slug; vca_slug = ((vca_eg - vca_slug)*(3000*synth->deltat))+vca_slug;
out[i] = fout * vca_slug; out[i] = 0.5*fout * vca_slug;
vcf_eg *= 1 - voice->vcf_tc; vcf_eg *= 1 - voice->vcf_tc;
vca_eg *= 1 - voice->vca_tc; vca_eg *= 1 - voice->vca_tc;
@ -224,12 +224,12 @@ void nekobee_voice_render(nekobee_synth_t *synth, float *out, uint32_t count) {
// DC offset and a log tailoff right at the very bottom // DC offset and a log tailoff right at the very bottom
if (synth->voice->velocity < 90) { if (synth->voice->velocity < 90) {
printf("accent off\n"); // printf("accent off\n");
synth->voice->vcf_tc = synth->voice->vcf_tc =
(1 / ((68 + 1000 * logpot[(int)synth->decay]) * 0.001)) * synth->deltat; (1 / ((68 + 1000 * logpot[(int)synth->decay]) * 0.001)) * synth->deltat;
} else { } else {
synth->voice->vcf_tc = 1/(68*0.001)*synth->deltat; synth->voice->vcf_tc = 1/(68*0.001)*synth->deltat;
printf("accent on\n"); //printf("accent on\n");
} }
// printf("tc = %f deltat=%f pot=%f\n",synth->voice->vcf_tc, // printf("tc = %f deltat=%f pot=%f\n",synth->voice->vcf_tc,
// synth->deltat,logpot[(int)synth->decay]); // synth->deltat,logpot[(int)synth->decay]);