-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chorus malfunctioning for single precision builds #1331
Comments
I forgot to mention, I've built my FluidSynth using MSVC in Visual Studio 2022. |
Thanks for the report. I have reproduced this and can confirm that something isn't correct. It doesn't seem to be related to OpenMP though: On Linux, compiling with and without OpenMP enabled gives a nice modulating chorus effect. On Windows, using the officially distributed MSVC binaries, Could be due to a compiler optimization. Can you pls. share the build logs when you compiled it with MSVC? I'd like to see the exact version of MSVC and the optimization flags used. |
I'm afraid, I don't know how to get a log with information you need. But, here is the version of the compiler: 14.40.33807. Also, here is an excerpt from build.ninja file:
|
The issue seems to be caused by compiling with single precision floats. I.e. when calling cmake with |
I promoted all the floating point math in @jjceresa If you have some time, could you have a look into this? I've used the soundfont zipped below and then in fluidsynth's shell did a
The audible difference between compiling with |
@jjceresa Never mind, I found it: fluidsynth/src/rvoice/fluid_chorus.c Line 250 in 231b690
In single precision math, this gives @RoqueDeicide Can you please test the fluidsynth-x64 binaries? |
Unfortunately, the core problem persists: The code which is meant to handle numerical instabilities when the phase of the oscillator is near PI/2 doesn't work as intended: fluidsynth/src/rvoice/fluid_chorus.c Lines 267 to 277 in 231b690
If the phase
Since
And that's it. Everything is So yes, promoting |
I've downloaded and installed the binaries from x64 artifact from the link. The issue appears to persist: with nr of 3 pan is on the left, with 4 it appears centered and with 6 it's on the right. |
Hello,
b1) The expected frequency "freq" minimum is 0.1Hz (min of synth.chorus.speed). Default "freq" is 0.3Hz. b2)Using single precision, a very low initial phase (i.e "a" = 0), makes the output peak to peak [-0.777, +0.777] instead of expected [-1, +1] .
To solve the issue , behaviour (b1) (for an expected frequency "freq" minimum = 0.1Hz) and behaviour (b2), we need the
Change c2 at line 244:
change c3 at line 267:
|
Good to hear from you JJC. I've committed your proposals.
Right, that'll prevent us from hitting PI/2 exactly - I overlooked that. @RoqueDeicide Please try these fluidsynth-x64 binaries again. It sounds absolutely fine to me now. If it still doesn't work for you, double-check that you have correctly replaced the binaries and provide more information on how to reproduce what you hear, esp. the Soundfont you've used, the commandline, and also an audio rendering of what you hear. |
Chorus appears to work now. This issue can be closed by the relevant pull request merge. Thanks everyone! |
FluidSynth version
2.3.5 x64 and x86 Windows builds. Most likely affects previous versions as well.
Describe the bug
An issue had been bugging me for about half a year: playing MIDI tracks using FluidSynth would always result in a very left-heavy audio. I initially thought that my soundfont wasn't very well balanced, until I encountered a track with a channel that had center pan and a program which I had just centered. Realizing something was wrong with FluidSynth, I first turned off chorus, and audio became centered! Thinking that "synth.chorus.nr" being set to an odd number resulted in an extra output on the left side, I set it to 4 from default 3. The audio became centered! Then I switched back to 3, and audio went back to the left, then I switched it to 2... and audio stayed on the left side! After this I tested all "nr" settings from 1 to 20. Here is how they affected the audio balancing:
I've looked at the code, to see what's wrong, but I couldn't find anything wrong with it. So I cloned the repository and compiled the code myself to try to debug it. Neither debug nor release builds, that I've made however, were affected by the above issue! The only potential relevant difference between my builds and official ones, is that mine definitely don't use OpenMP. I don't know anything about the latter, so I cannot investigate further.
Expected behavior
There supposed to a stereophonic effect, where chorus output is moving from side to side. Prior to using my builds of FluidSynth I didn't even know what that sounded like.
Steps to reproduce
Play any MIDI track with at least some center panned channels, using official 2.3.5 x86 or x64 Windows builds. The chorus settings are defaults. The soundfont should have all of its programs use at lease 25% chorus. This can be achieved by selecting all presets in Polyphone editor, selecting a chorus row and typing 25, and saving the soundfont afterward.
The text was updated successfully, but these errors were encountered: