Index: src/iiwu_voice.c =================================================================== RCS file: /cvsroot/iiwusynth/iiwusynth/src/iiwu_voice.c,v retrieving revision 1.23 diff -u -r1.23 iiwu_voice.c --- src/iiwu_voice.c 22 May 2002 15:30:09 -0000 1.23 +++ src/iiwu_voice.c 24 May 2002 14:03:16 -0000 @@ -1333,8 +1333,9 @@ * So convert from linear amplitude to cb. */ if (voice->volenv_val>0){ - iiwu_real_t centibels=100.0*log(voice->volenv_val)/log(10); /* For example: val=0.5 => -60 cB */ - iiwu_real_t env_value=1+(centibels/960.0); /* 1 + (-60/960) */ + iiwu_real_t attn_and_lfo = voice->attenuation + voice->modlfo_val * voice->modlfo_to_vol; + iiwu_real_t amp = voice->volenv_val * pow (10., attn_and_lfo / -200.); + iiwu_real_t env_value = - ((-200. * log (amp) / log (10.) - attn_and_lfo) / 960. - 1); env_value=(env_value < 0.0 ? 0.0 : env_value); env_value=(env_value > 1.0 ? 1.0 : env_value); voice->volenv_val=env_value;