Skip to content

Negative transform is applied incorrectly #1651

@baskanov

Description

@baskanov

FluidSynth version

FluidSynth runtime version 2.3.4
Copyright (C) 2000-2023 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

FluidSynth executable version 2.3.4
Sample type=double

Describe the bug

When applying negative transform, FluidSynth maps source value of 127 to 1/128. With CC7 = 127, CC11 = 127 and Velocity = 127 this results in attenuation of about 0.41 dB or 4.6%.

Expected behavior

There should be no attenuation when CC7 = 127, CC11 = 127 and Velocity = 127.

According to SF2 spec version 2.01, section 8.2.2, maximum possible controller input corresponds to the minimum possible output.

Also according to the sections 8.4.1, 8.4.5 and 8.4.7, input value of 127 is mapped to 0.

Steps to reproduce

  1. Download and extract negative.zip.
  2. Run fluidsynth --fast-render out.wav --gain 0.8409109350468105 negative.mid negative.sf2.
  3. Open the generated out.wav and observe that the peak amplitude is less than 1.

Additional context

The gain value of 0.8409109350468105 is used to compensate gain added by fluid_iir_filter_q_from_dB()/fluid_iir_filter_set_q() and is calculated like this:

python3 -c 'from math import sqrt ; print(sqrt(10**(-3.01 / 20)))'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions