-
Notifications
You must be signed in to change notification settings - Fork 14
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
Unable to parse soundfont banks greater than 2 GB #43
Comments
Thanks 😊 I understand there is a demand for supporting large SoundFonts, but for the following reasons, I've decided not to support them in MeltySynth:
I hope for your understanding 🙏 |
Hi, https://github.com/aguerrieri82/meltysynth/ I added an abstraction layer for the samples buffer (instead of a |
Hi and congratulations on this amazing project!
I have encountered an issue when reading a packed SF file larger than 2GB. Upon inspecting the code, I noticed that the size is read as a signed Int32. This could lead to an overflow if the size is greater than 2^32 / 2 - 1.
Changing this line:
meltysynth/MeltySynth/src/SoundFontSampleData.cs
Line 33 in 60756cc
to
ReadUInt32
might resolve the overflow issue, but it results in a subsequent error soon after atMemoryMarshal.Cast
becauseSpan<TFrom>
has anint
length and cannot exceed 2,147,483,647 bytes.In any case, storing 2+ GB of wave samples in RAM as an array of
short[] Samples
might not be a wise choice IMHO :)My general advice would be to use a memory-mapped file. In short, this approach allows you to read a file as a contiguous area of virtual memory, dynamically swapped by the OS from disk to a physical page of RAM.
Here's a quick sample code for reference:
The text was updated successfully, but these errors were encountered: