fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fluid-dev] Possible bugs in mod and release envelope math


From: Andrew Suffield
Subject: [fluid-dev] Possible bugs in mod and release envelope math
Date: Sun, 10 Jul 2011 01:07:31 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

I've been working through the source, and while I don't pretend to
fully understand what's going on here, I've spotted a couple of things
that seem wrong:


fluid_mod_get_value sets range1 and range2 to 127, which are used as
the divisor for linear and bipolar modulators. That means, for a
bipolar mod, an input of 0 maps to -1 and an input of 127 maps to 1,
and there is no input which maps to 0. I looked at SF2.01 and it says
the range should be from -1 to 127/128 (ie, range1 and range2 should
be 128).

This has the unfortunate consequence that the default pan setting of
64 does not generate identical output on both channels (which is how I
spotted this), and the optimisation in fluid_rvoice_buffers_mix is
defeated because there will never be a centered stereo sample
(although since it's clearly never worked, the merit of that
optimisation is questionable).


fluid_voice_update_param contains these:

  case GEN_VOLENVRELEASE:             /* SF2.01 section 8.1.3 # 38 */
    x = _GEN(voice, GEN_VOLENVRELEASE);
    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);
    break;

  case GEN_MODENVRELEASE:                                  /* SF 2.01 section 
8.1.3 # 30 */
    x = _GEN(voice, GEN_MODENVRELEASE);
    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);

    break;

Pay particular attention to the 'max' parameter on the release
section. It's set to 1 for volenv and 2 for modenv. Both volenv and
modenv have a max of 2 for the decay and sustain sections, so there's
no apparent reason for this variation. I'm not really sure what's
going on here but it feels strange.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]