musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.21k stars 2.64k forks source link

[MU4 Issue] MS Basic and SoundFonts are playing largely out of tune, while Muse Sounds and most VSTs are fine (using 192kHz sample rate output) #15615

Closed MineCake147E closed 1 year ago

MineCake147E commented 1 year ago

Describe the bug The frequency of the A4 should be exactly 440Hz, but the MS Basic produces the same sound at 1915Hz, about 4.35 times higher. The pitch differences between SoundFont and Muse Sound are consistent among the different SoundFonts, including MS Basic.
The number 4.35 is close to 192000/44100, where 192000 is the output sampling frequency.

To Reproduce Steps to reproduce the behavior:

  1. Get some device that runs MuseScore 4 and has an 192kHz output.
  2. Set sampling frequency of output device to 192kHz.
  3. Launch MuseScore 4.
  4. Create an empty score with piano part.
  5. Play the A4 note with Grand Piano from Muse Sound.
  6. Play the A4 note with MS Basic.
  7. You'll see the pitch difference of these two.

Expected behavior Piano from MS Basic plays A4 at 440Hz.

Screenshots

Image of MuseScore 4 ![image](https://user-images.githubusercontent.com/31585494/209610617-935c0f1f-d276-4cf8-9b4a-8dcba551805f.png)
Spectrum analysis of A4 note played with Piano from MS Basic, in Audacity ![image](https://user-images.githubusercontent.com/31585494/209610713-78db18df-5a3f-49db-b8e0-17a2b1c27187.png)

Platform information

EDIT: It also reproduced in my new PC.

cbjeukendrup commented 1 year ago

It looks like FluidSynth, our SoundFont synthesiser, doesn't support sample rates above 96 kHz...

cbjeukendrup commented 1 year ago

@MineCake147E I've created an experimental solution: https://github.com/musescore/MuseScore/pull/16018

Would be great if you could try out the test builds for this version (they're ready in 30 minutes). See https://github.com/musescore/MuseScore/wiki/Downloading-and-running-test-builds#Downloading-Builds-from-Pull-Requests for how to download these builds.

MineCake147E commented 1 year ago

@cbjeukendrup Thank you! It works for 192kHz!
However, when I changed the output device and set the sample rate of that device (not including the other devices) to 384 kHz, it played at twice the tempo and an octave higher pitch.
When I reduced the sample rate of the output device to 96 kHz, it played at half the tempo and an octave lower pitch. In these cases, all instruments tested are affected, including Muse Sounds and some VSTs (including Dexed).
The VST plugin sforzando is showing the host rendering sample rate as being set to 192kHz in both cases, even though I have changed the sample rate of the output device to 384kHz or 96kHz. In contrast, when it is hosted in Cakewalk, it correctly shows the host rendering sample rate.
Restarting the test build of MU4 doesn't solve anything about it.
There are certainly some problems with the rendering sample rate.

DmitryArefiev commented 1 year ago

@MineCake147E Can you check the last build from #16018 please? Does it solve the initial bug?

I just don't have an audio device that supports 192kHz to check

Thanks!

MineCake147E commented 1 year ago

It looks good to me with 192kHz.

DmitryArefiev commented 1 year ago

Thanks for checking!

DmitryArefiev commented 1 year ago

@MineCake147E Can you check also 384kHz please?

MineCake147E commented 1 year ago

It also looks good to me with 384kHz. Changing sample rate requires restarting MU4 to take effect, though.

DmitryArefiev commented 1 year ago

Good. Thanks!

DmitryArefiev commented 1 year ago

@MineCake147E Can you do one last thing please? Try the score from #19241. Does reverb work fine during playback on 192/384kHz?

MineCake147E commented 1 year ago

@DmitryArefiev I'm afraid that I couldn't find any .mscz files in https://github.com/musescore/MuseScore/pull/19241.

DmitryArefiev commented 1 year ago

@MineCake147E Oh, sorry! My bad.. I meant #19242 , or just try this EXPORT.BASIC_AUX.REVERB.zip

Check only playback please, and you can take last nightly build https://github.com/musescore/MuseScore/actions/runs/6079712667

MineCake147E commented 1 year ago

I think it's fine for both sampling frequency.

I recorded a playback for both 192kHz and 384kHz in Audacity:

192kHz

image image EXPORT BASIC_AUX REVERB.zip

384kHz

image image EXPORT BASIC_AUX REVERB_384kHz.zip

DmitryArefiev commented 1 year ago

Yeah, I see it's fine. Thank you for testing!