hacky declicker

This commit is contained in:
Gordon JC Pearce 2023-06-22 23:04:53 +01:00
parent feb6a92eec
commit 08db6cf19e
3 changed files with 17 additions and 3 deletions

View File

@ -63,7 +63,6 @@ nekobee_voice_note_on(nekobee_synth_t *synth, nekobee_voice_t *voice,
// 1.5M and 1uF
voice->vca_tc = 1 / 1.5 * synth->deltat;
if (!synth->monophonic || !(_ON(voice) || _SUSTAINED(voice))) {
// brand-new voice, or monophonic voice in release phase; set everything up
@ -184,7 +183,8 @@ 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;
//printf("voice->vca_tc=%f", voice->vca_tc);
voice->vca_tc = (10) * synth->deltat;
/* save release velocity */

View File

@ -78,10 +78,14 @@ struct _nekobee_voice_t {
struct blosc_t osc;
float vca_eg, vcf_eg, accent_slug, delay1, delay2, delay3, delay4;
float vca_tc, vcf_tc; // VCA and VCF time constants
float vca_slug;
unsigned char vca_eg_phase, vcf_eg_phase;
int osc_index; /* shared index into osc_audio */
float osc_audio[XSYNTH_NUGGET_SIZE];
float delayhp;
};

View File

@ -120,6 +120,8 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
float vcf_eg = voice->vcf_eg;
float vca_eg = voice->vca_eg;
float vca_slug = voice->vca_slug;
float delayhp = voice->delayhp;
// to get the correct cutoff first we need Q10's collector current
@ -194,7 +196,8 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
delayhp = hp;
fout = delay4-hp;
}
out[i] = fout * vca_eg;
vca_slug = ((vca_eg - vca_slug)*(3000*synth->deltat))+vca_slug;
out[i] = fout * vca_slug;
vcf_eg *= 1 - voice->vcf_tc;
vca_eg *= 1 - voice->vca_tc;
@ -206,6 +209,7 @@ void vcf(nekobee_synth_t *synth, float *out, uint32_t count) {
voice->vcf_eg = vcf_eg;
voice->vca_eg = vca_eg;
voice->vca_slug = vca_slug;
voice->delayhp = delayhp;
}
@ -219,8 +223,14 @@ void nekobee_voice_render(nekobee_synth_t *synth, float *out, uint32_t count) {
// resistor, a 1uF capacitor, and a bunch of other stuff to give a correct
// DC offset and a log tailoff right at the very bottom
if (synth->voice->velocity < 90) {
printf("accent off\n");
synth->voice->vcf_tc =
(1 / ((68 + 1000 * logpot[(int)synth->decay]) * 0.001)) * synth->deltat;
} else {
synth->voice->vcf_tc = 1/(68*0.001)*synth->deltat;
printf("accent on\n");
}
// printf("tc = %f deltat=%f pot=%f\n",synth->voice->vcf_tc,
// synth->deltat,logpot[(int)synth->decay]);