Author Topic: [BASSMIDI] Delay on note-off not work with only kill last note on has no..  (Read 151 times)

MIDAPMI

  • Posts: 95
Delay on note-off not work with only kill last note on has noteoff.

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.


1- The delay Don't work by default even if the "Only kill last note on note off" option is enabled, for fix this need replace note-on velocity 0 with note-off in the midi and work only when option is enabled if you disable  "Only kill last note on note off" option the delay not work.

2- The next notes kill on overlapping if the sound if two velocity is same, .

3- The no limits flags doesn't remove the limit on attack below 5 ms

I think for this can be fixed adding delay release in ms instead delay noteoff

https://youtu.be/eTcFBu9p5Xk look piano

Other issue into flag No limit

Bass nolimits flag doesn't remove limit on the volume attack (limit to 5ms and above ms) (Ramp i think that i better to disable as default for use attack or wave instrument ramp).
« Last Edit: 6 Jan '21 - 15:44 by MIDAPMI »

Ian @ un4seen

  • Administrator
  • Posts: 23288
When you say the "Only kill last note on note off" option, are you referring to the BASS_MIDI_NOTEOFF1 flag? If so, there don't appear to be any duplicate notes for it to have effect on in the file you attached. Perhaps you attached the wrong file? I notice it's DESTINY.MID in your video but the attached file is DESTINYORI.MID.

The ramp-in is primarily a BASSMIDI thing rather than a Creative/SoundBlaster thing, so it's unaffected by the BASS_MIDI_FONT_NOLIMITS flag (which disables Creative/SoundBlaster limit emulation). By default, BASSMIDI will only ramp-in a sample even when the volume envelope has no attack phase if the sample data doesn't begin close to 0, to avoid a "click" sound. The BASS_MIDI_FONT_NORAMPIN flag can be used to disable the ramp-in regardless of what the sample data is.

MIDAPMI

  • Posts: 95
Hello thanks for answer, always to get enhancement from another to bass.
When you say the "Only kill last note on note off" option, are you referring to the BASS_MIDI_NOTEOFF1 flag? If so, there don't appear to be any duplicate notes for it to have effect on in the file you attached. Perhaps you attached the wrong file? I notice it's DESTINY.MID in your video but the attached file is DESTINYORI.MID.
It's because that is the file that i want to delay noteoff. obviously the file not have note overlapping, but the code that you says above add a delay in (ms) to noteoff true?; After this the result is overlapping, but overlapping of noteoff delay doesn't work except if ...

1.) If midi includes noteoff message even if you enable "only kill last note on as note off" option is enabled" for get work need replace all note-off as note-on + vel 0.

2.) get problem with some instrument, if any people want process as external like audacity and want to add legato look that piano presents problem also cabasa (key instrument 54 of drumset), i think that is bug, is like as extremely voice killer. one of example look the cabasa only with a 20 ms delay, you can show presence of attenuation can be exactly same to Piano at 500 ms of delay, Piano release fastly sometimes. (I never will be use more than 20 ms due will be pseudoreverb).



Peaks: First Enabled and  Second Disabled


The ramp-in is primarily a BASSMIDI thing rather than a Creative/SoundBlaster thing, so it's unaffected by the BASS_MIDI_FONT_NOLIMITS flag (which disables Creative/SoundBlaster limit emulation). By default, BASSMIDI will only ramp-in a sample even when the volume envelope has no attack phase if the sample data doesn't begin close to 0, to avoid a "click" sound. The BASS_MIDI_FONT_NORAMPIN flag can be used to disable the ramp-in regardless of what the sample data is.

IF you do say that if i want to use the attack above 5 ms.

So...

With no ramping and not limit disabled enabled, enabled disabled, enabled enabled or disabled disabled adding 1 sample silence or not, always i can get attack from of 5 ms. From 4 or less i don't get any effect. but in timidity that is old like Gravis PAT i get without problems, All flags work well except attack below 5ms that needs removed by no_limits.

If you add no ramping add also for allow use custom ramping for smooth instrument. i want add 2 ms to qualcomm brew for get Blackberry OS6 Sawtooth.

Soundblaster is old, i know that you want keep the soundblaster but you can enhance without affect.
Ex. No limits and no ramping need be disabled by default.. or exist any soundfont designed for soundblaster that have filter or lfo more than the limit?.

Practically currently the ramping is closer to key number to volume envelope attack modulator, thing that exist and can be added in sf2.

In this case you have reason if for .sbk but for sf2 i don't sure.
« Last Edit: 8 Jan '21 - 07:48 by MIDAPMI »

Ian @ un4seen

  • Administrator
  • Posts: 23288
It's because that is the file that i want to delay noteoff. obviously the file not have note overlapping, but the code that you says above add a delay in (ms) to noteoff true?; After this the result is overlapping, but overlapping of noteoff delay doesn't work except if ...

1.) If midi includes noteoff message even if you enable "only kill last note on as note off" option is enabled" for get work need replace all note-off as note-on + vel 0.

2.) get problem with some instrument, if any people want process as external like audacity and want to add legato look that piano presents problem also cabasa (key instrument 54 of drumset), i think that is bug, is like as extremely voice killer. one of example look the cabasa only with a 20 ms delay, you can show presence of attenuation can be exactly same to Piano at 500 ms of delay, Piano release fastly sometimes. (I never will be use more than 20 ms due will be pseudoreverb).

In the posted video, it looked like you were only raising the output buffer to 500ms to trigger the problem. There didn't appear to be any note-off delay setting adjustment?

I tried using the code posted above (plus chronological sorting) to delay the note-off events in your test file by as much as 100 ticks (also tried 4 and 40) and it still sounded fine (no chopped notes) with BASS_MIDI_NOTEOFF1 set.

BASSMIDI treats note-off identically to note-on with velocity=0 (the former is converted to the latter). If you're seeing different results when using one or the other then perhaps it's the app that's handling them differently before passing them to BASSMIDI?

If you add no ramping add also for allow use custom ramping for smooth instrument. i want add 2 ms to qualcomm brew for get Blackberry OS6 Sawtooth.

A 2ms attack would currently be reduced to nothing by BASSMIDI if the BASS_MIDI_FONT_NORAMPIN flag is set or the sample data begins with 0. Here's an update that should retain a 2ms attack (only 1ms or below will be reduced to nothing):

   www.un4seen.com/stuff/bassmidi.zip

MIDAPMI

  • Posts: 95
Thanks for add this fix. My sound is clean now without peaks or any artifacts. this is a critical update :) Thanks really.


respect to the noteoff delay by default doesn't replaces note-off as noteon velocity 0
This is the reason of the midi destinynoteoff.mid doesn't take any effect, destinynoteonasnoteoff.mid (i called bad, in really is noteoffasnoteonvel0.mid) is replaced inside midi event all noteoff with noteon+vel0 that work fine. Also when delay is set to 20 ms i note that events have attenuation issues  or release before noteoff.  This causes peaks problem. Show image of above
« Last Edit: 9 Jan '21 - 14:10 by MIDAPMI »