lilypond-user
[Top][All Lists]
Advanced

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

Re: "Creating MIDI Files" doc is wrong


From: David Kastrup
Subject: Re: "Creating MIDI Files" doc is wrong
Date: Sun, 15 Oct 2017 16:09:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

James Harkins <address@hidden> writes:

> ---- On Sun, 15 Oct 2017 18:32:29 +0800 David Kastrup <address@hidden> wrote 
> ---- 
>> > Never mind, I see my mistake now. I had extrapolated from \new Staff 
>> > and \new Voice to \new Score. LilyPond accepts \new Score 
>> > (!). Possible improvement might be to reject that wrong syntax with an 
>> > informative error. 
>>  
>> It isn't wrong syntax.  And there is no way to "extrapolate" since 
>> \new Staff or \new Voice don't introduce different syntax from 
>> \new Score and there is no \staff or \voice either. 
>
> Wrong choice of word, perhaps... I had been writing a lot of "\new
> Staff" and "\new Voice," and I (incorrectly) extended that pattern up
> to score level.

It isn't incorrect syntax.  It's perfectly valid.

> It may be valid syntax, but I couldn't find what it's used for,
> anyway.

You can perfectly well write things like

\score {
  \new Score \with { \override StaffSymbol.line-count = 4 }
  <<
     \new Staff { c'1 }
     \new Staff { c''1 }
  >>
  \layout { }
}

for Score-wide settings.  The Score is the topmost user context (there
is another context Global above it but it's basically for holding Grob
defaults and programmatic purposes).

>> > - Do I just write a number here, or prepend '#' -- 1.0 or #1.0? 
>>  
>> Prepending works reliably almost anywhere, not prepending works in most 
>> places except markup as well.
>
> "... almost anywhere..." ;)

Well, fingering and string shorthands stop being shorthands when
inserting Scheme.

>> > - Single or double # for other entities? (#t vs ##t) 
>>  
>> #t and #f are Scheme expressions (not particularly pretty ones in my 
>> book), and if you want to use them from LilyPond, you need to prepend # 
>> or $.  Like with _everything_ you use from Scheme inside of LilyPond. 
>
> A-ha. OK, the trouble is that I don't really understand the boundaries
> between LilyPond and Scheme.

You don't get thrown into Scheme unless you ask for it using # or $ .

> It helps to know that # means "something from Scheme" and #t and #f
> are Scheme things, and so is 1.0, hence ##f and #1.0,

Well, I did reinvent $ as a general mechanism (before it was some
special-cased construct in music functions) in 2.15.18.  That was
actually rather substantial, and $#f and $#t look less like random
duplication.  Still I don't think that replacing # by something else in
order to have less confusing verbiage than ##f is at this point of time
in LilyPond development much of a good idea.

> but not ##1.0.

# introduces special syntactical constructs.  I find it strange that
this includes #t and #f but on the other hand, Scheme does not have the
concept of self-evaluating symbols that Lisp has (which uses t and nil).
So one runs out of nice representations with other characters fast.
Those include #(...) for literal vectors (Lisp uses [...]  instead).
And LilyPond adds #{ ... #} for getting back into LilyPond when inside
of Scheme.  So ##{ ... #} is similar to { ... } but does a few things
differently and can produce more than just sequential music.

> Five years of intermittent use, and I didn't get it (maybe I still
> don't)... it may not be possible to improve, but it falls a bit short
> of being self-explanatory ;)

No question about that.  In ##f, each # serves a completely different
purpose from the other.  As a visual aid, that's less than great.

> In any case, clearer now, thanks for the explanation.

-- 
David Kastrup



reply via email to

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