vgmtrans icon indicating copy to clipboard operation
vgmtrans copied to clipboard

Collections tab empty - Prevents exporting VAB to SF2

Open Meerkov opened this issue 3 years ago • 11 comments

Describe the bug You can't export the Instrument Sets because VGMSampColls are never associated with the VAB. There doesn't seem to be any way to associate them.

To Reproduce

3Xtreme (USA).zip

  1. Load FATHEAD.SND from the attached zip into VGMTrans.
  2. Notice there are 2 VAB and a VGMSampColl that successfully parse into the Detected Music Files tab.
  3. Notice that the "Collections" Tab is empty.
  4. Set a breakpoint in VGMInstrSet.cpp line 129:
bool VGMInstrSet::SaveAsSF2(const std::wstring &filepath) {
  SF2File *sf2file = NULL;

  if (assocColls.size()) 
    sf2file = assocColls.front()->CreateSF2File();
  else
    return false; // BREAKPOINT HERE 
  1. Right click one of the VABs and try to export it as a .SF2 file
  2. Notice that the breakpoint gets hit.
  3. Check assocColls.size(), and notice that it's empty. The exporter never gets farther than this step.

Expected behavior There needs to be a way to associate Colls in order to successfully export .sf2 files.

Meerkov avatar Jan 25 '22 23:01 Meerkov

You can hack in a fix for this by changing line 274 of Matcher.cpp

  if (instrsets.size() == 1 && sampcolls.size() == 1) {

Change it to

  if (instrsets.size() >= 1 && sampcolls.size() == 1) {

This results in assigning the front() instrument set. In the example file above, there are 2 instrument sets, and therefore you can't get any result at all. This hack at least allows exporting and playing the files.

I'm not sure what the correct fix is, however. Presumably the information necessary to create a match exists and is being ignored.

Meerkov avatar Jan 26 '22 00:01 Meerkov

There doesn't seem to be any way to associate them.

With recent builds there's an option to create collections manually, it should help in situations like this. Then again, if the instrument set has no sample collection linked, it's plausible that the program couldn't find any and the sample collection you're seeing is a false positive.

sykhro avatar Jan 26 '22 08:01 sykhro

The sample collection is legit. The audio file produced by using the above hack results in a near perfect match to the audio available on youtube (the reverb and volume might not be perfect, but I'm assuming that's limitations of the midi format).

Meerkov avatar Jan 26 '22 15:01 Meerkov

Do you get different results from "Create collection manually"? (the feature is only present in Qt builds)

sykhro avatar Jan 26 '22 16:01 sykhro

Do you get different results from "Create collection manually"? (the feature is only present in Qt builds)

I'm currently building the WTL build, I think. I don't have any option to create manually (Though I imagine, if you were to manually connect the same objects, that you'd get a working result?).

The issue is, from what I can tell, that the Matcher class only will connect objects if there is exactly 1 of each object. However, for export purposes, the only thing that actually matters is that there is only one SampleColl (it doesn't matter how many VABs there are when exporting because the singular VAB is implicit in the export command).

Meerkov avatar Jan 26 '22 18:01 Meerkov

I'm currently building the WTL build, I think.

We don't plan adding new features to WTL. It will be dropped after the next stable release, actually. Try with the latest qt build here.

As far as Matcher goes, there's many different versions implementing different heuristics according to the format, I'm not sure what's going on in this particular instance as I'm not familiar with the PS part of the codebase

sykhro avatar Jan 26 '22 19:01 sykhro

(also note that Qt uses SF2 and not DLS for playback, this might result in playback being a bit different)

sykhro avatar Jan 26 '22 19:01 sykhro

Ok I just checked: Manually creating a user-defined collection using the QT version does allow export.

Basically a VAB that doesn't belong to any collection can't be exported.

Meerkov avatar Jan 26 '22 22:01 Meerkov

I added a log because it's too bad when an operation fails without a reason being given. I think the response should be more user-noticeable, but it's better than nothing.

I think the experience would be better if we could export DLS/SF2 without having to manually create the collection, but that may be difficult without changing the current sequence-first design.

loveemu avatar Jan 28 '22 16:01 loveemu

When we have VGMInstrSet and VGMSampColl selected and the right-click menu open, it would probably be useful to be able to export DLS/SF2 without having to manually create a collection, or to create a collection with a single click.

loveemu avatar Jan 28 '22 16:01 loveemu

When we have VGMInstrSet and VGMSampColl selected and the right-click menu open, it would probably be useful to be able to export DLS/SF2 without having to manually create a collection, or to create a collection with a single click.

It will take a big of ugly dynamic casting but it's definitely doable

sykhro avatar Jan 28 '22 17:01 sykhro