On Sun, Apr 05, 2009 at 11:04:09PM +0200, Martin Tarenskeen wrote: > diff -ur lilypond-2.13.0.orig/lily/midi-item.cc > lilypond-2.13.0/lily/midi-item.cc > --- lilypond-2.13.0.orig/lily/midi-item.cc 2009-04-05 21:11:25.000000000 > +0200 > +++ lilypond-2.13.0/lily/midi-item.cc 2009-04-05 21:17:43.000000000 +0200 > @@ -169,7 +169,8 @@ > Midi_note::Midi_note (Audio_note *a) > { > audio_ = a; > - dynamic_byte_ = 0x7f; > + dynamic_byte_ = 0x5a; > + // dynamic_byte_ = 0x7f; > }
In lily/midi-item.cc I saw this: <quote> Midi_note_off::Midi_note_off (Midi_note *n) : Midi_note (n->audio_) { on_ = n; channel_ = n->channel_; // Anybody who hears any difference, or knows how this works? // 0 should definitely be avoided, notes stick on some sound cards. // 64 is supposed to be neutral aftertouch_byte_ = 64; } <unquote> I can try to answer the question in the // comment lines. As I told you earlier, Midi Note Off message are not used very often in the MIDI world. A more widely spread message is to use Midi Note On messages with a velocity value=0 to end notes. Note Off Velocity is something special. The idea is to registrate not only how hard a key (I'm talking about a MIDI keyboard now) is hit, but also how fast it is released at the end of a note. I have only once seen a synthesizer that made use of this feature. It was an old AKAI synthesizer that used Note Off Velocity to control the Envelope Generator's release parameter of a Strings patch. In other words: If you released the keys quickly, the sound would stop directly. If you you released the keys slowly, the sound would fade-out slowly after the key was released. It required some practicing to make this work properly though. For most synths/soundcards/soundmodules Note-Off is identical to Note-On with velocity=0. I propose to change Lilypond's current behaviour to let it use Note-On messages with velocity=0 instead of Note-Off messages with velocity=64. I have attached a patch that changes this. The code can be even more simplified I think. ( The Note-Off code is now identical to the Note-On code, only the velocity value differs: 90=ON 00=OFF ). But I'm afraid to break something if I change too much lines of code. Maybe someone else who is more familiar with the code in mid-item.cc can think about it. Patch attached for those who want to try. -- Martin Tarenskeen
diff -ur lilypond-2.13.0.orig/lily/midi-item.cc lilypond-2.13.0/lily/midi-item.cc --- lilypond-2.13.0.orig/lily/midi-item.cc 2009-04-05 21:11:25.000000000 +0200 +++ lilypond-2.13.0/lily/midi-item.cc 2009-04-06 09:24:09.000000000 +0200 @@ -169,7 +169,8 @@ Midi_note::Midi_note (Audio_note *a) { audio_ = a; - dynamic_byte_ = 0x7f; + dynamic_byte_ = 0x5a; + // dynamic_byte_ = 0x7f; } @@ -229,13 +230,14 @@ // 0 should definitely be avoided, notes stick on some sound cards. // 64 is supposed to be neutral - aftertouch_byte_ = 64; + // proposed patch: use note_on with velocity=0 instead of note_off + aftertouch_byte_ = 0; } string Midi_note_off::to_string () const { - Byte status_byte = (char) (0x80 + channel_); + Byte status_byte = (char) (0x90 + channel_); //use note_on velocity=0 string str = ::to_string ((char)status_byte); str += ::to_string ((char) (get_semitone_pitch () + Midi_note::c0_pitch_));
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user