Skip to content
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

Drawbar and Detuned organ still one octave too low #526

Open
mkj42 opened this issue Jul 16, 2024 · 54 comments
Open

Drawbar and Detuned organ still one octave too low #526

mkj42 opened this issue Jul 16, 2024 · 54 comments
Labels
bug on hold Awaiting a corresponding fix upstream

Comments

@mkj42
Copy link

mkj42 commented Jul 16, 2024

I posted about this issue back in this post from 2021:
https://musescore.org/en/node/326427
and commented in this 2017 thread as well:
https://musescore.org/en/node/163756#comment-1104115

Harmonic analysis was performed.
Proof was given, complete with screen grabs and how to reproduce.

This is still the case with the newest version of the soundfont included with 4.3.
It should be an easy fix.
Replace -24 with -12 in the transposition for the Drawbar Organ instrument in the soundfont (note: instrument, not preset or sample). Then re-save. I could do this easily if granted access to MS Basic.sf2 so there would be no quality loss.

Though one could, one shouldn't simply change instruments.xml, because then MuseScore would be wrong for correctly pitched soundfonts.

I should note:
Workarounds are available.
You can either edit the soundfont yourself (and lose sf3 sizing) or transpose within MuseScore, but the optimist in me wants it to be correct out-of-the-box.

Thanks

@Jojo-Schmitz
Copy link
Owner

Jojo-Schmitz commented Jul 16, 2024

If it had been adressed in Mu4, you'd know or could check. Please do...

If it is an issue with the soundfonts, and I believe it is, then I won't be able to fix this, and it isn't really a MuseScore problem in the first place

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

I just checked.
In 4, Drawbar and Detuned 1 and 2 are still one octave too low.

To your second point, though it is technically a problem with the soundfont itself, couldn't it be fixed by simply altering the default transposition or in the insruments.xml?
I imagine other similar issues, like all the transposing instruments, have fixes embedded in the same way. The soundfont itself plays back transposing brass at concert pitch, and musescore does the work to make it print and work correctly.
It seems the organs would require the same thing, or am I wrong somehow?
If you just don't want to do it out of principle for keeping the software the same across versions, fine.
Thanks

@Jojo-Schmitz
Copy link
Owner

Jojo-Schmitz commented Jul 17, 2024

It might be worked around by tweaking instruments.xml, but if so, just changing the octave transpositionings in the (presumably pretty few) affected scores (containing Drawbar, Detuned 1 or 2) would too, wouldn't it?

Whatever: if/as the issue exists in Mu4 too, please report it there, at https://github.com/musescore/MuseScore/issues/new/choose

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

Agreed, workarounds work (see last sentence in first post).
It's just the principle of the thing is all.

Will report; thanks for the link.

@Jojo-Schmitz
Copy link
Owner

Yes, for now I'd rather keep this the same across versions. If and when it gets fixed in Mu4, I'll have another look.

@knoike
Copy link

knoike commented Jul 17, 2024

I have not confirmed this with my own ears yet, but I am interested in this issue.
Which of the following is the cause?

1/
FluidSynth (MuseScore3 internal synthesizer for sf2 and sf3)

2/
MuseScore3

3/
Drawbar and Detuned organ pitch in MuseScore_General.sf3

4/
Drawbar and Detuned organ pitch in all of GM SoundFonts

5/
Other

@Jojo-Schmitz
Copy link
Owner

@knoike
Copy link

knoike commented Jul 17, 2024

I'm sorry, I don't really trust Marc Sabatella's hearing, because it doesn't match the spectral analysis.
https://musescore.org/en/node/326427#comment-1104481

However, from the comments
https://musescore.org/en/node/326427#comment-1104362
and
https://musescore.org/en/node/326427#comment-1104369 ,
I found that the following was most likely the cause:

3/
Drawbar and Detuned organ pitch in MuseScore_General.sf3

Is it a fundamental solution to make a pitch-corrected MuseScore_General.sf3 under a different filename?

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

I have not confirmed this with my own ears yet, but I am interested in this issue. Which of the following is the cause?

1/ FluidSynth (MuseScore3 internal synthesizer for sf2 and sf3)

2/ MuseScore3

3/ Drawbar and Detuned organ pitch in MuseScore_General.sf3

4/ Drawbar and Detuned organ pitch in all of GM SoundFonts

5/ Other

3+
Drawbar and Detuned organ pitch in just MuseScore General and MS Basic soundfonts and I presume all derivatives.
Many others I have sampled have been pitched correctly.

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

Is it a fundamental solution to make a pitch-corrected MuseScore_General.sf3 under a different filename?

That is one option, but the individual would lose the sf3 size reduction.
Another solution would be to correct within the instruments.xml file.

@Jojo-Schmitz
Copy link
Owner

Which would make it fail with many other soundfonts

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

Which would make it fail with many other soundfonts

True.
Bummer.

@knoike
Copy link

knoike commented Jul 17, 2024

I see, thanks!
I understood it's a problem that occurs with a specific SoundFonts.

Polyphone SoundFont editor is able to read/write sf3 format file directly,
so it may be useful to modify sf3.
I think the file size will be almost the same.

https://www.polyphone.io/

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

Polyphone SoundFont editor is able to read/write sf3 format file directly, so it may be useful to modify sf3. I think the file size will be almost the same.

https://www.polyphone.io/

Yes, it absolutely would work and polyphone is what I would suggest.
I don't remember what the size difference would be exactly.

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

sf3 directly?
I missed that or I may need to check the newest version.

@Jojo-Schmitz Jojo-Schmitz added the on hold Awaiting a corresponding fix upstream label Jul 17, 2024
@Jojo-Schmitz
Copy link
Owner

monitoring musescore#23659

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

Polyphone SoundFont editor is able to read/write sf3 format file directly, so it may be useful to modify sf3. I think the file size will be almost the same.

https://www.polyphone.io/

I just refreshed my memory.
You don't want to edit and re-save sf3 as it's a lossy format to start with.
Polyphone can certainly open sf3, but it only saves as sf2; hence the file will be bigger and possibly one generation lossier.
Proceed at your own risk.

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

It seems a pity, because all it would take is changing the transposition of the Drawbar Organ instrument (note: instrument, not sample or preset) in the soundfont from -24 to -12.
The only trick is using original sources then saving it in sf3 to avoid quality loss.

Unrelated note:
I just noticed Drawbar Organ goes through progressively heavier filtering as the dynamics get quieter.
This is not how an organ behaves, folks.

@knoike
Copy link

knoike commented Jul 17, 2024

I don't know if Polyphone re-compresses when re-saving,
but you can save in sf3 format.

[Menu(Top-Right corner)] ->
[Export soundfont] ->
[Format] .sf3
([Quality] High)
press [Export] button.

Proceed at your own risk.

Yes! Thanks!

@knoike
Copy link

knoike commented Jul 17, 2024

The only trick is using original sources then saving it in sf3 to avoid quality loss.

I agree.
If you find original sources, please write it here.

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

I don't know if Polyphone re-compresses when re-saving, but you can save in sf3 format.

[Menu(Top-Right corner)] -> [Export soundfont] -> [Format] .sf3 ([Quality] High) press [Export] button.

Excellent, thank you.
I just noticed it was unavailable under 'save as'.
It pays to look around.

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

The only trick is using original sources then saving it in sf3 to avoid quality loss.

I agree. If you find original sources, please write it here.

Reading the old and new MuseScore_General_License.md and MS Basic_License.md,
it seems all the info is there.
Further research needed.

@Jojo-Schmitz
Copy link
Owner

Jojo-Schmitz commented Jul 17, 2024

I have the sf2 versions of MuseScore General and MuseScore General HQ, version 0.2.1, 210 MB and 478MB

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

Excellent
The only thing required then is piecing together what all has changed.
As I said, the transposition change would take three seconds.
...and then of course, will it get bundled if fixed?

@Jojo-Schmitz
Copy link
Owner

