Author Topic: List of SF2 MODULATORS implemented in Virtualmidisynth/BASSMIDI  (Read 2673 times)

syryo

  • Posts: 33
I noted that some soundfonts have defined modulators in them. As I use Virtualmidisynth with soundfonts I would like to know which modulators are recognized by BASS/BASSMIDI.
Please refer to:
http://www.synthfont.com/modulators.html
and
http://www.un4seen.com/doc/#bassmidi/BASS_MIDI_FontInit.html
Thank you.

Ian @ un4seen

  • Administrator
  • Posts: 25275
The modulators supported by the current BASSMIDI release (2.4.13) are those listed in the BASS_MIDI_FontInit documentation linked above. In addition to those, the latest builds include support for note velocity to start offset (startAddrsOffset) and note velocity to modulation envelope filter cutoff (modEnvToFilterFc), and the note velocity to initialAttenuation support is expanded to all curve types (not only negative unipolar concave). CC21-24 to initialFilterFc/initialAttenuation/attackVolEnv/decayVolEnv/releaseVolEnv/releaseModEnv/modEnvToFilterFc modulators are also now supported, but each CC can only have one destination per-preset, eg. you couldn't have CC21 to initialFilterFc and CC21 to initialAttenuation on the same preset.

You can get the latest BASSMIDI build from here:

   www.un4seen.com/stuff/bassmidi.zip

syryo

  • Posts: 33
Just a couple of clarifications:
  when you say CC#21 to CC#24, are they decimal or hex numbers?
  what about implementation of other modulators in the future?

Thank you for all.

Ian @ un4seen

  • Administrator
  • Posts: 25275
They're decimal. CC21-24 are undefined in the MIDI standard, so they're free for custom purposes. There are several other undefined CC but CC21-24 were chosen because they're included as modulator sources in the Vienna soundfont software.

There aren't any plans for other modulators currently but that could change if the demand arises. The existing modulators were pretty much all added following user requests.

syryo

  • Posts: 33
Hi Ian,
what about implementing:
CC#93 Chorus level  to Chorus send %
CC#91 Effect level  to Reverb send %

Thank you anyway :)

Ian @ un4seen

  • Administrator
  • Posts: 25275
Do you mean the default CC91/93 to reverb/chorus modulators in the SF2 spec? If so, they are used in BASSMIDI but the amounts are 75% rather than 20% (the latter seemed too low). The other default modulators in the SF2 spec are all used too, except the slightly strange note velocity to filter cutoff modulator.

Zenxia

  • Posts: 174
He refers to the cc#91 and cc#93 to reverb and chorus, im asking also this and cc#7 to initial attenuation, the ausence of this lastest doesn't allow to me measure 100% chippy bank.sf2

All this is included on the soundfont specifications. Is recommended to add this.

(offtopic)
and noteoff (4ms slope after this is too very short try a more higher value). This seems ok when only kill last noteon as noteoff event is enabled. idk why you doesn't try a beta with this for test. delay noteoff event that is implemented on omnimidi have problem due noteoff, always get random skipping and with this option disable, the delay noteoff doesn't work. noteoff also cuts instrument release.
« Last Edit: 2 Nov '21 - 08:24 by Zenxia »

Zenxia

  • Posts: 174
CC21-24 to initialFilterFc/initialAttenuation/attackVolEnv/decayVolEnv/releaseVolEnv/releaseModEnv/modEnvToFilterFc modulators are also now supported, but each CC can only have one destination per-preset, eg. you couldn't have CC21 to initialFilterFc and CC21 to initialAttenuation on the same preset.

CC7 need be to initialattenuation CC91 to reverb and cc93 to chorus. Doesn't is correct use cc21 (not specified in soundblaster)

Ian @ un4seen

  • Administrator
  • Posts: 25275
The SF2 spec allows modulators to be assigned to almost any CC (see section 8.2.1). BASSMIDI doesn't apply any modulators to CC21-24 by default - modulators are only applied to them if specified by the soundfont.

BASSMIDI does support the SF2 spec's default CC7 to initialAttenuation modulator. It just doesn't support custom CC7 modulators. The same applies to the CC91/93 modulators (except that BASSMIDI sets the amount to 750 instead of 200 because 200 seemed too low).

Zenxia

  • Posts: 174
The SF2 spec allows modulators to be assigned to almost any CC (see section 8.2.1). BASSMIDI doesn't apply any modulators to CC21-24 by default - modulators are only applied to them if specified by the soundfont.

BASSMIDI does support the SF2 spec's default CC7 to initialAttenuation modulator. It just doesn't support custom CC7 modulators. The same applies to the CC91/93 modulators (except that BASSMIDI sets the amount to 750 instead of 200 because 200 seemed too low).

Doesn't support CC custom mode

I can't assign to cc21 due all midi uses standard cc#7 to initial attenuation. That not will play all midi same as original synth. Even soundblaster creative card 1999-2002 support this and bassmidi 2021 doesn't support, is funny. Please try to fix help me plisss!. i mean that if support cc21 also support cc7.

In serious, what solution you says that is better way for measure cc#7 to attenuation, I measured this on my soundblaster and bassmidi send all work to trash.

In this case is own and follow soundblaster specifications partially.

I mean that this is only the modulators that you requires to match 100% bassmidi to soundblaster/dls GS in the modulators side.

This is other important performance request.
Try to kill notes at least after 20 ms, can be delayed or add 10ms linear slope release after noteoff.
« Last Edit: 5 Nov '21 - 07:50 by Zenxia »

Ian @ un4seen

  • Administrator
  • Posts: 25275
I can't assign to cc21 due all midi uses standard cc#7 to initial attenuation.

There can be more than 1 modulator with the initialAttenuation destination, ie. a CC21 to initialAttenuation modulator won't affect the standard CC7 modulator.

The CC21-24 modulators were added for another BASSMIDI user that needed more control in their apps where they are also creating the soundfont, so they can use CC21-24 in both the app's code and soundfont. Other users might find them useful for their apps too, but I guess they're unlikely to be very useful in general public soundfonts.

In serious, what solution you says that is better way for measure cc#7 to attenuation, I measured this on my soundblaster and bassmidi send all work to trash.

Is that with the standard/default CC7 modulator? If so, please provide a MIDI file and soundfont to reproduce the problem with. Make sure the MIDI file only contains the events required to produce the problem (no other events to confuse matters).

Try to kill notes at least after 20 ms, can be delayed or add 10ms linear slope release after noteoff.

Sorry but there are no plans for delaying events in BASSMIDI. That sort of thing can be done by the app, ie. send the event to BASSMIDI later.

Zenxia

  • Posts: 174

The CC21-24 modulators were added for another BASSMIDI user that needed more control in their apps where they are also creating the soundfont, so they can use CC21-24 in both the app's code and soundfont. Other users might find them useful for their apps too, but I guess they're unlikely to be very useful in general public soundfonts.


Yep, doesn't userful, my guide is sb modulators due bassmidi follow this.


Quote
Is that with the standard/default CC7 modulator? If so, please provide a MIDI file and soundfont to reproduce the problem with. Make sure the MIDI file only contains the events required to produce the problem (no other events to confuse matters).

not, im get only volume difference due missing CC#7 to attenuation modulator, see the differences between two.

Quote
Sorry but there are no plans for delaying events in BASSMIDI. That sort of thing can be done by the app, ie. send the event to BASSMIDI later.

I'm not asking app side due anyway fails. I'm asking this because any minimal lactency difference send noteoff delayed ignoring overlapping.
Please fix this. This is important. Fix overlapping. I tried only kill last note on as add 35% improvement but cause problem in some game midis/ringtones.

Ian @ un4seen

  • Administrator
  • Posts: 25275
If you believe you have found a bug in BASSMIDI then please provide test file(s) to reproduce it with. I can't investigate things with only recordings of unknown files from unknown software. If you don't want to share the files publicly, you can email/PM them to me.

Zenxia

  • Posts: 174
If you believe you have found a bug in BASSMIDI then please provide test file(s) to reproduce it with. I can't investigate things with only recordings of unknown files from unknown software. If you don't want to share the files publicly, you can email/PM them to me.


The only bug is overlapping, for compesate any lactency on the noteoff events, is better noteoff at least 10ms after received noteoff message instead immediately noteoff. And if you want optimize bassmidi for blackmidi ignore this feature.

Also i tried use dynamic range compressor and seems better. For mixing on any external (like audacity) is better this.

The software that i tested this feature is Omnimidi, but newers version have bad problems.

As sequencer Midiplayer x64 lastest version libraries.

Is hard to build a custom library for test? Try to add at least for 10 seg and fix noteoff overlapping issues.

But if the notes were intended to be released later then surely the MIDI file's author would have delayed the note off events? I don't think it is a good idea to override what the MIDI data says to do, and certainly not by default.

If you want, it is possible to change the time of the note off events. You would use BASS_MIDI_StreamGetEvents to get all of the events, then increase the "tick" values of the MIDI_EVENT_NOTE events that have velocity=0, and then pass the modified event array to BASS_MIDI_StreamCreateEvents. For example, something like this:

Code: [Select]
float ppqn;
BASS_ChannelGetAttribute(midi1, BASS_ATTRIB_MIDI_PPQN, &ppqn); // get PPQN value
int eventc = BASS_MIDI_StreamGetEvents(midi1, -1, 0, NULL); // get number of events
BASS_MIDI_EVENT *events = new BASS_MIDI_EVENT[eventc + 1]; // allocate event array
BASS_MIDI_StreamGetEvents(midi1, -1, 0, events); // get the events
// look for and delay note off events
for (int a = 0; a < eventc; a++) {
   if (events[a].event == MIDI_EVENT_NOTE && !HIBYTE(events[a].param)) // found a note off
      events[a].tick += 4; // delay by 4 ticks
}
// add end event
events[eventc].event = MIDI_EVENT_END;
events[eventc].tick = BASS_ChannelGetLength(midi1, BASS_POS_MIDI_TICK);
midi2 = BASS_MIDI_StreamCreateEvents(events, (int)ppqn, 0, 0); // create a new stream from the events
delete[] events; // free the event array
BASS_ChannelPlay(midi2, 0); // start playing

One thing to note is that the event array must be in chronological order when passed to BASS_MIDI_StreamGetEvents, so you may need to reorder (sort by tick) the events after delaying the note offs.



Ian @ un4seen

  • Administrator
  • Posts: 25275
The only bug is overlapping, for compesate any lactency on the noteoff events, is better noteoff at least 10ms after received noteoff message instead immediately noteoff.

Just to be sure, are you saying there's a bug with overlapping/duplicate notes or the bug is that BASSMIDI isn't delaying noteoffs? If the latter then I disagree that it's a bug - BASSMIDI should not be delaying noteoffs. If the former then make sure the BASS_MIDI_NOTEOFF1 option is enabled, and if the problem still happens then please provide a test MIDI file to reproduce it with. Make sure the problem is reproduceable when playing the test file with BASSMIDI directly, eg. not only when using Omnimidi or other software. Here's a version of the MIDITEST example with the BASS_MIDI_NOTEOFF1 option enabled for you to reproduce the problem with:

   www.un4seen.com/stuff/miditest-overlap.exe

Zenxia

  • Posts: 174
See this

Delay noteoff = 10ms (Default DLS) + Noteoff1=On Nice!
Delay noteoff = Disabled (That is default in bassmidi) + Noteoff1= On Seems Quiet

But when i play melody, in some instrument cuts note event in most midi's

Delay noteoff = 10ms (Default DLS) + Noteoff1=Off Bad, need allow overlap to same to delay noteoff time in this midi is more notable in key #69 of drumset and piano.

Delay noteoff = 10ms + Noteoff1 = On. Seems fine. 100 % less release value than below and seems clean, bad for you

Delay noteoff = Default (I added to reduce more release to reduce quiet sound ) Pseudo reverb for me, well for you


« Last Edit: 19 Dec '21 - 01:48 by Zenxia »

Ian @ un4seen

  • Administrator
  • Posts: 25275
Can you reproduce the problem with the MIDITEST example? If so, please provide a test MIDI file and soundfont for me to reproduce the problem with, so that I can check what's happening.

Zenxia

  • Posts: 174
Can you reproduce the problem with the MIDITEST example? If so, please provide a test MIDI file and soundfont for me to reproduce the problem with, so that I can check what's happening.

Miditest example doesn't have noteoff delay option, this is reason that i not can reproduce problem.

But by lactency doesn't seems position/detunes issues. According to falcosoft, this problem is generated using as midi out and using sequencer. like omnimidi, midiplayer, windows media player, kmc midi converter (in real-time mode), etc.
« Last Edit: 21 Dec '21 - 22:04 by Zenxia »

Ian @ un4seen

  • Administrator
  • Posts: 25275
You could emulate a "noteoff delay" option by extending the length of the notes in MIDI editing software. And then try playing the edited MIDI file with the MIDITEST example posted above.

Zenxia

  • Posts: 174
 ;D Problem persist 8), and with noteoff1=disabled is entire disaster.

The notes is strictly stopped after overlaping when "noteoff1=disabled" like.

Delay noteoff = 10ms (Default DLS) + Noteoff1=Off Bad, need allow overlap to same to delay noteoff time in this midi is more notable in key #69 of drumset and piano.

With "noteoff1=enabled" you will perceive that sound is slight attenuated "Square LFO" in the zones that "noteoff1=disable" skip/mutes notes.

But if you move playback slider you will see the problem of above anyway. This is the problem that i want correct you.

Try below and see.
Also move time slider and you will see problems anyway.
« Last Edit: 24 Dec '21 - 03:14 by Zenxia »

Zenxia

  • Posts: 174
The issue of delay events is caused by any bassmidi driver/omnimidi/vms etc

Due video seems fall. i'm recreating the video, demostrating bugs. Currently fluidsynth, timidity++ or any other softsynth this problem is unexistent.



I'm use bassmidi for test my projects of soundfonts.
« Last Edit: 1 Jan '22 - 15:35 by Zenxia »

Ian @ un4seen

  • Administrator
  • Posts: 25275
With "noteoff1=enabled" you will perceive that sound is slight attenuated "Square LFO" in the zones that "noteoff1=disable" skip/mutes notes.

I guess the "Square LFO" is a custom soundfont that you're using? That wasn't included in your attachment, so I can't really say what's happening with it, but one possibility is that it's being ramped-in. That can be disabled with the BASS_MIDI_FONT_NORAMPIN flag, but another way to prevent ramping-in is to make the sample data begin with a 0 in the soundfont.

But if you move playback slider you will see the problem of above anyway. This is the problem that i want correct you.

Try below and see.
Also move time slider and you will see problems anyway.

Seeking can indeed cause a problem for overlapping duplicate notes. For example, if the event sequence is NOTE-ON, NOTE-ON, NOTE-OFF, NOTE-OFF, and you seek to between the NOTE-ONs then the second NOTE-ON will be released by the first NOTE-OFF (because the first NOTE-ON wasn't played). There isn't really much that can be done about that except avoiding seeking to such positions, but the problem shouldn't last long after seeking anyway.

Zenxia

  • Posts: 174

Seeking can indeed cause a problem for overlapping duplicate notes. For example, if the event sequence is NOTE-ON, NOTE-ON, NOTE-OFF, NOTE-OFF, and you seek to between the NOTE-ONs then the second NOTE-ON will be released by the first NOTE-OFF (because the first NOTE-ON wasn't played). There isn't really much that can be done about that except avoiding seeking to such positions, but the problem shouldn't last long after seeking anyway.

Yep, is normal when move slider. this problem is acceptable ok. but if you try improve it, also will be much improve overall ¿but what about fast playback notes as (key 42,54,69 and 70) ? seems irregular volumes. Also in performance spikes in  live playback, when system gets bad performance spikes, the long notes sound returns delayed [Second 53 of demo of above] and  i can't avoid this.
and in live playback, when system gets performance spikes, the long notes sound returns delayed [Second 53 of demo of above]
« Last Edit: 31 Dec '21 - 00:40 by Zenxia »

Ian @ un4seen

  • Administrator
  • Posts: 25275
but what about fast playback notes as (key 42,54,69 and 70) ? seems irregular volumes.

What is this referring to? If it's a MIDI file then please post that. Also confirm that you have reproduced the problem with MIDITEST.

Also in performance spikes in  live playback, when system gets bad performance spikes, the long notes sound returns delayed [Second 53 of demo of above] and  i can't avoid this.

In your video, it looks like the problem is only happening when using the "Midi Player" software, and not when using MIDITEST. Is that correct? Also, on the occasions when it was still visible, it looked like the player's UI froze at the same time as the sound stalled?

Falcosoft

  • Posts: 143
The problem in the posted video has nothing to do with Bassmidi. This Win7 basic theme specific problem is this:
https://github.com/mpv-player/mpv/issues/2853#issuecomment-209545284
That is:
"About reasons of video stutter - it seems that in classic theme whenever any window is in process of minimization/restore animation event processing for every window will be stopped for that duration. So every thread that calls GetMessage or SendMessage will stop and wait 'till the animation ends. And without event processing you cannot update the contents of the window. So there is probably no simple solution if there is one at all."

So I do not understand why Zenxia posted this video demonstrating the quoted problem of Bassmidi by me.
The problem I talked about is completely different. It's a Midi precision problem that has nothing to do with Win 7 basic theme. It means that using Bassmidi's real-time functions naively (among others every Bassmidi based Windows driver does this such as BassMidi driver OmniMidi or VMS) you cannot get more precision than 5 ms (the minimum of update period) but even worse precision if you disable buffers (10 ms on Windows)  or use ASIO (maximim precision is the ASIO buffer size).