vca, but envelopes need work

This commit is contained in:
Gordon JC Pearce 2023-06-20 21:31:43 +01:00
parent 0b66a8d893
commit 2d0e58a3ed
2 changed files with 12 additions and 1 deletions

View File

@ -59,6 +59,9 @@ nekobee_voice_note_on(nekobee_synth_t *synth, nekobee_voice_t *voice,
voice->key = key;
voice->velocity = velocity;
voice->vcf_eg = 9.8f;
voice->vca_eg = 1.0f;
// 1.5M and 1uF
voice->vca_tc = 1 / 1.5 * synth->deltat;
if (!synth->monophonic || !(_ON(voice) || _SUSTAINED(voice))) {
@ -181,6 +184,9 @@ nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice,
{
unsigned char previous_top_key;
voice->vca_tc = 1 / 0.0022 * synth->deltat;
/* save release velocity */
voice->velocity = rvelocity;

View File

@ -119,6 +119,7 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
delay3 = voice->delay3, delay4 = voice->delay4;
float vcf_eg = voice->vcf_eg;
float vca_eg = voice->vca_eg;
float delayhp = voice->delayhp;
// to get the correct cutoff first we need Q10's collector current
@ -193,8 +194,10 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
delayhp = hp;
fout = delay4-hp;
}
out[i] = fout;
out[i] = fout * vca_eg;
vcf_eg *= 1 - voice->vcf_tc;
vca_eg *= 1 - voice->vca_tc;
}
voice->delay1 = delay1;
voice->delay2 = delay2;
@ -202,6 +205,8 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
voice->delay4 = delay4;
voice->vcf_eg = vcf_eg;
voice->vca_eg = vca_eg;
voice->delayhp = delayhp;
}