-
Notifications
You must be signed in to change notification settings - Fork 43
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
Soundfont2 (SF2) support #8
Comments
hi, i would love to have support for sf2! |
btw. unsf author pointed out features of sf2 not existing in gus format and proposed way to extend it. still, as i said, produced patches are already usable and sounding good |
If the unsf utility is LGPL then we might be able to use parts of it. The idea is to support sf2 in libwildmidi itself without having to dump first to disk then to playback. This means playing the patch natively from out the sf2 bank file, taking into account sf2's special features as well. We might do support on phases. |
http://alsa.opensrc.org/Unsf @chrisisonwildcode does this tickle your fancy ? ;) |
i think it's available freely. from the unsf.c:
* (The above mentioned file readme.txt has the following about copyright:)============ Copyright ============Allegro is gift-ware. It was created by a number of people working in |
It does on so many levels ... I will look into this after everything seems happy for 0.4 ... maybe sneaking it in under 0.4.1-0.4.2 Sent from my iPhone
|
@chrisisonwildcode yeah.. i thought it would, we should really have a project plan :) we should abuse the milestone feature more to plan out our releases. we have feature creep in our 0.4 release ;) |
looks innocently around the room Sent from my iPhone
|
You don't have to implement everything in -updates onto 0.4, It's why I have my own branch so you can worry about releases while I worry about features :) Sent from my iPhone
|
hahaha :) I think 0.4.2 is perfect for sf2 support. |
I stumbled across this recently: It contains information on sf2 support and is MIT licensed... wooo! |
Does that mean you don't want me to look at the sf2 -> gus converter you recently found? Personally when I overhaul the sample file handling there are going to be changes (and some slowdowns) that will make it easier to add more sample formats :) Sent from my iPhone
|
honestly... (and this is what I would like to see happen), native support for sf2... no conversions. |
but please don't drop gus format support because most systems have freepats package available |
@kotc: we never said that, where did you get this idea and why does this have to do with a sf2 thread? |
usually it's easier to just keep 1 format than multiple, one can also invent internal format that would suit all of them (which means some kind of conversion too) |
Creating temp files is out of the question. We'll not do that. Also think of the differences between patches and sf2 and other bank formats... converting to one or the other will lose a bit in translation. As for an internal format, that would require to either convert on the fly, which is additional CPU work, and/or explode memory use of WildMIDI to keep it cached. Bad ideas. The best, quality, solution is to support reading from different bank formats and/or falling back to a CPU bound synthesized FM output. |
by internal format i mean structures you have in memory to store samples and their parameters |
yes, i mentioned that... memory usage is at a premium, we'll not store patches in memory. |
but you have to load sample when you load midi (not all, but the ones used in the song) |
we do a copy, render it, flush it to output, then release. since libwildmidi runs on low end hardware from SiS for midi jukeboxes, this is ideal we do not store it in memory and keep it there. |
By the way, is there any way to convert soundfont to patchsets ?
Google for the 'unsf' tool
|
This has bubbled back up again, as a feature request for XLengine so that they can dump fluidsynth and use wildmidi for everything. This feature is apparently above (more urgent) than OPL emulation as there are many other SF2 files out there. |
I can look into it, it's going to take a little time as this time of year is busy for me supporting others through tough times. This means personal time is limited and cherished. Once I can grab a good sf2 and a good format spec I'll start nutting it out but no timeframe at this stage. Chris Sent from my iPhone
|
To quote: FluidSynth has a pretty decent one, which I think is a good quality baseline (FluidR3_GM.sf2). It's 143MB, so a bit on the large side, but it sounds pretty good with most things I've thrown at it (it's sanely licensed too, part of most/all Linux distros). I also have one called SGM which I think is a bit better, although it's notably larger at 236MB uncompressed: http://www.mediafire.com/download/zo8l3dgf2989266/SGM-V2.01.7z (I'm also not sure what it's license is, I just remember finding it in a youtube video). The main thing to take note of when adding sf2 support for WildMIDI, is properly implementing the modulators. IIRC, the GUS pat format that WildMIDI (and Timidity before it) are based on is that it doesn't really have a concept of modulators like sf2 has, but they can have a clear impact on the resulting sound. That's the reason why Timidity's sf2 support is considered rather poor, because it effectively just converts the sf2 to pat internally and uses it that way, ignoring all the extra bits that the pat format has no concept of but the sf2 is expecting. |
I'm going to look into this myself for 0.4.1 I will do the poor-man's route first then deal with modulators and other sf2 specific effects later. |
Keep in mind that either the resamplers were designed for guspat. Ideally coming up with a single internal format that can handle different sample types would be great, otherwise we need resamplers for each sample type, something I would like to avoid in the interest of size and performance. Sent from my iPhone
|
I'm far from knowledgeable about these things, so I'll be starting from ground zero. Is this something you are still interested, if there was time available? ;) Otherwise I'll focus my efforts in supporting additional formats as well as an 'off-line' hmp/hmi 2 mid function. |
Since we're not adding any additional formats at the moment, I'm looking at this again. I've been working with unsf, it is public domain and I've cleaned up the bit-rot and hosting it here under the CC0 license here: https://github.com/psi29a/unsf I'm currently in the process of creating a library and program split, removing globals and making things thread safe. Once this is finished, we can use this in WildMIDI to support SF2. The plan is to check the wildmidi.cfg file, if the first thing it reads is the file path to a soundfont then we have unsf create a configuration file for us and extract/convert the SF into a GUS Patch on the fly for use by WildMIDI. This plays on our strong point, which is guspat. We know that we don't honour all the features of GUS Patches, such as modulation (in another issue that is tracked), but with unsf there are extensions to the GUS Patches that we can use to improve the sound of the patches, including those converted from SF. Now, if someone else wants to add support for SoundFonts another way, they are free to do so and send a PR. :) I believe there is more than one way to skin this cat. |
I've spent a lot of time mulling over this as parts of the library will need rework to accommodate this. I would like to basically accommodate this in a way that allows easier adding of other sample formats. This would probably look like separate:
The main loop for events needs to be sample independent so probably the note data and pitch change events need to store a function pointer. This also needs to be robust enough handle multiple formats at once and to easily switch sample formats on the fly when a patch change occurs, so that playback of a midi is not restricted to one sample type. Thoughts... Sent from my iPhone
|
I would really want to see this happening as you describe. It would help when dealing with other formats as you said, with embedded samples (MMF and DLS). So please do, this will help in the long run. Is there anyway you can make a plan for work that can be split up and given out to people to work on? Or is this something you would like to do yourself? In the short term, my approach would allow us to help ship unsf along with wildmidi so that others can use it to to convert sf2 to guspat for use with wildmidi which is immediately useful. With a small bit of work, we can automate the process so that it is seamless to the end-user when they provide a sf2 file for use in wildmidi. I see both approaches dovetailing nicely together, no conflicts. What do you think? |
I see that working fine in the short term. Some people will be after a sf2->gus option. Out of random curiosity does unsf do the reverse, gus->sf? Give me a little time to mess around with the option I described as the main resampling loops will need to be reconfigured and I want to attempt to do it in a way that will be workable as we consider other formats. Sent from my iPhone
|
unsf at the moment just does sf2->gus, but the code can become two-directional with a bit of work. We could have unsf and sf2gus that both use the same library for example. So I see it useful to users of WildMIDI. No worries Chris, I know you have a lot on your plate but I believe your method is the best way to go forward for supporting multiple formats 'correctly'. I'm guessing this is something for after looping is taking care of? |
may i chime in? imo majority of soundbanks for midi (that are available to download) are in gus and sf2 formats, so i would like to see wildmidi able to support both (and as i've said at the top of the thread, currently i just use standalone unsf to convert sf2 to format known to wildmidi. on-the-fly loader for sf2 would be sweet). are there other significiant formats out there? |
cough_mod files_cough Sent from my iPhone
|
Not to demotivate anyone, but most mod files are handled by adplug/adplay anyway. |
Yesterday I finished up splitting up unsf into library and application parts. It isn't perfect, but it works and gdb is happy. Valgrind is finding the same errors as before, so at least we are status quo there. Next steps:
I thought about adding this as a sub-module, but past experience has shown that git submodule is more headache than not. |
Keep your up the good work. Sent from my iPhone
|
Thanks for your hardwork. https://forum.openmpt.org/index.php?topic=4703.msg43413#msg43413 |
As I posted earlier, unsf will remain CC0. The real/native sf library that chris is working on will be LGPL. It can be linked against other projects without a problem. |
Update: my unsf to library branch has been merged into master. It still needs a bit of work to clean up the interfaces to easier to use for a developer, but it works! I even found a potentially dangerous bug from the original code that was fixed. It was reading at least 2 bytes after a malloced area, this can lead to bad things of course. So in theory, we can begin with integrating it into WildMIDI. I'm thinking about grafting the two repos together, but that would of course require people to do dark magic with their repos. I don't want to lose the commit history. Another option is submodule. |
Remember that timidity++ has support for soundfonts in timidity.cfg. If wildmidi wants to continue supporting timidity.cfg format, it needs to replicate that for soundfont support too. |
Is it possible to use https://github.com/schellingb/TinySoundFont for providing SF2 support in WildMidi? |
That's pretty awesome, thanks for that. I'll see what is possible. |
how is the project going |
As much as I would like to work on this, my plate has been full lately. I hope that anyone else that is interested will throw up a PR. |
https://en.wikipedia.org/wiki/SoundFont
At the very least, we should be able to handle the config file that ships with timitity:
/etc/timidity/fluidr3_gm.cfg
The text was updated successfully, but these errors were encountered: