Re: default midi velocity

2009-04-11 Thread Neil Puttock
2009/4/9 Martin Tarenskeen m.tarensk...@zonnet.nl:
 On Wed, Apr 08, 2009 at 12:42:53AM +0100, Neil Puttock wrote:
 2009/4/8 Martin Tarenskeen m.tarensk...@zonnet.nl:
  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 m.tarensk...@zonnet.nl
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.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-07 Thread Martin Tarenskeen
On Mon, Apr 06, 2009 at 09:50:17AM +0200, Martin Tarenskeen wrote:
 
 Patch attached for those who want to try.
 

I was wondering what the experts think of my suggested patches to 
change Lilypond's MID output behaviour:

Current: default MIDI Note On velocity value of 127
Proposed: default MIDI Note On velocity value of 90

Current: default MIDI Note Off velocity value of 64
Proposed: MIDI Note On message with velocity=0 used as (pseudo-) Note 
Off message. This is the normal method in the MIDI world. 

(My patch was attached to my previous posting in this thead.)

-- 

Martin Tarenskeen




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-07 Thread Neil Puttock
2009/4/7 Martin Tarenskeen m.tarensk...@zonnet.nl:
 On Mon, Apr 06, 2009 at 09:50:17AM +0200, Martin Tarenskeen wrote:

 Patch attached for those who want to try.


 I was wondering what the experts think of my suggested patches to
 change Lilypond's MID output behaviour:

 Current: default MIDI Note On velocity value of 127
 Proposed: default MIDI Note On velocity value of 90

 Current: default MIDI Note Off velocity value of 64
 Proposed: MIDI Note On message with velocity=0 used as (pseudo-) Note
 Off message. This is the normal method in the MIDI world.

I'm no midi expert, but your changes look (and sound) fine to me.

Some suggestions for your patch:

+  // dynamic_byte_ = 0x7f;

You can remove this.


@@ -229,13 +230,14 @@
   //  0 should definitely be avoided, notes stick on some sound cards.
   // 64 is supposed to be neutral

These comments should also be removed.

+  // proposed patch: use note_on with velocity=0 instead of note_off

Remove `proposed patch:'

 string
 Midi_note_off::to_string () const
 {
-  Byte status_byte = (char) (0x80 + channel_);
+  Byte status_byte = (char) (0x90 + channel_); //use note_on velocity=0

I don't think a comment's necessary here if it's mentioned above.

Do you have git installed?  It would be preferable to have a patch
created with git format-patch.

Regards,
Neil


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-06 Thread Martin Tarenskeen

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.cc2009-04-05 21:11:25.0 
 +0200
 +++ lilypond-2.13.0/lily/midi-item.cc 2009-04-05 21:17:43.0 +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.0 
+0200
+++ lilypond-2.13.0/lily/midi-item.cc   2009-04-06 09:24:09.0 +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


Re: default midi velocity

2009-04-05 Thread Martin Tarenskeen
On Sun, Apr 05, 2009 at 10:37:08PM +0200, Martin Tarenskeen wrote:

 Just some thoughts about MIDI.
 Now let's make beautiful scores again using Lilypond.
 If you want a default velocity of 90 instead of 127: patch attached.

Ooops. I forgot to attach my patch.

-- 


Martin Tarenskeen



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-05 Thread Mats Bengtsson

Carl D. Sorensen wrote:


Yes, it's probably a good idea.  In scm/midi.scm, there is the following:

;; 90 == 90/127 == 0.71 is supposed to be the default value
;; urg: we should set this at start of track
(define-public dynamic-default-volume 0.71)

  

As far as I can see, this setting isn't used anywhere in the source code.

  /Mats


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-05 Thread Martin Tarenskeen

( My mail client is doing strange things ... this is another attempt to
send my message to the mailing list )

On Sat, Apr 04, 2009 at 08:05:17PM -0600, Carl D. Sorensen wrote:

  Anybody willing to take this on as a patch? It shouldn't be too
  hard, but I imagine it'll take some time grepping through the
  source files.
 
  If we agree that it's just a case of changing the default velocity,
  then this is ideally suited to a Frog; on the other hand, it would be
  great to be able to set the default volume in a \midi block, but that
  looks much more complicated.

 I agree.

 But the specific request was to have the default value be mf, which I 
think

 should be a not-too-difficult task.

I patched my copy of lilypond and now have a default velocity of 90
instead of 127 (patch attached). I like this better.

But I also discovered things are a bit more complicated. In MIDI there
are 2 totally different ways to control dynamics:

1. Midi Control Change #7 ( Volume control )
2. Note On Velocity

Option 1 is used by lilypond to translate \pp \mf \cresendo etcetera.
Option 2 is set to 127 by default.

If I record playing my digital piano in a midi sequencer my dynamics are
written in midi velocity values. This sounds different than using
Control Change messages. I can explain this: If I hit the keys harder,
not only the volume changes but also the brightness of the tone. This is
accomplished using different sample layers and/or filters in a digital
piano to mimic the sound of a real piano. This effect is re-produced
using the Velocity values in the MIDI information.

A Midi Volume Control Change can be compared to turning the volume knob
or using the sliders on a mixing console: The volume changes, but
without the effect of the changing color of the sound.

That is why dynamics that are written in a MIDI file produced directly
by lilypond don't sound as natural and realistic as is possible using
MIDI. Imagine recording a piano player who plays everything ff, and the
recording engineer takes care of the dynamics using the sliders of the
mixing console. Not quite the real thing ;-)


Just some thoughts about MIDI.
Now let's make beautiful scores again using Lilypond.
If you want a default velocity of 90 instead of 127: patch attached.

--

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.0 +0200
+++ lilypond-2.13.0/lily/midi-item.cc	2009-04-05 21:17:43.0 +0200
@@ -169,7 +169,8 @@
 Midi_note::Midi_note (Audio_note *a)
 {
   audio_ = a;
-  dynamic_byte_ = 0x7f;
+  dynamic_byte_ = 0x5a; 
+  // dynamic_byte_ = 0x7f;
 }
 
 
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-05 Thread Carl D. Sorensen



On 4/5/09 2:42 PM, Mats Bengtsson mats.bengts...@ee.kth.se wrote:

 Carl D. Sorensen wrote:
 
 Yes, it's probably a good idea.  In scm/midi.scm, there is the following:
 
 ;; 90 == 90/127 == 0.71 is supposed to be the default value
 ;; urg: we should set this at start of track
 (define-public dynamic-default-volume 0.71)
 
  
 As far as I can see, this setting isn't used anywhere in the source code.
 
/Mats

That's what I assumed the urg was for.  dynamic-default-volume is set but
never used.

Carl



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-04 Thread Neil Puttock
2009/4/3 Carl D. Sorensen c_soren...@byu.edu:

 Anybody willing to take this on as a patch?  It shouldn't be too hard, but I
 imagine it'll take some time grepping through the source files.

If we agree that it's just a case of changing the default velocity,
then this is ideally suited to a Frog; on the other hand, it would be
great to be able to set the default volume in a \midi block, but that
looks much more complicated.

Regards,
Neil


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-04 Thread Carl D. Sorensen



On 4/4/09 4:21 PM, Neil Puttock n.putt...@gmail.com wrote:

 2009/4/3 Carl D. Sorensen c_soren...@byu.edu:
 
 Anybody willing to take this on as a patch?  It shouldn't be too hard, but I
 imagine it'll take some time grepping through the source files.
 
 If we agree that it's just a case of changing the default velocity,
 then this is ideally suited to a Frog; on the other hand, it would be
 great to be able to set the default volume in a \midi block, but that
 looks much more complicated.

I agree.

But the specific request was to have the default value be mf, which I think
should be a not-too-difficult task.

Carl



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


default midi velocity

2009-04-02 Thread Martin Tarenskeen
Hi,

I have created an arrangement for 4 pianos. My score does not contain 
any dynamics markings. Now I have noticed that in the MIDI output all 
notes have the maximum Note-On midi-velocity value of 127! With 4 
piano's this gives a LOT of noise. 

Another thing I have noticed: Lilypond uses real MIDI Note Off commands 
to end notes with a default Note-Off-velocity value of 64. Note Off 
commands have always existed in the Midi Specification but are rarely 
used in the MIDI world. Almost every MIDI soft- and hardware that I have 
seen uses Note On commands with velocity=0. No big deal, it just surprised me.

Questions: 

1. How can I change the default MIDI velocity from 127 to a more modest 
value, without adding dynamic marks in the printable score ?

2. Shouldn't it be a good idea to lower midi-velocity values for 
lilypond's MIDI output by default ? In other words: If no dynamics are 
specified, shouldn't the default be mezzoforte ?

( BTW: I'm using Lilypond 2.13.0 on Fedora 10 )

-- 

Martin Tarenskeen



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-02 Thread Hans Aberg

On 2 Apr 2009, at 09:52, Martin Tarenskeen wrote:

1. How can I change the default MIDI velocity from 127 to a more  
modest

value, without adding dynamic marks in the printable score ?

2. Shouldn't it be a good idea to lower midi-velocity values for
lilypond's MIDI output by default ? In other words: If no dynamics are
specified, shouldn't the default be mezzoforte ?


I think MIDI is underdeveloped in LilyPond, and part of the reason is  
that it is not a suitable audio format. The question pops up every now  
and then, see for example:

  http://lists.gnu.org/archive/html/bug-lilypond/2009-03/msg00090.html

  Hans




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-02 Thread Martin Tarenskeen
On Thu, Apr 02, 2009 at 10:43:10AM +0200, Hans Aberg wrote:
 On 2 Apr 2009, at 09:52, Martin Tarenskeen wrote:

 1. How can I change the default MIDI velocity from 127 to a more  
 modest
 value, without adding dynamic marks in the printable score ?

 2. Shouldn't it be a good idea to lower midi-velocity values for
 lilypond's MIDI output by default ? In other words: If no dynamics are
 specified, shouldn't the default be mezzoforte ?

 I think MIDI is underdeveloped in LilyPond, and part of the reason is  
 that it is not a suitable audio format.

I don't agree. For test-hearing scores it is THE suitable format. 
(strictly speaking, I think MIDI is not an audio format.)
I also think MIDI has low priority for Lilypond's developers team. The 
recent discussion about also midi2ly confirms this.

I also use ABC and MUP for scorewriting from time to time. If I compare
these with Lilypond: Mup has pretty good features to insert all kinds of 
MIDI commands inside the score.  

For abc the special features offered by abc2midi are kind of unique and 
funny. ( Like automatic performance of guitar chords. Nice for 
test-hearing lead sheets :-) )

The main task of Lilypond should always be to produce beautiful scores.
I just don't want to blow up my speakers if I forget to turn down the 
volume on my amplifier when I play a MIDI file to test my score with 4 
piano's constantly playing fff !

-- 

Martin


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: default midi velocity

2009-04-02 Thread Hans Aberg

On 2 Apr 2009, at 11:21, Martin Tarenskeen wrote:


I think MIDI is underdeveloped in LilyPond, and part of the reason is
that it is not a suitable audio format.



(strictly speaking, I think MIDI is not an audio format.)


Audio generation format might be better.


I don't agree. For test-hearing scores it is THE suitable format.



I also think MIDI has low priority for Lilypond's developers team.


Anyway, some of the reasons were given in that link you snipped out.

  Hans




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


default midi velocity

2009-04-02 Thread Carl D. Sorensen
Martin Tarenskeen writes:


 Questions: 

 1. How can I change the default MIDI velocity from 127 to a more modest
 value, without adding dynamic marks in the printable score ?

How about this:

music = \relative c' {
  c' d e f
}   

\score {
  \music
  \layout{}
} 

\score {
  \new Score {
s\mf
\music 
  }
  \midi{}
} 

 2. Shouldn't it be a good idea to lower midi-velocity values for
 lilypond's MIDI output by default ? In other words: If no dynamics are
 specified, shouldn't the default be mezzoforte ?

Yes, it's probably a good idea.  In scm/midi.scm, there is the following:

;; 90 == 90/127 == 0.71 is supposed to be the default value
;; urg: we should set this at start of track
(define-public dynamic-default-volume 0.71)


So somebody in the coding recognizes this needs to be fixed.  Unfortunately,
I couldn't see how to do this in a few minutes of searching through the
source.

Anybody willing to take this on as a patch?  It shouldn't be too hard, but I
imagine it'll take some time grepping through the source files.

Carl



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user