Thanks for taking the time to fix this! I’m looking forward to trying it out, but unfortunately GitHub won’t let me download the new version you’ve compiled (it complains about an Access Denied error).
I didn’t expect really to have any issues on the machine I’m using as it’s Windows 7 32-bit, but then if they’ve been updating the libraries on you that’s bound to break something!
Hmm, I was also getting Access Denied. I’ve deleted and uploaded the archive again and confirmed the new download works. So, please retry. Sorry for inconvenience.
Thanks atsushieno! I’ve been trying the program out with a number of different soundfonts, and for the most part things seem to be going well - it’s certainly a lot quicker than converting the soundfonts manually!
I’ve come across a couple of instances where some errors have popped up. The first one is:
Unhandled Exception: System.ArgumentOutOfRangeException: startIndex cannot be la
rger than length of string.
Parameter name: startIndex
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length,
Boolean fAlwaysCopy)
at NRenoiseTools.Instrument.Save(Stream xrniOutputStream)
at Commons.Music.Sf2Xrni.Sf2XrniStreamingConverter.OnXrniCreated(Instrument x
rni)
at Commons.Music.Sf2Xrni.Sf2Xrni.Import(String file, String filter)
at Commons.Music.Sf2Xrni.Driver.Main(String[] args)
and the second is:
Unhandled Exception: System.IO.EndOfStreamException: Unable to read beyond the e
nd of the stream.
at System.IO.__Error.EndOfFile()
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadUInt32()
at NAudio.SoundFont.SampleHeaderBuilder.Read(BinaryReader br)
at NAudio.SoundFont.RiffChunk.GetDataAsStructureArray(StructureBuilder s)
at NAudio.SoundFont.PresetsChunk..ctor(RiffChunk chunk)
at NAudio.SoundFont.SoundFont..ctor(String fileName)
at Commons.Music.Sf2Xrni.Sf2Xrni.Import(String file, String filter)
at Commons.Music.Sf2Xrni.Driver.Main(String[] args)
There is a third one I’ve experienced where sf2xrni will close whilst processing a soundfont, and that’s where illegal characters are used in the instrument/patch name (e.g. </|>) that can’t be translated into a filename. Could you add an exception handler in the program to replace those with an acceptable character such as an underscore ( _ )?
For those files, can you give me more infos, namely which soundfont did you try? Either posting here or emailing atsushieno@veritas-vos-liberabit.com would be great. They may be either bugs in sf2xrni tool, NRenoiseTool library (sf2xrni dependency) or NAudio library (this too).
Ah, didn’t notice that possibility. I’ve fixed this issue and pushed new download on github.
Ok, so for those of you who’ve been watching this thread, atsushieno has resolved a lot of the issues I was having problems with
Now the program runs, the next problem is getting Renoise to load in the XRNI files that sf2xrni has converted. At the moment I get an error in Renoise, saying:
I guess that sf2xrni will need to call a sample convertor (e.g. ffmpeg) to put the samples into the correct format. I haven’t searched, but is there a quick way to extract the samples from an XRNI file to see what format they’ve been saved in?
No worries - thanks for the update! I can confirm that the samples work in Renoise too.
One question that I thought of is that with the new Renoise Instrument format allowing for instruments with multiple layers per key, does this tool take that into account? For example, the jRhodes soundfont that I referred to earlier should have multiple velocity layers (I downloaded the 5 layered, unlooped version from learjeff.net), but so far the instrument loads into Renoise like this:
Oh, indeed. Actually I wanted this kind of usecase when I was hacking this tool for the first time, and this time I filled the missing parts that supports it. I have uploaded a new archive that contains this fix. Thanks again for the reproducible test
So here is what I get so far - using the jRhodes3 soundfont again as our test case, loading the soundfont into the sfzed soundfont editor we can see the five velocity layers for each key:
Today I dug in depth to my source, NRenoiseToools and NAudio, and found that this velocity-aware samples are available only after 2.7 - correct? NRenoiseTools supports only before 2.5 formats so it does not cover things like ‘SampleSplitMap’ element (which contains ‘VelocityStart’ and ‘VelocityEnd’ elements).
I’ll revisit sd2xrni source when NRenoiseTools supports 2.7-or-later format.
From what I’ve read from the release notes, you’re correct in that XRNI only started to use multiple velocity layers in 2.7. I guess you’ve got as far as you can with the tools you have for now! Fingers crossed the NRenoiseTools libraries are updated soon!
I have reported the enhancement issue to NRenoiseTools dev. and he came up with 2.7 support (only in devel repository yet) so I tried to implement SampleSplitMap support. But I cannot get it; I believe it’s almost done but Renoise only loads the first sample into an entire sample area… Since there is no public documentation on how I can correctly create SampleSplitMap elements, I find it almost impossible to do it
Have you had any responses to your request Atsushi? Not really being a programmer (for now) I can’t help that much on the development side
A couple of the converted instruments I’ve worked on recently have loop points that are incorrect, although I know that looping in soundfonts can often be a bit ‘questionable’! Most of those I’ve found tend to put a loop right at the end of the sample, on an extremely small section of that sample. It’s not much of a problem though, as we should tweak the xrni file afterwards anyway
Oops, I once asked NRenoiseTools man but I already got a response and code, and I haven’t asked any question to anyone so far. It’s just left for some time I want to revisit with some new ideas, and I’ve been doing nothing as I’m now traveling around.
Oh you can still send me or post new issues, I’ll then try to find fixage
I’ve downloaded and installed Mono 2.10.6.
I open Mono Command Prompt, browse to the sf2xrni’s location, try to run it, but nothing happens. What to do?
Hi, thanks for trying out this toy
The tool should be more kind for you; it just does nothing probably because you passed no sf2 file name as arguments.
Try passing some files and see if it works.
On Windows, you can run the sf2xrni.exe just like other .NET program (or it is still possible to run it with mono on windows). In either way, make sure to give executable permission on the file in its property page. It probably solves the issue.
Thanks for starting the work on this tool and making it open source. I was able to compile it on Ubuntu with a few tweaks and get it running. I dug deeper into this SampleSplitMap issue and found out that the generated maps were quite correct but renoise didn’t recognize them. The problem was with the XML file NRenoiseTools was generating. The root element had to have the attribute doc_version=“13” for it to work. I downloaded the NRenoiseTools sources and modified the XML serialization a bit and the SampleSplitMaps work now! /> I wonder if I should share the changes with NRenoiseTools folks. I can send you the updated NRenoiseTools.dll if you want to.
That’s awesome, thanks for letting us know. Yeah I believe it’s worthy reporting the issue to the NRenoiseTools developers at codeplex, maybe you can even give them your changes