lilypond-user
[Top][All Lists]
Advanced

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

Re: instrumentSwitch and addInstrumentDefinition use


From: Keith OHara
Subject: Re: instrumentSwitch and addInstrumentDefinition use
Date: Mon, 12 Jan 2015 22:20:47 -0800
User-agent: Opera Mail/12.16 (Win32)

On Mon, 12 Jan 2015 06:36:15 -0800, Kieren MacMillan <address@hidden> wrote:

how I *want* to use it:

flute_part = {
  c'2 c''   |
  b'4 g'8 a' b'4 c''   |
  c'2 a'   |
  g'2. r4   |
  \prep_alto R1*4   | % [input below in concert pitch]  \play_alto a2 f'  | %[ 
desired typeset d'2 bes' ...]
  e'4 c'8 d' e'4 f'4   |
  d'4 b8 c' d'4 e'   |
  c'2. r4 }

\new Staff \with { instrumentName = "Flute" } \flute_part

To date, LilyPond has taken the music expression that reaches the engravers and
  1) set notes on the staff according to the pitches in the music expression
  2) consulted the \transposition to modify the pitches for MIDI

I simply use \transpose.
Yep.  So to data we have all done something like
 flute_part = { c'2 c'' % ...
   \transposition g \key f\major
   \transpose g c' {
      a2 f' % printing as d'2 bes' ...
    } }

I understand that in realistic cases you probably have the notes in one 
variable and options for arrangements in another parallel sequence
  flute_notes = {c'2 c'' .... }
  arrangementB = {s1*4 \prep_alto_flute s1*4 \switch_alto_flute s1*8 }
and it is not so convenient to break flute_notes into segments for the 
individual \transpose{}s.

LilyPond has the quote/cue mechanism, where \addQuote "fluteNotes" \flute_notes 
creates a sequence that is treated as concert pitches, as you wanted and as I used in my 
last email.  There are some bugs with addQuote, of which only 1823 makes me hesitate to 
recommend it
  http://code.google.com/p/lilypond/issues/list?q=%5CquoteDuring

For your desired input method, you want the converse of LilyPond's usual 
actions :
  1) apply the \transposition to the music to determine what notes to print
  2) send the notes in the music expression directly to MIDI
(Maybe that would have been a better design from the beginning, for use by 
composers, but it would probably have confused new users and been less 
convenient for transcribing existing music.)

As I understood Jan Peter, his auto_transpose_engraver does exactly (1).
This made me think that LilyPond's note_heads_engraver could adopt that 
behavior upon when instructed
   \set concertPitchInput = ##t
then note_heads_performer would take the converse behavior for MIDI, then we 
figure out appropriate behavior for note_name_engraver and fretboards_engraver 
and chord_names_engraver and ...

This is why I think we should brainstorm and implement a really well-designed 
instrumentSwitch/instrumentDefinition mechanism — we wouldn’t need any of this. 
We’d simply put something like

reedI = {
  \instrument “flute"
  [flute music here, no need for transposition]
  \instrument “alto flute”
  [alto music here; transposed properly in part, but optionally not in score]

Well, if the notes are right there, and you can put them in {},
  \instrument_alto_flute { ... }  \instrument_tenor_sax { ... }
then we (including the braver non-programmers among us) can write music 
functions to set up for the new instrument and transposes the stuff in {} using 
the usual LilyPond commands.

The instrumentSwitch mechanism we had before seemed less convenient than the 
way you wrote your \play_alto above, and it did not handle the transpositions 
which is the tricky bit.

I assume again that in realistic cases you have the notes in one variable, and then you 
make different instrumental arrangements with parallel music or something fancier like 
\push-to-tag, so that LilyPond can't be sure exactly what music will be played by alto 
flute until the input expressions are combined in a <<>> or \push-to-tag or 
whatever.

If my assumption is true, then to handle the transpositions the way you would 
like, we could
A) take JanPeter's approach of waiting until engraving to figure out what music 
is in what transposition,
B) teach the existing engravers to behave differently depending on 'concertPitchInput, 
which we could set in our \instrument"alto flute" or \instrument_alto_flute, or
C) write a function \transposeConcertToWritten, that iterates through the music (keeping 
track of timing in <<>> constructs) to figure which transposition holds for 
each note and converts \tranposition to \transpositionUpdateKey, which we would apply to 
the assembled music just before the it goes into \new Staff (where we often use 
\keepWithTag)




reply via email to

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