Not sure how to handle that

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

I am obviously being super-anal trying to keep all the sf2 sources.

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

I have General 0.2 and HQ 0.1.8

@mkj42
Copy link
Author

mkj42 commented Jul 17, 2024

Note: I updated 'additional context' section.

@mkj42
Copy link
Author

mkj42 commented Jul 18, 2024

Good news / no news / bad news

As I already have the correct General for 3.6.2 and Evo (0.2 2018), I could easily tweak the one needed parameter.
I would still need to find MS Basic.sf2 to proceed with that one.
Polyphone will not convert to an sf3 this large (limit 127 presets).
I have since gotten sf3convert to work on Linux Mint 21.

@Jojo-Schmitz
Copy link
Owner

Jojo-Schmitz commented Jul 18, 2024

As far as I can tell MS Basic is the same as MuseScore General HQ v0.2, or, as the Readme.md puts it: a scaled down version.
So just take MuseScore General HQ there too
MS Basic.sf3 has some 50MB, MuseScore General HQ v0.2.1.ssf3 some 83MB, MuseScore General v0.2.1.ssf3 some 39MB

@mkj42
Copy link
Author

mkj42 commented Jul 18, 2024

Sorry, you lost me there.
You mentioned three different sizes.
My goal would (should?) be starting with MS Basic.sf2, so that a corrected sf3 would be exactly the same size.
For 3.6.2 and Evo, I already have the sf2.

@mkj42
Copy link
Author

mkj42 commented Jul 18, 2024

Things seem to be going backwards here if I understand things (doubtful).
MS Basic 2194 samples
MS General HQ 1246 samples
What?
I thought it should be the opposite.

@Jojo-Schmitz
Copy link
Owner

Jojo-Schmitz commented Jul 18, 2024

I don't know where to find MS Basic sf2. But I see no point in not using the HQ font there?
OTOH that's be an issue to discuss at musescore#23659

@mkj42
Copy link
Author

mkj42 commented Jul 18, 2024

I thought I had solved it with Cognitone's sf2convert.
Though it completes. the resulting sf3 will not load in Polyphone and only makes noise in MuseScore.

@knoike
Copy link

knoike commented Jul 18, 2024

I could install sf3convert.
In the case of Debian12, it was possible to install it with 'sudo apt install sf3convert'.

I tried using it to do the conversion and it seems to work fine.

If you send me the sf2 file, I will convert it to an sf3 file and send to you.
It seems that sf3convert can specify 'ogg quality' and 'amplification in dB before ogg compression', so please specify them if necessary.
The default values seem to be 0.3 and -1.0 respectively.
https://github.com/musescore/sftools/blob/master/sfconvert.cpp#L63-L64

@mkj42
Copy link
Author

mkj42 commented Jul 18, 2024

Thanks for the offer.
The sf2 is 205MB by the way.
You could download it from https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General.sf2 and change Drawbar Organ Instrument transpose from -24 to -12 and be in the same place as me without needing to host the file somewhere. I do mean the same place; I haven't even added anything to the text or changed the version number. I don't know if this small a change warrants it.
Although...
Your mentioning of quality made me realize that though the sf3 would not play, I had generated it with maximum (identical?) quality. I want to give it another go,
I have no idea what settings might be used for amplification. It might take a couple passes and comparison to see how it's going unless someone from the soundfont generating camp chimes in.
So, again, thanks, but give me a bit if you don't mind.

@mkj42
Copy link
Author

mkj42 commented Jul 18, 2024

Semi-success!
Cognitone's sf2convert still failed even with reduced quality settings, but...
I have sf3convert running in Linux Mint 21 and at least the Drawbar Organ sounds correct in MuseScore.
FYI my first pass resulted in a 24 meg file, so some tweaking with the parameters is probably necessary.

@knoike
Copy link

knoike commented Jul 18, 2024

You could download it from https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General.sf2

Thanks! I downloaded it.
However, it seems version 0.2.
So, I searched for 0.2.1 sf2 and found it.
https://musescore.org/en/node/314547#comment-1097881

