-
Notifications
You must be signed in to change notification settings - Fork 49
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
[ENCHANCEMENT] Rework SF3 Logic To Preserve Compressed Samples #204
Comments
I will delay a bit the work on the sf2 / sf3 parser since I need more time to do and test it:
When clicking on a sample in the tree, I'll also add a checkbox (which will be also a warning) so that we can decide if we want the compressed or raw version of the waveform. |
Hi Davy, I have a slightly different idea on handling the samples. Instead of a modified attribute, I think a sample would have a When I open a sample in Polyphone, it could show at the bottom "sample type: compressed" or something like that. It would not decompress the sample. Editing behavior
Once the user clicks yes, the compressed flag is set to false and the compressed array gets deleted, leaving only the uncompressed array. When saving the soundfont, simply check for the compressed boolean. If true, copy the compressed data (and adjust the sample index and loop points) and add the compressed flag to sampleType. If the boolean is false, copy the uncompressed data and save as an usual sf2 sample (and always zero the 4th bit of sampleType because the sample might've been compressed) I've implemented this logic in my soundfont code This function returns the "raw data" which gets directly copied into the file. As you can see, it copies the compressed data if the sample is compressed and uncompressed data otherwise. Let me know what you think about my version and thanks for considering this feature! |
The Issue
SF3 uses Ogg Vorbis compression, which is lossy. This poses a problem because loading an SF3 into Polyphone and saving it again decompresses and then recompresses the samples, leading to a loss in quality.
The Solution
I propose that Polyphone should preserve compressed samples instead of decompressing them. With issue #201 now fixed, here’s how the logic could be adjusted:
Loading an .sf3 Soundfont
Exporting an .sf3 Soundfont
When Exporting .sf3
When Exporting .sf2
ifil
to 2 and adjustsampleType
to remove the compression flag.This approach avoids unnecessary decompression and recompression, thus preserving sample quality.
Let me know what you think!
The text was updated successfully, but these errors were encountered: