lilypond-user
[Top][All Lists]
Advanced

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

Re: default midi velocity


From: Neil Puttock
Subject: Re: default midi velocity
Date: Sat, 11 Apr 2009 14:01:56 +0100

2009/4/9 Martin Tarenskeen <address@hidden>:
> On Wed, Apr 08, 2009 at 12:42:53AM +0100, Neil Puttock wrote:
>> 2009/4/8 Martin Tarenskeen <address@hidden>:
>> >> Do you have git installed?  It would be preferable to have a patch
>> >> created with git format-patch.
>
> I have attached such a patch.

>From 8cb3d025d08f08437f22c9ab3d5a4b35996de167 Mon Sep 17 00:00:00 2001
From: Martin Tarenskeen <address@hidden>
Date: Thu, 9 Apr 2009 10:34:42 +0200
Subject: [PATCH] Default MIDI Note-On/Off velocity output.

Note-On: velocity=127 lowered to 90 = mezzoforte
Note-Off: common practice in the MIDI world is to
use Note-On messages with velocity=0 instead.
---
 lily/midi-item.cc |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/lily/midi-item.cc b/lily/midi-item.cc
index b683821..162bf34 100644
--- a/lily/midi-item.cc
+++ b/lily/midi-item.cc
@@ -169,7 +169,7 @@ Midi_time_signature::to_string () const
 Midi_note::Midi_note (Audio_note *a)
 {
   audio_ = a;
-  dynamic_byte_ = 0x7f;
+  dynamic_byte_ = 0x5a;
 }


@@ -225,17 +225,14 @@ Midi_note_off::Midi_note_off (Midi_note *n)
   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;
+  // 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_);

   string str = ::to_string ((char)status_byte);
   str += ::to_string ((char) (get_semitone_pitch () + Midi_note::c0_pitch_));
-- 
1.6.0.6

Thanks, it's applied.




reply via email to

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