lilypond-devel
[Top][All Lists]
Advanced

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

Re: lilypond ./VERSION ./ChangeLog lily/midi-item.cc


From: Juergen Reuter
Subject: Re: lilypond ./VERSION ./ChangeLog lily/midi-item.cc
Date: Tue, 4 Nov 2003 18:31:58 +0100 (CET)


On Tue, 4 Nov 2003, Heikki Johannes Junes wrote:

> ...
>     if (get_fine_tuning () != 0)
>       {
> !       warning (_f ("Experimental: temporarily fine tuning (of %d cents) a 
> channel.",
>           get_fine_tuning ()));
> +
> +       finetune = PITCH_WHEEL_CENTER;
> +       // Move pitch wheel to a shifted position.
> +       // The pitch wheel range (of 4 semitones) is multiplied by the cents.
> +       finetune += (PITCH_WHEEL_RANGE * get_fine_tuning ()) / (4 * 100);
> +
> +       str += ::to_string ((char) (0xE0 + channel_));
> +       str += ::to_string ((char) (finetune & 0x7F));
> +       str += ::to_string ((char) (finetune >> 7));
> +       str += ::to_string ((char) (0x00));
>       }
>
> !   str += ::to_string ((char)status_byte);
>     str += ::to_string ((char) (get_pitch () + c0_pitch_i_));
>     str += ::to_string ((char)dynamic_byte_);
> ...

No, I think this will not work properly.

Ok, maybe I should have been more verbose on my last posting.  The problem
with the above approach is that it works only for monophonic channels.  As
soon as more than a single note are turned on simultaneously on the same
channel, the pitchbend usually applies on *all* notes on this channel, not
just the one that is being turned on afterwards.  In other words, it is
not possible to have e.g. c and cih (or d and fih or ...) simultaneously
on the same channel.  IIRC, lily uses one MIDI channel per staff, such
that this kind of clash is quite probable to happen.

One "solution" is to half the number of channels.  By default, you have 16
channels available (at least on MIDI devices that support the GM
standard).  Now, lets say, you reserve *two* channels per lilypond staff,
say channels 0 and 1 for the first staff, channels 2 and 3 for the second
staff, and so on.  On each channel with an even number, you leave the
pitchbend untouched.  On each channel with an odd number, you permanently
set the pitchbend to 50 cents above normal.  Now, whenever you receive a
note, you look at it if it is a quarter tone.  If not, then you transmit
it to the even channel.  If it is a quarter tone, then you transmit it to
the odd channel.

The major drawback of this approach obviously is that you reduce the
number of effectively availble channels from 16 to 8.

Greetings,
Juergen





reply via email to

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