lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default midi velocity


From: Martin Tarenskeen
Subject: Re: default midi velocity
Date: Mon, 6 Apr 2009 09:50:17 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

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

Attachment: lilypond-2.13.0.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]