danigb / smplr

A web audio sampler instrument
https://danigb.github.io/smplr/
183 stars 19 forks source link

Musyng sf2 does not sound correct #93

Closed henrikvilhelmberglund closed 1 week ago

henrikvilhelmberglund commented 1 week ago

I wanted to use the looping in the Musyng soundfont so I took the original and split it by patch using Polyphone (so users don't have to download 1gb at the start), however it seems that some of the patches don't sound correctly. For example the clavinet patch jumps in pitch at every octave, the honkytonk piano patch sounds just very off and some other issues. I'm not sure what the cause is, either the soundfont itself, soundfont2 or smplr. It seems like the soundfonts worked in other players like the FlStudio soundfont player.

Could I ask for help in testing? My .sf2 files can be found here and are in GM order: https://github.com/henrikvilhelmberglund/keyboard/tree/main/static/sf2/musyng

danigb commented 1 week ago

Not sure what are you trying to do, but if you want to use Musyng I'd recommend to use Soundfont player directly (that loads only the required mp3 files)

BTW: I can't access the sf2 file to test. I'd need a public url (something like https://keyboard-gamma.vercel.app/sf2/musing/file.sf2)

danigb commented 1 week ago

Updated: added the ability to upload a custom sf2 from a public url in the Soundfont2 example

See: https://github.com/danigb/smplr/pull/94

henrikvilhelmberglund commented 1 week ago

I have my own code that uses the new soundfont2 player. I used the mp3 player before but looping is broken so I wanted to use the real soundfonts with actual loop points.

Thanks for the custom URL feature!

It seems like I get the same issue on the demo site, I'll see if another soundfont has the same issue but I suspect the soundfont itself is non standard.

Edit: moved files off of git lfs, will try with another soundfont and host somewhere else

henrikvilhelmberglund commented 1 week ago

It seems like soundfont2 doesn't use the "Root key" (not sample root key) value in an instrument which causes the notes to get offset. I'm not sure how to fix this so I think I'll just make a custom soundfont bank with sf2s I have confirmed work corectly.

An example for anyone interested is the Vibraphone instrument in Musyng which has an "F" sample on key 63 which is not offset correctly (and all notes to the right basically): image

Anyway it's possible to get around it so I'll close this.

henrikvilhelmberglund commented 1 week ago

I tested the file in https://github.com/spessasus/SpessaSynth and it worked perfectly in there, it seems like that library has a more complete sf2 (and sf3!) parsing implementation. Maybe this could work for smplr as well?

danigb commented 1 week ago

Hey, SpessaSynth looks awesome. Is there any reason not to use it instead of smplr? (genuine curiousity)

henrikvilhelmberglund commented 6 days ago

It seems pretty great indeed, I'm going to use both, SpessaSynth for soundfonts and smplr for the other sample based instruments.