https://drive.google.com/file/d/1Y39F2YJIsZumGPry1ELJcbcmW2R-qZqG/view

It was described 'v0.2.1' in the sf2 file,
and MuseScore_General_Changelog.md contains information about v0.2.1.

The number of 'Samples', 'Instruments' and 'Presets' has also changed slightly.

v0.2.1:
1254 Samples
205 Instruments
311 Presets

v0.2:
1246 Samples
204 Instruments
309 Presets

@mkj42
Copy link
Author

mkj42 commented Jul 18, 2024

That's great! thanks!
though I assume 3.6.2 and Evo use 0.2(?)
I'm frankly a little tired and burned out to pursue; will resume later; I was happy with the success.
FYI I feel I got good results with 0 amplitude and 0.8 quality - sf3 size 39 meg.

@knoike
Copy link

knoike commented Jul 18, 2024

I was attempting something similar.
I was just tweaking the -q argment only.

215827444 MuseScore_General_0_2_1.sf2
39977493 MuseScore_General_0_2_1.sf3
39616406 MuseScore_General_0_2_1__sf2tosf3_q079.sf3
39939770 MuseScore_General_0_2_1__sf2tosf3_q0798.sf3
39980006 MuseScore_General_0_2_1__sf2tosf3_q0799.sf3

Left column is file size.
It does not match the target sf3 size exactly, but it's near value by '-q 0.798' and '-q 0.799'
I thought it would be easier to find out, but it seems it's not that simple.

@mkj42
Copy link
Author

mkj42 commented Jul 19, 2024

Checking 3.7 Evo it is in fact v0.2.sf3 included, 1246 204 309 38966KB
so that is the sf2 version I started from for 3.7 and 3.6.2.
Any matching sizes you get from 0_2_1 will be pure chance.

@mkj42
Copy link
Author

mkj42 commented Jul 19, 2024

@Jojo-Schmitz

Success, or as close as I think I can get.
Maybe there are other variables I'm not considering.

I now have an sf3 with correct Drawbar Organ instrument transposition based on MuseScore_General as included in 3.7 Evo.

Generated via sf2 with sf3convert, a 0, q 0.795
v0.2:
1246 Samples
204 Instruments
309 Presets
38970KB

Include or not, but the file is ready.
If you would prefer a different starting sf2, I am open to that as well.

@knoike
Copy link

knoike commented Jul 19, 2024

Any matching sizes you get from 0_2_1 will be pure chance.

https://drive.google.com/file/d/1Y39F2YJIsZumGPry1ELJcbcmW2R-qZqG/view

MuseScore_General_0.2.1.7z which can be downloaded from above URL,
contains not only sf2 but also sf3.
So I looked for a conversion parameter that would match the exact size.

@knoike
Copy link

knoike commented Jul 19, 2024

Success, or as close as I think I can get. Maybe there are other variables I'm not considering. sf3 of 38970KB achieved at a 0 q 0.795 in sf3convert

https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General.sf2

I also tried converting from v2.0 sf2.

39900972 MuseScore_General.sf3 (Included with MuseScore 3.6.2)
39757254 MuseScore_General_sf2tosf3_q0795.sf3
39877298 MuseScore_General_sf2tosf3_q0798.sf3
39897830 MuseScore_General_sf2tosf3_q07985.sf3
39899797 MuseScore_General_sf2tosf3_q079855.sf3
39901728 MuseScore_General_sf2tosf3_q07986.sf3

The value is very close, but it wasn't an exact match.
It seems I also need to specify the '-a nn' argument you suggested.

I'm tired too :-)

@mkj42
Copy link
Author

mkj42 commented Jul 19, 2024

5 decimal places (?!)
I think we're both getting carried away.
I am done for now, until actual hands-on soundfont folks care to comment.

@mkj42
Copy link
Author

mkj42 commented Jul 23, 2024

@Jojo-Schmitz
@mrbumpy409

Jojo, if you could please clarify something:
Should 3.7 Evo match 3.6.2, or continue to evolve?
I am sincerely hoping it's evolve, as you have already included 4 features and opening 4 files.
Heck, it's in the name :)

Now that Chris is involved, I am willing to step aside or be as much help as needed going forward,
including possibly implementing fixes based on 0.2.1 and 0.2.1HQ or further.

@Jojo-Schmitz
Copy link
Owner

It should evolve 😉

@mrbumpy409
Copy link

I will be in communication with MuseScore about how to proceed with development of "MS Basic". I'm thinking perhaps a separate GitHub page for the SoundFont, documentation, and issue tracking—with Google Drive links or "releases" for the source SoundFont downloads—might not be a bad idea.

@mrbumpy409
Copy link

@knoike: When converting the sf2 to sf3, I have been using:

sfconvert -z -q 0.8 -a -1 MuseScore_General.sf2 MuseScore_General.sf3

@mkj42
Copy link
Author

mkj42 commented Jul 23, 2024

@mrbumpy409
Could you clarify please?
I had read online that sf3convert was the preference for the MuseScore team and was what I used.
Please let us know if you find sfconvert better.
Also, did you try any other amplitude settings?
I went with a 0 with a (somewhat crude) level comparison in MuseScore itself.
It didn't seem any louder on the level meter, and I thought I maybe saw ever so mild a reduction at a -1.
I haven't heard any distortion yet.

@mrbumpy409
Copy link

mrbumpy409 commented Jul 23, 2024

Aah yes, "sfconvert" has since been renamed to "sf3convert" to avoid confusion with a different "sfconvert" tool. The amplitude reduction is to avoid clipping during the conversion to OGG. When converting to a lossy format, peaks will sometimes end up higher than they were in the original WAV audio. I had arrived at 1 dB attenuation as the ideal value through my testing.

@knoike
Copy link

knoike commented Jul 24, 2024

@mrbumpy409

sfconvert -z -q 0.8 -a -1 MuseScore_General.sf2 MuseScore_General.sf3

Thanks!
I tried converting again using those parameters.

215827444 MuseScore_General_0_2_1.sf2
39977493 MuseScore_General_0_2_1.sf3
39910838 MuseScore_General__sf2tosf3_q08_a-10.sf3

It wasn't an exact match, but it was very close.

#526 (comment)

The amplitude reduction is to avoid clipping during the conversion to OGG. When converting to a lossy format, peaks will sometimes end up higher than they were in the original WAV audio. I had arrived at 1 dB attenuation as the ideal value through my testing.

For this reason too, I will use the parameters "-q 0.8 -a -1" you shown from now on.
Thank you!

@Johan-v
Copy link

Johan-v commented Aug 1, 2024

Hello,
I tried something.
I downloaded MuseScore_General_HQ.sf2 (MuseScore_General_HQ_0.2.1.7z) 466MB
I renamed it to MS Basic.sf3
I replaced the original MS Basic.sf3 in MU4 with the renamed one above.
It seems to work.
Is this supposed to work or should I expect problems?
This is with windows 11
4.3.2-241630831, revision: github-musescore-musescore-22b46f2
Kind regards,
Johan

@mkj42
Copy link
Author

mkj42 commented Aug 1, 2024

I downloaded MuseScore_General_HQ.sf2 (MuseScore_General_HQ_0.2.1.7z) 466MB I renamed it to MS Basic.sf3 I replaced the original MS Basic.sf3 in MU4 with the renamed one above. It seems to work. Is this supposed to work or should I expect problems?

@Johan-v

This question might be better addressed in the 4.3 soundfont thread:
musescore#23659

MS Basic absolutely has more samples than any previous MSGeneral, so I would say results are not guaranteed at all...
though I did almost exactly what you did - loading in and renaming 3.7's non-HQ sf3 file.
Results have so far been fine(ish), though I expect unforseen surprises.
Who knows what they might be? A reply from someone directly involved would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug on hold Awaiting a corresponding fix upstream
Projects
None yet
Development

No branches or pull requests

5 participants