Wrong sound pitches with sample rate 48kHz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong sound pitches with sample rate 48kHz

Reinhold Hoffmann

Hi,

 

After moving from fluidsynth 2.0.5 to fluidsynth 2.1.0 we encountered a major issue with sample rate 48kHz. The sounds do not meet the required pitches.

 

Example: When using the sample rate 48kHz a note-on event with note A (440 Hz) sounds as note Bb (~ 466 Hz). Using the sample rate 44.1kHz in the same environment gives the correct pitches. The issue exists for every used soundfont file and for the two drivers which we use (DSound, ASIO through portaudio). With fluidsynth 2.0.5 all is ok. Therefore I conclude that the issue came in between 2.0.5 and 2.1.0.

 

The fluidsynth x64 libraries are built with Windows Visual Studio. The officially available binary Windows libraries (fluidsynth-2.1.0-win64.zip) from https://github.com/FluidSynth/fluidsynth/releases/tag/v2.1.0 show the same problem.

 

I have attached a simple MIDI file with a note-on event of note A. May be somebody can check the issue when using a sample rate of 48kHz.

 

Help and/or advices are highly appreciated.

 

Thanks

 

Regards,

 

Reinhold

 


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Note-A.MID (186 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Wrong sound pitches with sample rate 48kHz

Ceresa Jean-Jacques

Hello Reinhold,

 


>Example: When using the sample rate 48kHz a note-on event with note A (440 Hz) sounds as note Bb (~ 466 Hz).

 

I just verified using  v2.1.1 (master branch) (I guess it behaves like v2.1.0 for this issue).

Playing a note A4  at sr 48000Hz (or 96000Hz) gives the same pitch that with 44100Hz.

The test has be done by hear (using dsound) with GUGSv1_47.sf2 (from Christian Collins) preset 0 piano.

 

Suggestion: Have you the possibility to do the test using different audio card (keeping the same host driver) ?

 

Regards

jjc

 

 

 

 

> Message du 15/04/20 08:51
> De : "Reinhold Hoffmann" <[hidden email]>
> A : [hidden email]
> Copie à :
> Objet : [fluid-dev] Wrong sound pitches with sample rate 48kHz
>
>

Hi,

 

After moving from fluidsynth 2.0.5 to fluidsynth 2.1.0 we encountered a major issue with sample rate 48kHz. The sounds do not meet the required pitches.

 

Example: When using the sample rate 48kHz a note-on event with note A (440 Hz) sounds as note Bb (~ 466 Hz). Using the sample rate 44.1kHz in the same environment gives the correct pitches. The issue exists for every used soundfont file and for the two drivers which we use (DSound, ASIO through portaudio). With fluidsynth 2.0.5 all is ok. Therefore I conclude that the issue came in between 2.0.5 and 2.1.0.

 

The fluidsynth x64 libraries are built with Windows Visual Studio. The officially available binary Windows libraries (fluidsynth-2.1.0-win64.zip) from https://github.com/FluidSynth/fluidsynth/releases/tag/v2.1.0 show the same problem.

 

I have attached a simple MIDI file with a note-on event of note A. May be somebody can check the issue when using a sample rate of 48kHz.

 

Help and/or advices are highly appreciated.

 

Thanks

 

Regards,

 

Reinhold

 




_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

>
> [ Note-A.MID (0.2 Ko) ]

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Wrong sound pitches with sample rate 48kHz

fluid-dev mailing list
I cannot reproduce the issue either. Tested locally on Linux as well as the 2.1.0 release windows binaries. Everything plays at the correct pitch.

The only related change between 2.0.5 and 2.1.0 I see is that our lookup tables have changed. If your build of 2.1.0 is "polluted" it may use the old lookup tables. You can easily verify that by building and executing the unit tests of 2.1.0 . This is the "check" project in the auto generated CMake VS solution. Or via commandline:

cmake --build fluidsynth_build_dir/ --target check

If the test_ct2hz test fails, you should restart cleanly from scratch again. Don't trust the VS "Rebuild all" button.

Tom



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Wrong sound pitches with sample rate 48kHz

Reinhold Hoffmann
Hi Tom, hi Jean-Jacques,

Thanks for the immediate response.

I tested the binary fluidsynth 2.1.1 on Ubuntu 20.04 LTS and a fresh built
setup of 2.1.0 on Windows x64 with Visual Studio. Both setups provide the
correct pitches and are fine with the sample rate of 48kHz.

The issue only happens with our apps.

Thanks for your advices. It is now on us to investigate the issue further.

Again, thanks for your advices, hints and help.

Best regards,

Reinhold
 

-----Ursprüngliche Nachricht-----
Von: fluid-dev [mailto:fluid-dev-bounces+reinhold=[hidden email]]
Im Auftrag von Tom M. via fluid-dev
Gesendet: Donnerstag, 16. April 2020 10:27
An: FluidSynth mailing list
Cc: Tom M.
Betreff: Re: [fluid-dev] Wrong sound pitches with sample rate 48kHz

I cannot reproduce the issue either. Tested locally on Linux as well as the
2.1.0 release windows binaries. Everything plays at the correct pitch.

The only related change between 2.0.5 and 2.1.0 I see is that our lookup
tables have changed. If your build of 2.1.0 is "polluted" it may use the old
lookup tables. You can easily verify that by building and executing the unit
tests of 2.1.0 . This is the "check" project in the auto generated CMake VS
solution. Or via commandline:

cmake --build fluidsynth_build_dir/ --target check

If the test_ct2hz test fails, you should restart cleanly from scratch again.
Don't trust the VS "Rebuild all" button.

Tom



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Wrong sound pitches with sample rate 48kHz

Reinhold Hoffmann
With the help of Tom we were able to resolve the issue. Tom, many thanks.

Because other user may face a similar behaviour that the pitches of songs
are shifted when using a sample rate of 48kHz I would like to share the fix
here.

From fluidsynth 2.1.0 onwards the setting of synth.sample-rate is no
real-time setting anymore. See http://www.fluidsynth.org/api/
A setting of the sample rate needs to be done BEFORE the synth is created.
E.g. like that

fluid_settings_setnum(settings, "synth.sample-rate", 48000.0);
synth = new_fluid_synth(settings);

From the past we had it vice versa which resulted that the played songs were
shifted by a half tone.

I hope that this information helps others who face a similar issue.

Reinhold

-----Ursprüngliche Nachricht-----
Von: fluid-dev [mailto:fluid-dev-bounces+reinhold=[hidden email]]
Im Auftrag von Reinhold Hoffmann
Gesendet: Donnerstag, 16. April 2020 10:48
An: 'FluidSynth mailing list'
Betreff: Re: [fluid-dev] Wrong sound pitches with sample rate 48kHz

Hi Tom, hi Jean-Jacques,

Thanks for the immediate response.

I tested the binary fluidsynth 2.1.1 on Ubuntu 20.04 LTS and a fresh built
setup of 2.1.0 on Windows x64 with Visual Studio. Both setups provide the
correct pitches and are fine with the sample rate of 48kHz.

The issue only happens with our apps.

Thanks for your advices. It is now on us to investigate the issue further.

Again, thanks for your advices, hints and help.

Best regards,

Reinhold
 

-----Ursprüngliche Nachricht-----
Von: fluid-dev [mailto:fluid-dev-bounces+reinhold=[hidden email]]
Im Auftrag von Tom M. via fluid-dev
Gesendet: Donnerstag, 16. April 2020 10:27
An: FluidSynth mailing list
Cc: Tom M.
Betreff: Re: [fluid-dev] Wrong sound pitches with sample rate 48kHz

I cannot reproduce the issue either. Tested locally on Linux as well as the
2.1.0 release windows binaries. Everything plays at the correct pitch.

The only related change between 2.0.5 and 2.1.0 I see is that our lookup
tables have changed. If your build of 2.1.0 is "polluted" it may use the old
lookup tables. You can easily verify that by building and executing the unit
tests of 2.1.0 . This is the "check" project in the auto generated CMake VS
solution. Or via commandline:

cmake --build fluidsynth_build_dir/ --target check

If the test_ct2hz test fails, you should restart cleanly from scratch again.
Don't trust the VS "Rebuild all" button.

Tom



_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev


_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev