lilypond-user
[Top][All Lists]
Advanced

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

Re: midiPanPosition in midi context block


From: Matt Wallis
Subject: Re: midiPanPosition in midi context block
Date: Mon, 11 Nov 2019 13:00:46 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 08/11/2019 14:30, David Kastrup wrote:
Matt Wallis <address@hidden> writes:

But it doesn't work if I try to set the midiPanPosition inside a midi
context block like this:

\version "2.19.83"

\include "english.ly"
sopStaff = \new Staff = "sop" {
  \relative c' { e4 f g a }
}
altoStaff = \new Staff = "alto" {
  \relative c' { c4 d e f }
}
\score {
  <<
    \sopStaff
    \altoStaff
  >>
  \midi {
    \context Staff = "sop" {
      \set Staff.midiPanPosition = #1.0
      \set Staff.midiBalance = #1.0
    }
    \context Staff = "alto" {
      \set Staff.midiPanPosition = #-1.0
      \set Staff.midiBalance = #-1.0
    }
  }
}
This is terrible.  Really, really terrible.  \context Staff = "xxx"
should never be allowed in an output block since setting name-specific
context defs is not supported and does not make sense, either.  I'll see
whether I can stop the parser from accepting this abomination.

Strong words! My code,  above,  was the result of an error in pasting. What I had meant to do is this:

\score {
  <<
    \sopStaff
    \altoStaff
    \context Staff = "sop" {
      \set Staff.midiPanPosition = #1.0
    }
    \context Staff = "alto" {
      \set Staff.midiPanPosition = #-1.0
    }
  >>
 \midi { }

... which works. But now I'm worried, because the example I copied was from other code I have written. Is this another abomination?

I look forward to the day when I understand enough about how lilypond works internally in order to avoid abominations that happen to get past the parser.

Perhaps someone could point me to the relevant syntax reference docs that say (or at least imply) that my original abomination is illegal syntax, and to check that my amendment (above) is valid syntactically. I've had a look for some reference material, and found this (http://lilypond.org/doc/v2.19/Documentation/notation/contexts-explained):

"Output definitions define the relation between contexts as well as their respective default settings. While most changes will usually be made inside of a \layout block, Midi-related settings will only have an effect when made within a \midi block."

This does little to discourage my abomination. Also, it makes me suspect that my code above (with the context block within the score) is also working only by accident (because it sets midi settings outside the midi block). So, am I right in thinking that the only legal place for midi settings for a Staff as inside the original definition of that Staff?


      
Furthermore, the result of doing this is that both staffs are played
through the left, and nothing on the right.

Am I doing something wrong?
As a rule, changing syntax until something passes the parser instead of
working from documented syntax and examples is a bad idea.  
I couldn't agree more.
Most of the
time, you'll trigger error messages pinpointing the problem.

But sometimes there are oversights.

I want to do the setting in the midi context block because I require
different pan positions for a staff depending on which score it
appears in.
Then create different variables/expressions for that purpose.  But the
\midi block cannot sensibly differentiate between differently named
contexts.
Thanks for the advice. I shall use variables.



reply via email to

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