Bank/preset loading error

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!

Pages

Posts: 129
Joined: September 25, 2013 - 16:38
Bank/preset loading error

Hi,

Here's the bug report I promised in the volume settings thread :)

If you want to preload a soundfont that is set in the configuration dialog to use a bank number (offset) and all presets (-1),

but the given bank does not exists in the soundfont you get an error:

'Error while preloading soundfont .

Error:37

Description: BASS_ERROR_NOTAVAIL: The soundfont does not contain the requested preset.'

This error does not make much sense. This must be a bank/preset misconfiguration.

Reason: If you select -1 for Preset value (all presets) the preset+bank numbers do not designate a precise instrument but an offeset where to load all instruments from the soundfont. So the given bank does not have to exist in the soundfont to use a bank number as an offset.

Quote from the bassmidi documentation:

'When using all presets in a soundfont, the bank member is a base number that is added to the soundfont's banks. For example, if bank=1 then the soundfont's bank 0 becomes bank 1, etc. Negative base numbers are allowed.'

Ps: I think the root of the problem can be that in case of

BASS_MIDI_FontLoad(HSOUNDFONT handle, int preset, int bank)

you pass the preset and bank parameters just like it was given in the configutration dialog. This obviously does not work since the given preset+bank combination really does not exists. Instead you should call

BASS_MIDI_FontLoad() with both preset and bank set to -1. This way the whole soundfont can be loaded the same way as when you do not specify a bank offset.

Bassmidi documentation:

Parameters

handle: The soundfont handle.

preset: Preset number to load... -1 = all presets.

bank: Bank number to load... -1 = all banks.

Thanks.

Zoltán Bacskó

Falcosoft

Posts: 50
Joined: January 24, 2015 - 01:26
Re: Bank/preset loading error

Greetings @falcosoft!

I've encountered the error that you've described. In my case, certain wave was causing the error and did not load. Reconverting this Wave sample file to FLAC and back to Wave in Audacity 2.1.0 fixed the error.

EDIT: It didn't. BASS driver somehow skips the error message and fails to load any samples from SF2 instead.

Posts: 50
Joined: January 24, 2015 - 01:26
Re: Bank/preset loading error

Greetings again @falcosoft!

I've found a workaround for the problem. If you add any patch in bank 0, the file will load without any problems.

Posts: 129
Joined: September 25, 2013 - 16:38
Re: Bank/preset loading error

Hi,

Thanks, but I don't think we have exactly the same problem. I actually always have patches at bank: 0. Let me describe my problematic situation with a simple example:

Let's suppose I have a 2 soundfonts. The 1st is a full GM soundfont with 128 patches at bank: 0. The 2nd has only 1 patch that is located at bank: 0 preset: 0 (e.g. an alternative piano).

Let's suppose I want these 2 soundfont to be stacked so that the 1st provides the 128 GM instruments at bank:0 and the 2nd soundfont's instrument to be available/played at bank: 1 program: 0.

This stacked configuartion is perfectly possible with bassmidi. You should set the 1st soundfont's to load all its instruments at bank: 0 and the 2nd soundfont to load all its instruments at bank: 1.

Actually this is the way Sound Blaster's soundfont manager also workeed to add variation banks and this behavior is also implemented by bassmidi.

The problem is as I have written above when you want to create such a stacked configuration and also pre-load the soundfonts VMS throws and error that there is no instrument at Bank: 1 in the 2nd soundfont. That is true, but it does not have to have an insreument in the soundfont at bank: 1 in order to place it at bank: 1 in the configuration! As in Bassmidi's documentation:

'When using all presets in a soundfont, the bank member is a base number that is added to the soundfont's banks. For example, if bank=1 then the soundfont's bank 0 becomes bank 1, etc. Negative base numbers are allowed.'

You have to call BASS_MIDI_StreamSetFonts() to create this stacked configuration.

There's a separate function to pre-load soundfonts: BASS_MIDI_FontLoad();

The problem is, I think, VMS uses the BASS_MIDI_FontLoad(HSOUNDFONT handle, int preset, int bank) function in a wrong way. VMS thinks BASS_MIDI_FontLoad expects the bank parameter to be the 'destination' where you want to place the bank, so it calls the function in case of the 2nd soundfont like BASS_MIDI_FontLoad(HSOUNDFONT handle, -1, 1) but it should not. Since fontload affects the soundfont itself (and there are really no instruments at bank : 1!) it should be called always like  BASS_MIDI_FontLoad(HSOUNDFONT handle, -1, -1).

from documentation:

Parameters:

handle: The soundfont handle.

preset: Preset number to load... -1 = all presets.

bank: Bank number to load... -1 = all banks.

Posts: 50
Joined: January 24, 2015 - 01:26
Re: Bank/preset loading error

@falcosoft

I understand the problem more clearly now. You are not using "all presets from all banks in a soundfont" This would be "-1: -1" in Coolsoft.

Nonetheless, according to this part:
When using an individual preset from a soundfont, BASSMIDI will first look for the exact spreset and sbank match, but if that is not present, the first preset from the soundfont will be used. 

It does look for it, and it does use the patch at 001:000, like you want it to. Midi file that uses 001:000 will confirm that behaviour. It just gives you an error to say, that there was nothing on 001:000 in the soundfont, but there will be according to specification.

Attachments (Only registered users)
untitled.rar
Posts: 129
Joined: September 25, 2013 - 16:38
Re: Bank/preset loading error

Thanks for your feedback. Maybe I was not clear enough. I can make the configuration I want. I do not have the problem of not hearing intruments at the required banks/programs. My only problem is I cannot make the configuartion if the Preload the Soundfont option is selected. Otherwise its is working perfectly.  Maybe more emphasis should have been made for this part in my previous posts:

' The problem is as I have written above when you want to create such a stacked configuration and also pre-load the soundfonts VMS throws and error that there is no instrument at Bank: 1 in the 2nd soundfont. '

@ Claudio: Please read the following part since it's important.

But the root of the problem is more difficult:

There are 2 different concepts in Bassmidi's soundfont handling reagarding banks/presets. Currently in VMS 2 these 2 concepts are mixed which results in problems and misunderstandings.

1. Where you want your soundfont banks/ presets to be available regarding midi playback. (This is what BASS_MIDI_StreamSetFonts()  is for)

2. What banks/presets you want to preload from the soundfonts. (This is what BASS_MIDI_FontLoad() is for).

Currently on VMS 2 interface there is 1 part where you can define point 1. But it is misleading since partly uses the concept of point 2.

Namely on the interface:

'Bank (-1 - 65535, -1 = all banks)' Unfortunately it is misleading since bank: -1 never means 'all banks' for bassmidi in point 1's regard. And also the valid range is not from -1 (there is no such restriction).

'When using all presets in a soundfont, the bank member is a base number that is added to the soundfont's banks. For example, if bank=1 then the soundfont's bank 0 becomes bank 1, etc. Negative base numbers are allowed.'

In Point 1's regard: all the cases where Preset = -1 means 'all banks', since in case of Preset = -1 bank means an offset and not a position.   If you try different Bank values in current VMS 2 you will notice that is working according to bassmidi's documentation and not like VMS 2 description's suggests.

The real problem is the parameters that are passed to BASS_MIDI_FontLoad() (Point 2 domain) are not present separately on VMS 2 interface but VMS uses implicitely the values you set for Point 1.

But this concept is wrong. In point 2's case on the one hand bank = -1 really means load all banks on the other hand its valid range is not from -1 to 65535! In case of Font pre-loading you can only use banks/presets that are present in the soundfont. So this range is even theoretically is from -1(all banks) to 127. This is also the case for presets: valid range is from -1 to 127.

Try it: Set bank number to above 127 (e.g to 1000) in VMS 2.0 dialog and also select Preload the soundfont. You will get an error after you press apply that the preset does not exists...

Notice: there should not be such a problem: You should be able to preload the whole soundfont by setting bank= -1 preset = -1 and pass these arguments to  BASS_MIDI_FontLoad() and also set the logical bank offset where you want all the preset to be available by setting bank = 1000 and preset = -1. Currently this is not possible in VMS 2.

I hope I could make myself clear.

Please Claudio fix this.

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: Bank/preset loading error

@falcosoft: thanks for your detailed explanation. I'm not a MIDI expert and even less expert in SoundFonts, so I misunderstood BASS documentation about usage of bank/preset parameters.

Since VMS plays a live stream, it cannot predict which banks/presets will be needed in the future (like a MIDI player could).
Preload feature should load the whole soundfont, regardless of bank/preset setting.
This should fix point 2) issue.

As for point 1) I completely missed the double meaning of bank parameter and I actually can't find a way to express it in plain English in a musical and non technical form.
I'm all ears for suggestions and/or GUI mockups.

The attached synth exe (v2.0.1-x64) contains these patches:

  • BASS_MIDI_FontLoad(handle, -1, -1) calls
  • Bank accepts values from -65535 to 65535 (I don't know if this is a reasonable range, please suggest one)
    Because of the previous change, a negative or unexisting bank won't throw errors anymore in BASS_MIDI_FontLoad().

Please check it out and share your thoughts.

EDIT: obsolete attachment removed.

Posts: 129
Joined: September 25, 2013 - 16:38
Re: Bank/preset loading error

Hi,

'The attached synth exe (v2.0.1-x64) contains these patches:

  • BASS_MIDI_FontLoad(handle, -1, -1) calls
  • Bank accepts values from -65535 to 65535 (I don't know if this is a reasonable range, please suggest one)
    Because of the previous change, a negative or unexisting bank won't throw errors anymore in BASS_MIDI_FontLoad().'

1. The 1st part of the patch is perfect. Yes, you should preload the whole soundfont when preload option is selected.

2. The 2nd part of the patch is still not perfect.  I forgot to give you the correct range for banks. I have just said that 'the valid range is not from -1.' But there is no sense to give a bigger range than -127 to 127 since the number of banks are still restricted to 127 (+ 1 drum bank) in Soundfonts/Bassmidi (unlike presets that are extended to 65535 in Bassmidi). And bank = -65535 still does not mean all banks :).

I dont know either exactly what could be the perfect phrase on the GUI since the logic is really not so simple.

First the logic:

Preset range is from -1 to 65535. It is perfect in its current form also the explanation.

But for the Bank range the logic depends on the actual preset value.

If preset = -1 the possible bank range is from -127 to 127 since this number is a banks offset .

If preset <> -1 (this means and individual instrument designated by a concrete bank/preset combination) then the valid range is only from 0 to 127. (negative values are not valid when bank means a real bank position in the soundfont).

So possible GUI lables could be (it would be logical to exchange the position of the preset and bank controls since the possible bank values depend on the actual preset value and not the other way around):

Preset (-1 - 65535, -1= all presets)

if preset = -1 then

Bank ( -127 - 127, value means bank offset)

else

Bank (0 - 127, value means a concrete bank)

Thanks

Falco

Posts: 129
Joined: September 25, 2013 - 16:38
Re: Bank/preset loading error

Hi,

'Preset range is from -1 to 65535. It is perfect in its current form also the explanation.'

I thought about this a little more and came to the conclusion that in spite of this range is valid in bassmidi's terms it has absolutely no sense in case of VMS.

The reason: No program that uses VMS as output can reach the presets above 127! The extended range of Bassmidi's presets (128-65535) can obly be reached by the special

BASS_MIDI_StreamEvent() calls. But VMS does not generate program change messages by itself but it reacts to messages sent by other midi programs through the infrastucture of Windows.

And the elements of this chain (program using VMS, windows midi driver architecture) are resticted/limited to midi standard program change messages of 0 -127.

So the logical range for presets in VMS are from -1(all) to 127.

Also this way the first part of the patch can be reconsidered the folowing way:

if preset = -1 (use all) then call

BASS_MIDI_FontLoad(handle, -1, -1) ;

else

BASS_MIDI_FontLoad(handle, preset, bank); - Notice: since the ranges are now the same in case of preset <> -1 (namely 0 - 127),  you can now safely load only the 1 instrument designated by the concrete preset/bank combo at the position.

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: Bank/preset loading error

I've changed the SoundFont editor dialog to show two different labels for the Bank field, based on Preset field value.
It requires some work for translators (2 new translation items) but it's the best solution I've found to show what's happening when you set Preset field.

Attached here thee's a full setup (because of the updated lang files) of 2.0.1-BankPatch version.
Please note that only English and Italian langs are updated with the new strings.

EDIT: obsolete attachment removed.

Pages