Hi. Just pushed some more master stuff regarding note-offs
 and zero-velocity note ons and so on. 
Hope it's the right thing (TM) !

We kept Andrew's patch and moved forward.

MusE's instrument definition files (.idf) now have this attribute:

        NoteOffMode

 like this:

  <MidiInstrument name="Instrument-1" NoteOffMode="1">


NoteOffMode has three possible values:

0: 
The instrument recognizes note-off messages. 
MusE will never transmit a zero-velocity note-on message to it, 
 they will be converted to zero-velocity note-offs.
The instrument might also recognize zero-velocity note-ons as 
 note-offs, so you can also use option 2 below, to save midi interface
 bandwidth but discarding note-off velocity.

1:
The instrument does not recognize note-off messages, 
 nor does it recognize zero-velocity note-ons as note-offs. 
MusE will transmit neither to the instrument. Note-ons only.

2:
The instrument does not recognize note-off messages, 
 but does recognize zero-velocity note-ons as note-offs, 
 saving bandwidth but discarding note-off velocity.
MusE will not transmit note-off messages to the instrument, 
 but will convert them to zero-velocity note-ons.
The instrument might also recognize note-off messages,
 so you can use option 0 above, to utilize note-off velocity
 but increasing midi interface bandwidth.
 
If unspecified, the default is 0.


That was the output side. To the input side now:

In all our midi drivers or sources of midi input (that's just
 Jack and ALSA currently, but there is work on accepting
 midi sent /from/ synths, in midi.cpp), MusE automatically
 converts /all/ incoming zero-velocity note-on midi messages 
 to zero-velocity note-off messages, internally.

Thus MusE is a midi application that recognizes both 
 note-off messages /and/ zero-velocity note-on messages.

No part of MusE should ever set an instance of class Event's
 'velo' (on velocity) to zero. 
It is an error. Unlike real decoded midi messages, 
 our class Event already holds /both/ on and off velocity,
 so zero on velocity is an error.
Error messages have been placed throughout, all the way
 up to the drivers, so let us know if you see one, because
 I'm certain there'll be a few more fixes to spot.

I had to change quite a few places. I left these 'markers'
 for you to view:       // REMOVE Tim. Noteoff.
Have a quick look at what was involved before I remove them, 
 so you understand how to deal with these notes, especially
 in the context of these fixes and new setting. If you spot 
 something questionable let me know.

Examples: 
* You cannot set a pianoroll or drum note's on velocity to zero. 
* The controller graph velocity bars will not go to zero. 
* Clicking the piano or drum list will not sound a zero-velocity note.

I must mention this: A note whose resultant velocity is zero
 /after/ applying such things as track velocity and compression, 
 or drum list note volume, will /not/ be sent to the driver for sounding.

In Audio::collectEvents() for example:
        velo += track->velocity;
        velo = (velo * track->compression) / 100;
 
 the note is now /discarded/ if the resulting velocity is zero.


So, class MidiInstrument has a new enum:
enum NoteOffMode { NoteOffAll=0, NoteOffNone, NoteOffConvertToZVNoteOn };

 and new member _noteOffMode. With setNoteOffMode(), virtual noteOffMode().

Note that synths (SynthI and family) are a MidiInstrument but cannot
 be edited by the user. So they are free to override the getter
 and return what they want. For now I've set them all to return 
 option 0 (use note offs) via SynthI::noteOffMode(). 
I've fixed all the Synths to properly react to the setting, so they're 
 ready for it if you want to change it.
 

Lastly, there is one more step:

See all those built-in instrument .idf files in MusE?
We want to update them with the correct new setting.

That requires examining the Midi Implementation Chart
 of each one.

I may put out a general call for help from instrument owners 
 on LAU because it takes time to research them all, 
 and I hit a puzzle on the very first one:
Access Virus: It's a synthesizer but Chart says /no/ note-offs,
 but does not clarify if zero-velocity note-ons are used, most 
 makers clarify that, so do I assume that being a synth, it does?
I mean, some drum synths /don't/ use them at all.

I looked at dozens of charts on google, and ones I own.
I arrived at these fixes and rules.

Lemme know if any trouble.
Tim.


------------------------------------------------------------------------------
_______________________________________________
Lmuse-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmuse-developer

Reply via email to