lilypond-user
[Top][All Lists]
Advanced

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

Re: Lilypond structure / implicit - explicit / with statement


From: Thomas Morley
Subject: Re: Lilypond structure / implicit - explicit / with statement
Date: Sun, 3 Apr 2016 23:59:52 +0200

2016-04-03 21:02 GMT+02:00 Bernard <address@hidden>:
> On 03-04-16 18:33, Thomas Morley wrote:
>>
>> 2016-04-03 16:59 GMT+02:00 Bernard <address@hidden>:
>>
>>> All boils down to what is the \with statement.
>>
>> Well,
>>
>> http://www.lilypond.org/doc/v2.19/Documentation/learning-big-page#modifying-context-properties
>> seems pretty clear to me. There you can read:
>> " When a context is created with a \new command it may be followed
>> _immediately_ by a \with { … } block in which the default property
>> values are set."
>>
>> Please tell whats wrong with it.
>
> For me this,

??

> and that there can be no statement after the \with { ..} block
> for the Staff was possible, I did not know.

If I understand you correctly, you are wrong, as I tried to point out
in my other recent mail.

> As I just wrote to Paul Morris.
>
>>
>>
>>> If I could view, within an implicit context , like :
>>> {c'}
>>> the full explicit context like :
>>> \score {
>>> \new Staff {
>>> \new Voice {c'}
>>> }
>>> }
>>
>>
>> Well, I don't get what problem you seem to have. The following may of
>> some help, though:
>>
>> \version "2.19.36"
>>
>> #(define (single-context-parent-tree ctx)
>>    (if (and (ly:context? ctx) (ly:context? (ly:context-parent ctx)))
>>        (single-context-parent-tree (ly:context-parent ctx))
>>        (format #f "~a" ctx)))
>>
>> printBottomContextParents =
>> \context Bottom
>> \applyContext
>>    #(lambda (a)
>>      (let ((ls (drop-right
>>                  (string-split
>>                    (single-context-parent-tree a)
>>                    (car (string->list "(")))
>>                  1)))
>>      (format #t "\n\nThe Context-parent-tree:")
>>      (format #t
>>        "\n(Only contexts of type Global, Score, Staff and Voice are
>> printed)")
>>      (for-each
>>        (lambda (s)
>>          (format #t "\n~a~a"
>>            (cond ((string-contains s "Score")
>>                   (make-string 1 #\tab))
>>                  ((string-contains s "Staff")
>>                   (make-string 2 #\tab))
>>                  ((string-contains s "Voice")
>>                   (make-string 3 #\tab))
>>                  (else ""))
>>            (string-trim-both s (lambda (c)
>>                                  (or (eqv? c #\>)
>>                                      (eqv? c #\sp)
>>                                      (eqv? c #\)))))))
>>        ls)))
>>
>> m = { c''4  }
>>
>>    \new Score = "my-score"
>>      <<
>>        \new Staff = "staff-1"
>>          \new Voice = "voice-1"
>>          <<
>>            \new Voice = "voice-1a" { \voiceOne \m }
>>            \new Voice = "voice-1b" { \voiceTwo \m }
>>          >>
>>        \new Staff = "staff-2"
>>          \new Voice = "voice-2"
>>          <<
>>            \new Voice = "voice-2a" { \voiceOne \printBottomContextParents
>> \m }
>>            \new Voice = "voice-2b" { \voiceTwo \m }
>>          >>
>>      >>
>>
>> { \printBottomContextParents \m }
>>
>>
>> You'll get in terminal:
>>
>> The Context-parent-tree:
>> (Only contexts of type Global, Score, Staff and Voice are printed)
>> #<Global_context Global
>>      #<Context Score=my-score
>>          #<Context Staff=staff-1
>>              #<Context Voice=voice-1
>>              #<Context Voice=voice-1a
>>              #<Context Voice=voice-1b
>>          #<Context Staff=staff-2
>>              #<Context Voice=voice-2
>>              #<Context Voice=voice-2a
>>              #<Context Voice=voice-2b
>>
>>
>> The Context-parent-tree:
>> (Only contexts of type Global, Score, Staff and Voice are printed)
>> #<Global_context Global
>>      #<Context Score=\new
>>          #<Context Staff=\new
>>              #<Context Voice
>
>
> You are right, this does not help me. But I am surprised about you code. It
> does work but I have no idea how.


No need to understand the coding of the printing-procedures and it
would be a heavy task to explain it line by line. If it helps, just
enjoy, but be aware it's a first-shot-coding. It's usage is limited
and there may be glitches.

Cheers,
  Harm



reply via email to

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