diff --git a/src/rvoice/fluid_rvoice.c b/src/rvoice/fluid_rvoice.c index 44bdd05b..fc554c06 100644 --- a/src/rvoice/fluid_rvoice.c +++ b/src/rvoice/fluid_rvoice.c @@ -514,7 +514,7 @@ fluid_rvoice_noteoff(fluid_rvoice_t* voice, unsigned int min_ticks) */ if (fluid_adsr_env_get_val(&voice->envlfo.volenv) > 0){ fluid_real_t lfo = fluid_lfo_get_val(&voice->envlfo.modlfo) * -voice->envlfo.modlfo_to_vol; - fluid_real_t amp = fluid_adsr_env_get_val(&voice->envlfo.volenv) * pow (10.0, lfo / -200); + fluid_real_t amp = fluid_adsr_env_get_val(&voice->envlfo.volenv) * fluid_cb2amp(lfo); fluid_real_t env_value = - ((-200 * log (amp) / log (10.0) - lfo) / 960.0 - 1); fluid_clip (env_value, 0.0, 1.0); fluid_adsr_env_set_val(&voice->envlfo.volenv, env_value); diff --git a/src/synth/fluid_voice.c b/src/synth/fluid_voice.c index 8a996c44..08c48355 100644 --- a/src/synth/fluid_voice.c +++ b/src/synth/fluid_voice.c @@ -1014,7 +1014,7 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen) fluid_clip(x, -12000.0f, 8000.0f); count = 1 + NUM_BUFFERS_ATTACK(x); fluid_voice_update_volenv(voice, FLUID_VOICE_ENVATTACK, - count, 1.0f, count ? 1.0f / count : 0.0f, -1.0f, 1.0f); + count, 1.0f, 1.0f / count, -1.0f, 1.0f); break; case GEN_VOLENVHOLD: /* SF2.01 section 8.1.3 # 35 */ @@ -1039,7 +1039,7 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen) fluid_clip(x, FLUID_MIN_VOLENVRELEASE, 8000.0f); count = 1 + NUM_BUFFERS_RELEASE(x); fluid_voice_update_volenv(voice, FLUID_VOICE_ENVRELEASE, - count, 1.0f, count ? -1.0f / count : 0.0f, 0.0f, 1.0f); + count, 1.0f, -1.0f / count, 0.0f, 1.0f); break; /* Modulation envelope */ @@ -1055,7 +1055,7 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen) fluid_clip(x, -12000.0f, 8000.0f); count = 1 + NUM_BUFFERS_ATTACK(x); fluid_voice_update_modenv(voice, FLUID_VOICE_ENVATTACK, - count, 1.0f, count ? 1.0f / count : 0.0f, -1.0f, 1.0f); + count, 1.0f, 1.0f / count, -1.0f, 1.0f); break; case GEN_MODENVHOLD: /* SF2.01 section 8.1.3 # 27 */ @@ -1080,7 +1080,7 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen) fluid_clip(x, -12000.0f, 8000.0f); count = 1 + NUM_BUFFERS_RELEASE(x); fluid_voice_update_modenv(voice, FLUID_VOICE_ENVRELEASE, - count, 1.0f, count ? -1.0f / count : 0.0f, 0.0f, 2.0f); + count, 1.0f, -1.0f / count, 0.0f, 2.0f); break;