-
Notifications
You must be signed in to change notification settings - Fork 263
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
Support Loading DLS Files #493
Conversation
This opens the door to other soundfont file formats by selecting at Cmake time the sfloader(s) need by the application. This is nice.
When fluid_synth_sfload() is called it uses all the |
Nearly: The |
I really like the fact that adding libinstpatch loader support to Fluidsynth seems to be fairly non-intrusive to the rest of the codebase. I know that it's not complete and still has issues (which probably means more intrusive changes), but still... I think it's a sign that Fluidsynth has quite a good architecture. What I'm not really sure about is if it's a good idea to add support for other sampler formats to Fluidsynth. If the foreign format is less expressive than Soundfont, it would be fine. Same if the foreign format is exactly like Soundfont, just with a different file structure. Where I have problems is adding support for sampler formats that are more expressive or that rely on features that are difficult to reproduce in the Soundfont model. Where loading the foreign file would mean that Fluidsynth would perform worse than a synth native to that format. We would have to be very clear about what users should expect when loading these files. Otherwise I'm afraid that we will get lots of "X can play this much better than Fluidsynth" bug reports. TLDR: I'm very fond of the fact that Fluidsynth is currently focussed on being an extremely good (if not the best) Soundfont synth. And I'm afraid that if we open up to other formats, we will loose some of that focus. PS: At least the linuxsampler code is a strange form of GPL, because the authors forbid the use for commercial projects (even if those projects comply with the GPL). Not sure if that also applies to the libgig code. |
To clarify my thoughts: my opinion is that adding loaders for advanced formats like GigaSampler would only make sense if we would also change and extend the synthesis model at the same time. In other words: if we were to move more into the direction of LinuxSampler and implement different synthesis engines for the different formats. Otherwise we would simply add code that would make Fluidsynth a bad GigaSampler synth. And there is already a very good GigaSampler synth out there: LinuxSampler. |
Sure, I understand this. I think that's a matter of documentation. We could claim smth. like limited or partial DLS support. Similar to like it's said in the sfont loader API:
We can keep this limited to DLS support for now, as this was the intention of #320. Citing ElementGreen, DLS and SF2 are very similar, except that DLS is "more" expressive because it supports 32 bit parameters, rather than 16 bit as SF2 does. The idea of GigaSampler only came up because libinstpatch supports them as well by loading DLS files and then recognizing those as GigaSampler files. But I can't tell anything about the relation between GigaSampler and DLS.
You're right. And I'm not intending to shift our focus. Fluidsynth should stay a SF2 synth. Supporting DLS just seems to be a nice idea as much/most/all (?) of DLS can be represented by the SoundFont synthesis model. And if there are any incorrect envelopes or attenuation calculations for DLS, keep in mind that there is limited / partial support. As next steps I suggest:
|
I agree, if DLS really is like "high-resolution Soundfont", then it seems like a very good fit and adding support is a good idea, especially as there is actual user demand for this feature.
To be honest, I had never even heard of DLS before reading the ticket. Maybe @frabert (the original reporter of the ticket) could supply some? Your proposed way forward sounds good. And going with libinstpatch instead of libgig feels better to me (regardless of code quality / maturity) as libgig looks to be a GigaSampler library first and foremost. And using such a lib when we can't completely support that format would send the wrong message, I think. Granted, a message that not many people will hear or understand... :-) |
Make use of libinstpatch to add sfloader seems a good choice. This should helps later to propose a virtual soundfont loader optional component (or at least documentation to do that). This kind of sfloader should simplify the integration of fluidsynth lib into soundfont editor application. Actually free soundfont SF2 editor aren't massive. Also there is few or none free SF2 editor integrating a full SF 2.0 synthesizer engine with modulators capabilities. Probably the reason is that data edition and synthesis are two jobs so different that coupling a synthesizer inside an SF editor is really a hard task for most SF editor developer. Thanks to this PR, libinstpath lib and author(s). |
@mawe42 Unfortunately I do not have any freely redistributable DLS file, but every Windows copy ships with c:\windows\system32\gm.dls, which is used for General MIDI patches by the system's softsynth. |
Meanwhile, I've tested a bunch of DLS files and they all play fine. Gig files are problematic though, because they currently cause lots of crashes in libinstpatch due to a nasty int to pointer cast. |
fixes a memory leak on every get preset call
As this seems to be a very popular feature, open TODOs right now:
|
by checking fluid_sample_t::refcount
Considering this ready for squashing. @mawe42, @carlo-bramini Any of you available for a review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good, thanks a lot! I haven't compiled or tested it yet, so this review is based on a quick read through the code. All very nice and clean, just a few minor nit-picky formatting, style and wording comments. Will have more time for testing next week, if required.
Thanks for the quick review Marcus! Hope I've addresses all issues. (I should have executed Will keep this open for another 3 or 4 days. Anybody, feel free to test or give feedback. |
This is a RFC PR that attempts to support DLS as requested in #320 (perhaps also GigaSampler and SLI). I intend to bring this feature to the mailing list when it's ready, but for now, see this as alpha test.
DLS support is brought by libinstpatch, as suggested by the "Future" wiki page. CMake queries for it during compilation. If found, it adds a libinstpatch sfloader to the synth (
fluid_instpatch.c
).fluid_instpatch.c
basically works, but could be improved:currently ignores(IMO, this is the responsibility of libinstpatch)synth.dynamic-sample-loading
allocates presets on-the-fly as needed, i.e. no preset poolI've so far only tested this with a few DLS files. I'm not familiar with GigaSampler or SLI. It would be great if someone could give it a test. Ofc. general feedback is appreciated as well.
Why using libinstpatch?
Pro:
Con:
Glib - CRITICAL ** assertions
on DLS loading)Any alternative to libinstpatch? Yes: libgig
Pro:
Con:
Both Cons are not too severe, but might restrain the number of users making use of it.