FluidSynth plays Incorrect Pitch When Alternate Values Used for “Scale Tune”

• Nov 13, 2015 - 11:24
Type
Functional
Severity
S4 - Minor
Status
closed
Regression
No
Workaround
No
Project

Please see this discussion for details and also this Ticket at FluidSynth - http://sourceforge.net/p/fluidsynth/tickets/26/

Apparently the FluidSynth team fixed this in r205 - does our Fluid Source Code predate that? If so it needs updating.

As stated in the OP the workaround for anyone experiencing this problem is to set byOriginalPitch (Root Key in Viena & Polyphone) to 60


Comments

OK I've had a look at our FluidSynth code and it seems to be from a prior version to FluidSynth r205......

The killer lines are here........

https://github.com/musescore/MuseScore/blob/master/fluid/voice.cpp#L663

The same part of the code in FluidSynth's source is here.......

http://sourceforge.net/p/fluidsynth/code-git/ci/master/tree/fluidsynth/…

As you can see they are quite different.

To proceed we need to find out what else was changed in that commit.

Thanks for that ABL.

I'll be blunt - I don't understand this code so I'm not even going to attempt to implement the changes in MuseScore's version in case I break something else :)

Hi, the forum reference was to my rant which referred to the "percussion synthesizer" but I soon discovered that although the problem did occur with percussion, it was to do with scale tuning.

I have just found that the same problem had already been reported by Marc Sabbatella (https://musescore.org/en/node/52271)
"Somehow, though, this soundfont does not seem to work on my system. Well, it plays sound, but all notes come out the same pitch. A C scale just sounds like C C C C C C C C but each note getting progressively darker / more muffled in tone"
The cause was found by ChurchOrganist himself who worked around it in the same way as I did.
"OK, found it :) it seems Fluid responds to a Global Scale Tuning value of 0 by playing everything as middle C! Synthfont and Viena OTOH do not."
Thing is, there are not many fonts for melodic instruments that have a sample for each note, so the bug is less likely to occur for melodic instruments.

As I am not the only one to fall foul of this time waster, is possible somehow to warn anybody using their own soundfonts with Musescore not to use ScaleTune (in the manual section on setting up a soundfont, for example ?

Status (old) active needs info

Is there any way we can get this fixed soon?

It is causing serious problems with the integration of Marching Percussion instruments into the default soundfont.

Do we really need a customised version of FluidSynth?

Could we not just use the mainstream version?

Found a workaround - in order to prevent MuseScore's synth from applying pitch shifting you need to specify a Global Scale Tuning value (byOriginalPitch) of 0 and a Root Key value of 60.

Taken me a whole morning to finally figure this out!

Even so, there is something weird happening to the sample playback - the attack is way off compared to playback in Viena.

I tried to merge (some of) the changes of r205 into MuseScore FluidSynth.
See: https://github.com/musescore/MuseScore/pull/2433

In the given zip sample set, with the code of the PR the Snare60.sf2 and Snare40.sf2 now give the same sound.
However, the Snare0.sf2 gives a sound shifted towards lower frequencies. By playing with Polyphone and rootkey in the Sample section, I found that the sound is good until rootkey=15; for rootkey<=14 the sound is progressively shifted towards lower frequencies.

@ChurchOrganist: can you please try to test the PR? Unfortunately, I know very little of the synthesizer and of soundfont files, so I cannot judge if the PR introduced unwanted side effects.

About the rootkey=15 behavior: may it be linked to the fact that in fluid.h the function ct2hz is limiting between 1500 and 13500?

Here is a release build of MuseScore for Windows with the PR referenced in #11.
https://drive.google.com/open?id=0BxjayMZiuupOZ1hFUUpXMkxtcUE

The sound distortion for rootkey >= 14 is indeed given by the filter at 1500 and the distortion is most probably due to this line: https://github.com/AntonioBL/MuseScore/blob/fluidtuning/fluid/voice.cpp…
since the root_pitch_hz was limited inside ct2hz, but ct2hz_real does not introduce that bounding, if I understood correctly.
What is the expected behavior in this case?

I have created a .mscz + .sf2 test file that can be used to verify whether or not scale tune is working correctly (it isn't, currently). When scale tune is correctly implemented, all three pitches in the test file should play at the same pitch (F#3).

Attachment Size
Scale Tune Test 1.zip 16.44 KB
Reported version 2.1  
Regression No
Workaround No

I'm having a related issue to this thread over here: https://musescore.org/en/node/313543

tl;dr I've created a custom soundfont and can't assign it to two different note placements (above and below a line) with out the pitch changing from one two the other, despite Scale Tune = 0.

I've assigned my soundfont to s.chriscollins's test file and the notes don't sound the same like they should, but the test file with the test sf2 works correctly. Hopefully it is a silly error on my part but I'm new to this and can't figure it out.

If anyone on this thread has time to take a look at my help request above for more details, I'd appreciate it so much!

In reply to by Jojo-Schmitz

Yeah, I know it's not actually the same, but it behaves the same...and after many hours of working this and digging through the forums, I hoped that someone who worked on this issue in the past might point me to additional resources or ideas (things that didn't work when the issue was actually in fluidsynth) to make a sample in a soundfont play as it is without any pitch correction regardless of the percussion "key" it is assigned to (scale tuning is set to zero and the sample is still being tuned). Thanks so much!