Re: Lilypond structure / implicit - explicit / with statement
On 05.04.2016 12:42, Simon Albrecht wrote: On 05.04.2016 11:55, David Kastrup wrote: That is because many people who get a go at LilyPond (such as me) are not programmers, but musicians with little background knowledge about or experience with programming. Well, you seem to be faring pretty well. Oh, thank you. All I learnt was through working with LilyPond, and through you folks on the lists :-) I confused ‘doing well’ and ‘faring well’ here, so the answer should rather have read: “It took me some years of reading (LilyPond and Guile) manuals and following the lists and a lot of trial and error till I got to terms with some of the programming aspects in LilyPond (i.e. mainly Guile).” Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 05.04.2016 11:55, David Kastrup wrote: That is because many people who get a go at LilyPond (such as me) are not programmers, but musicians with little background knowledge about or experience with programming. Well, you seem to be faring pretty well. Oh, thank you. All I learnt was through working with LilyPond, and through you folks on the lists :-) Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 04-04-16 23:58, David Sumbler wrote: I have been using Lilypond for a few years now (but admittedly there are always periods of weeks or months at a time when I haven't touched it, which of course makes things much more difficult to retain). I still find the whole thing rather cryptic, and I do think that Bernard's remark about Godolvsky errors is perceptive and relevant. A few of the replies that have been given imply that things are pretty obvious when, for some, they simply are not. When one is very familiar with and well-immersed in a subject, it is often hard or impossible to understand what another intelligent person finds so obscure or difficult about it. Hi David and others, Thanks for your understanding. I wanted to stop. It took to much time for me with to less results. But the overwhelming responses made me doubt. You all spend a lot of time to help me, and even responded when I decided to quite using Lilypond. In general your response was positive and constructive. The code suggestions I got mostly just worked. But then I wanted to alter a minor item (I thought) and that influenced the code. I did not get grip on Lilypond. What I do is not wanting ask you for every detail. That takes to much of your and mine time. That said I still have positive feelings about Lilypond and this usersgroup. I have read all your replies. But did not check the given examples. I lost the feeling it could solve my problem, especially when if I made a minor change into those examples. My remarks : The Coldosky error is an important error. That knowledge control the way I want to work. It is a feed back mechanism. Playing African music like Djembe is a not written music. So everything has to be done from the start. Without the basic experience with other instruments and music notation. In the exceptional case someone does write Africa Djembe music down, it is very slovenly. But it written down by a Djembe teacher who can play Djembe well, and as student you can not play well. So the teacher is all ways right, even is he is wrong. The only way to check this Coldosky error to generate Djembe sound using midi and a Djembe soundfont. It the music is written down with an a wrong note, the sound will be improper, and the teacher will hear this himself. So there is a feedback to improve quality. Knowing the existence of the Coldosky error, can help to prevent it. With this feedback the note's can be written down as it should be, and it can be used to play from. An other problem are those, whole playing Djembe, are amateurs, who turn their head away for something which looks like written music. So if music is written down, it should be as easy as possible. Realy, realy easy. Do not under estimate the fear for written music. It is to complex for them, they feel, to understand. The next thing when practise, the midi sound can be played for exercise in a very low tempo. And slowly increasing when there is more experience. When even further you can let the sound of others Djembe play with midi, and play your own track yourself. Ideal for practice. Midi supports, and associated programs, like f.e. LMMS, does support this all. It is just important to generate the correct midi file, with Lilypond. That was the reason for a special Djembe notation, which is possible in Lilypond. It is no luxery, just a requirement to be used. To learn to play Djembe. In the same time it can be a help to prevent the loss of some African music, just because the fact it is not written down. The African youth does not play the original rhythms any more. This background is important to understand my choices. Some replies on the response : Goldosky error is important here, as a similarity. If you read that careful you often have implicit knowledge, of which you are surprised the other does not have that knowledge. Only the mistake made by the other might be an indication there is some implicit knowledge involved. I do not want to be be an advanced Lilypond user. I just want to use it. And when ready only the note's of a different rhythm changes. Noeck gave me the syntax of a statement. I really did like that. That gave me much information. Johannes Waldman mention the mental modal. Lilypond is no Object orientation programming but a functional language. Nothing wrong with that, but very important to know. That interpretation is important to get an idea of the code. As said, you, David Sumbler did understood the Coldosky error. You suggested to improve the manual with a Lilypond specialist. I would add to this, only together with a newbie, again to prevent to Coldosky error. Just an HTML page(s) with a statement. And with that statement a hyper link to dig into that statement for details. With syntax (for programmers) with example working code, AND with example mistakes. And why this is a mistake. If a mistake is often made in this newsgroup it can be added. And so
Re: Lilypond structure / implicit - explicit / with statement
Simon Albrechtwrites: > On 04.04.2016 22:19, Johannes Waldmann wrote: >> The docs do make considerable effort to explain, e.g., >> http://lilypond.org/doc/v2.18/Documentation/learning/contexts-and-engravers >> . >> If at all, I might criticize this for being in the wrong order: >> 2. Common Notation, 3. Fundamental Concepts - but how can we >> use or learn a language (syntax, notation) without knowing >> its underlying semantical model first? > > That is because many people who get a go at LilyPond (such as me) are > not programmers, but musicians with little background knowledge about > or experience with programming. Well, you seem to be faring pretty well. > It seems that a majority of LilyPond users are either music > professionals with a knack for logics and programming, or (active or > retired) programmers who are hobby musicians. It’s hard to satisfy > both at once. Not really, but improvements for one are often not tangible benefits for the other, at least initially. Matching both targets is the art of program design. That's a modern form of counterpoint. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
David Sumblerwrites: > I have been using Lilypond for a few years now (but admittedly there > are always periods of weeks or months at a time when I haven't touched > it, which of course makes things much more difficult to retain). > > I still find the whole thing rather cryptic, It's not cryptic as much as complex. Scheme is an integral part of LilyPond's user interface, and Scheme is a general-purpose programming language that's not particularly cherished even among programmers, partially because its single-minded use of punctuation (parens are basically all there is) does not really match the way in which we structure natural text in modern Western languages (the ancient Greek would likely have found little wrong in just running everything together in one block). If you are not on top of the underlying complexity, you need to follow instructions and recipes and conventions. There is nothing wrong with that, but the more complexity and exceptions bleed into the recipes, and the less those recipes appear to follow a pattern, the harder it becomes to be comfortable working with the system. The main question people ask themselves is "what's in it for me?". And what's in it is that LilyPond is very flexible in the things it can be made to solve automatically. This pays off in the form of people being able to _help_ others like on this mailing list. But also in the form of prepackaged functionality. > I myself have even had thoughts lately of cutting my losses, > installing a DOS emulator and going back to using Score! I can't > remember much about how Score is used, but I do remember that I > published quite a number of arrangements and compositions in the late > '90s using Score, and that getting to grips with it was a fraction of > the effort I have needed (and still need) to understand how to do > things in Lilypond. Yet Score's output is commonly regarded still as > pretty much first-rate. Doing things like piano extracts and partiture and transpositions from the same sources (but, for example, employing different accidental styles) is going to be more trouble, I'd guess. LilyPond talks more about the music itself rather than the typesetting of it. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
David Wrightwrites: > It's interesting to compare this structure with NM5.1.1 where \score > is the topmost context and StaffGroups are "top-level" contexts. > > And why book, score and not Book, Score? You mean \book and \score. Because those are elements of LilyPond's syntax, not context names. > And why not \new Score? There is nothing wrong with \new Score but it's not more than an (intermediate) context. If you want to use it with \with, you'll actually write it. If you want to spell out implied contexts, you are free to write something like \score { \context Global \new Score \new Staff \new Voice { c' d' e' f' } } > And, if you actually *do* write \new Score, why does the parser object > to its \layout command; but if you now delete the \layout command, > why does the parser not object to \new Score any more? Because you are free to write any music at top level, including \new Whatever. But that does not magically change the syntax or allow \layout to be inserted into music. Just because some context is named Score does not make it special syntactically. The Global context _is_ special semantically in that it gets created whenever music is interpreted (whether explicitly wrapped in \score or not). But pretty much anything else is a consequence of the context hierarchies defined in ly/engraver-init.ly. > Does LP have any display functions? (I mean like \the in TeX.) > For example, if mus = { a b c d }, I can render it and read the > music from the score, but how would I type\mus > and get > => { a b c d } > displayed in the LP output stream? Or how about > LyricText.font-size > => -3 > LyricText > font-size => -3 font-shape => 'italic ... etc. > > I'm almost reluctant to ask a question like this, > having recently reread the thread starting at > http://lists.gnu.org/archive/html/lilypond-user/2016-02/msg00700.html Take a look at \displayMusic, \displayLilyMusic, \displayScheme. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On Tue 05 Apr 2016 at 01:04:40 (+0200), Thomas Morley wrote: > 2016-04-04 23:58 GMT+02:00 David Sumbler: > > > > Just a thought - perhaps one day somebody who understands Lilypond well > > might write a section for the docs, starting with the basic > > Well, the full quote: > > LilyPond treats input like this: > > \relative { > c''4 a d c > } > > as shorthand for this: > > \book { > > \score { > > \new Staff { > > \new Voice { > > \relative { > > c''4 a b c > > } > > } > > } > > \layout { } > > } > > } > > structure shown in LM3.1.1 (what happened to \bookpart I wonder) ... and StaffGroup. It's interesting to compare this structure with NM5.1.1 where \score is the topmost context and StaffGroups are "top-level" contexts. And why book, score and not Book, Score? And why not \new Score? And, if you actually *do* write \new Score, why does the parser object to its \layout command; but if you now delete the \layout command, why does the parser not object to \new Score any more? > The example shows how LilyPond treats the input. > > If you do: > > bk = > \book { > \score { > \new Staff { > \new Voice { > \relative { > c''4 a b c > } > } > } > \layout { } > } > } If LilyPond had an IDE, it might well start off with something looking rather like that. Pressing, say, F1 at any point might give you suggestions as to what could appear there. Kind of syntax highlighting on steroids. > #(write-me "book? " (ly:book? bk)) > #(write-me "book-parts present: " (ly:book-book-parts bk)) > > You'll se that _no_ bookparts are created. So the example _is_ complete. > Why mention bookpart if not present, same for other stuff like > ChoirStaff, ChordNames, DrumVoice, etc, etc > > Btw, bookparts _are_ books. See: > bkprt = > \bookpart { \score { \new Staff { cisis'1 } } } > > #(write-me "book? " (ly:book? bkprt)) > > They are differently treated, though... > > > In general I think we would do our users a favor to emphasize the > recommendation to use the various display-functions more prominently. > > I do it all the time, sometimes writing special ones, like earlier in > this thread. > If I don't understand things, I first display them, always, sometimes > every little detail... > Works great form me. Does LP have any display functions? (I mean like \the in TeX.) For example, if mus = { a b c d }, I can render it and read the music from the score, but how would I type\mus and get => { a b c d } displayed in the LP output stream? Or how about LyricText.font-size => -3 LyricText font-size => -3 font-shape => 'italic ... etc. I'm almost reluctant to ask a question like this, having recently reread the thread starting at http://lists.gnu.org/archive/html/lilypond-user/2016-02/msg00700.html Cheers, David. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
2016-04-04 23:58 GMT+02:00 David Sumbler: > > Just a thought - perhaps one day somebody who understands Lilypond well > might write a section for the docs, starting with the basic Well, the full quote: LilyPond treats input like this: \relative { c''4 a d c } as shorthand for this: > \book { > \score { > \new Staff { > \new Voice { > \relative { > c''4 a b c > } > } > } > \layout { } > } > } > structure shown in LM3.1.1 (what happened to \bookpart I wonder) The example shows how LilyPond treats the input. If you do: bk = \book { \score { \new Staff { \new Voice { \relative { c''4 a b c } } } \layout { } } } #(write-me "book? " (ly:book? bk)) #(write-me "book-parts present: " (ly:book-book-parts bk)) You'll se that _no_ bookparts are created. So the example _is_ complete. Why mention bookpart if not present, same for other stuff like ChoirStaff, ChordNames, DrumVoice, etc, etc Btw, bookparts _are_ books. See: bkprt = \bookpart { \score { \new Staff { cisis'1 } } } #(write-me "book? " (ly:book? bkprt)) They are differently treated, though... In general I think we would do our users a favor to emphasize the recommendation to use the various display-functions more prominently. I do it all the time, sometimes writing special ones, like earlier in this thread. If I don't understand things, I first display them, always, sometimes every little detail... Works great form me. Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On Mon 04 Apr 2016 at 12:46:37 (+0200), Bernard wrote: > On 03-04-16 22:56, David Kastrup wrote: > >Bernardwrites: > >>That does help. I found out \with is a very special statement. > >Not really. \with can be part of other constructs, just like "else" can > >be part of other constructs in many programming languages (including > >Scheme). It is not a "statement" at all. > That does help a lot. Now I understand why there can not be anything > before /with. > > > >>It influence what happens before the statement, it must be executed > >>just after \new . That is the reason why my examples 4 and 5 did not > >>work. > >>And it influence what happens after the statement. If within the Staff > >>not a additional Staff property can be set. > >> > >>No wonder it confuses me. > >\with introduces "context modifications". They are basic expressions in > >that they can be stored in variables and passed to functions, but to > >take effect, they need to be applied to an actually created context, and > >there are various syntactic constructs for doing that. > > > >They "influence what happens after the statement" like any modification > >to anything. Their influence is restricted to contexts they are applied > >to (possibly via layout or context definitions or wrapped into other > >context modifications). > > > I still do not get it all. By the way, I am my self a Python > programmer and object orientation in known to me. [...] Your example is incomprehensible to me as I've never used drum mode. It's also large enough to obfuscate the problem. Simplifying the code: %% mus = { e' f' g' a' } \markup { with section } \score { \new Staff \with { \override NoteHead.color = #red } \mus } \markup { with section } \score { \new Staff \with { \override NoteHead.color = #red } { e' f' g' a' } } %% That worked. The \with { xxx } modified the music. %% Then you took out the \with so the { xxx } now becomes the music. %% (Music expressions can include context modifications as well as notes.) %% Think of python's positional parameters and keyword parameters. %% You start with ( keyword=argument, parm ) but you remove "keyword=" %% so you're left with ( argument, parm ) and "argument" becomes a %% positional parameter instead. %% In LilyPond, the "first positional parameter" is the music. %% Most LilyPond elements consist of either \element SINGLE-value %% or \element { SINGLE arbitrarily complicated expression } %% and not \element { argument } { parm } %% So LilyPond does not allow a "second positional parameter". \markup { without the use of the with section } %% generate error \score { \new Staff { \override NoteHead.color = #red } \mus } \markup { without the use of the with section } %% generate error \score { \new Staff { \override NoteHead.color = #red } { e' f' g' a' } } %% Your music now becomes treated as illegal source code because %% it's syntactically a "second positional parameter". %% However, if you move the music in with the "first positional parameter": \markup { without the use of the with section } \score { \new Staff { \override NoteHead.color = #red \mus } } \markup { without the use of the with section } \score { \new Staff { \override NoteHead.color = #red e' f' g' a' } } \markup { without the use of the with section } \score { \new Staff { e' f' \override NoteHead.color = #red g' a' } } %% If you really want a python example; when you "skipped the with section" by deleting "\with" what you did was like changing: with fileinput.input(args, mode='rb') as theinput: for bytestring in theinput: nbytesscanned += len(bytestring) linenum += 1 for k in bytestring: maxchar = max(maxchar, k) if k not in firsts: firsts[k] = linenum counts[k] = counts.setdefault(k,0) + 1 into: fileinput.input(args, mode='rb') as theinput: for bytestring in theinput: nbytesscanned += len(bytestring) linenum += 1 for k in bytestring: maxchar = max(maxchar, k) if k not in firsts: firsts[k] = linenum counts[k] = counts.setdefault(k,0) + 1 Python now has no idea what to do with the word "as". Cheers, David. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 04.04.2016 22:19, Johannes Waldmann wrote: The docs do make considerable effort to explain, e.g., http://lilypond.org/doc/v2.18/Documentation/learning/contexts-and-engravers . If at all, I might criticize this for being in the wrong order: 2. Common Notation, 3. Fundamental Concepts - but how can we use or learn a language (syntax, notation) without knowing its underlying semantical model first? That is because many people who get a go at LilyPond (such as me) are not programmers, but musicians with little background knowledge about or experience with programming. It seems that a majority of LilyPond users are either music professionals with a knack for logics and programming, or (active or retired) programmers who are hobby musicians. It’s hard to satisfy both at once. Yours, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On Mon, 2016-04-04 at 16:12 -0400, lilypond-user-requ...@gnu.org wrote: > > From: Noeck <noeck.marb...@gmx.de> > > To: lilypond-user@gnu.org > > Subject: Re: Lilypond structure / implicit - explicit / with > > statement > > Date: Mon, 4 Apr 2016 22:11:51 +0200 > > > > Would the table in the previous mail be helpful for the docs here? > > http://lilypond.org/doc/v2.19/Documentation/notation/overview-of-modifying-properties > > > > I could write it and some text around it if there is a general feeling > > that it would help. > > > > Cheers, > > Joram I think it would help. I have followed this thread with great interest: I have a lot of sympathy with Bernard. I have been using Lilypond for a few years now (but admittedly there are always periods of weeks or months at a time when I haven't touched it, which of course makes things much more difficult to retain). I still find the whole thing rather cryptic, and I do think that Bernard's remark about Godolvsky errors is perceptive and relevant. A few of the replies that have been given imply that things are pretty obvious when, for some, they simply are not. When one is very familiar with and well-immersed in a subject, it is often hard or impossible to understand what another intelligent person finds so obscure or difficult about it. I myself have even had thoughts lately of cutting my losses, installing a DOS emulator and going back to using Score! I can't remember much about how Score is used, but I do remember that I published quite a number of arrangements and compositions in the late '90s using Score, and that getting to grips with it was a fraction of the effort I have needed (and still need) to understand how to do things in Lilypond. Yet Score's output is commonly regarded still as pretty much first-rate. Of course, different people have different learning styles, and for me I think that part of the problem with Lilypond is that there is no very clear, organized "bottom-up" description of how it works and how to use it. Like Bernard, I suspect, I would probably have had more success in getting to grips with Lilypond if I had had a more thorough grounding in the fundamentals at the very start. I'm the sort of person who finds that modern (human)-language-teaching methods leave me stranded very quickly: I need to learn the present tense of the verb "to be" and the principles of the orthography of a language at the very beginning. Just a thought - perhaps one day somebody who understands Lilypond well might write a section for the docs, starting with the basic \book { \score { \new Staff { \new Voice { \relative { c''4 a b c } } } \layout { } } } structure shown in LM3.1.1 (what happened to \bookpart I wonder) and gradually expanding that, as well as showing how and when some elements can be omitted. The different ways of changing context and object properties could be detailed as well. David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Colin Campbellwrites: > On 16-04-04 02:57 PM, David Kastrup wrote: >> Noeck writes: >> >>> … and enjoy your climbing! I hope I don't produce much more >>> misinformation until you are safely back ;) >> Uh, I'm already back. I'm only enjoying the open spots on my fingertips >> now. They'll close up in the next few days, and in 10 days or so the >> fingers (mostly) will start peeling. >> > > You certainly seem to carry your scale exercises to new heights, > although I would have thought you more interested in the classical > repertoire than rock. The Classics actually don't do much for me, particularly not the Symphonic Classics. I'm mostly uninterested in stuff later than Baroque until something like mid-20th century. I'm currently working on Piazzolla, but if you look closely, that's actually counterpoint. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 16-04-04 02:57 PM, David Kastrup wrote: Noeckwrites: … and enjoy your climbing! I hope I don't produce much more misinformation until you are safely back ;) Uh, I'm already back. I'm only enjoying the open spots on my fingertips now. They'll close up in the next few days, and in 10 days or so the fingers (mostly) will start peeling. You certainly seem to carry your scale exercises to new heights, although I would have thought you more interested in the classical repertoire than rock. Cheers, Colin -- One of the advantages of being disorderly is that one is constantly making exciting discoveries. - A. A. Milne, From the Daryl R. Gibson collection ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Noeckwrites: > … and enjoy your climbing! I hope I don't produce much more > misinformation until you are safely back ;) Uh, I'm already back. I'm only enjoying the open spots on my fingertips now. They'll close up in the next few days, and in 10 days or so the fingers (mostly) will start peeling. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
… and enjoy your climbing! I hope I don't produce much more misinformation until you are safely back ;) Cheers, Joram ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Hi David, On 04.04.2016 22:22, David Kastrup wrote: > Noeckwrites: > >> Alternatively, you can put this into a layout block: >> >> \layout { >> \context { >> \Staff >> clefPosition = 2 >> } >> } >> %or >> \layout { >> \set Staff.clefPosition = 2 >> } > > This is not the same. I know. I wanted to keep it as short as possible, but you are right, it is worth mentioning. >> in layout block (variant 1): >> \layout { \context { \Ctx | \layout { \context { \Ctx >> prop = val } | \override obj.prop = val } btw: } missing here >> in layout block (variant 2): >> \layout { \set Ctx.prop = val } | \layout{\override Ctx.obj.prop = val } > > That's not a variant but something quite more encompassing. Well, obviously, the docs did not help to find the most important answers first in this particular case/thread. That's why I tried to summarize what I consider minimal knowledge for property tweaking. Not providing the full picture but only the "most important" parts, is always dangerous. But my aim was not to replacate several chapters of the manual but rather a practical concise form which is not found in the manual. I still think that conciseness is a value in itself (it is a fine line, though). Back to the table, I probably should have omitted 'variant 2' as it is indeed a bit dangerous until one knows what happens. Cheers, Joram ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Noeckwrites: > Alternatively, you can put this into a layout block: > > \layout { > \context { > \Staff > clefPosition = 2 > } > } > %or > \layout { > \set Staff.clefPosition = 2 > } This is not the same. The first affects only the "Staff" context definition. The second also affects _all_ contexts aliased to "Staff", namely "TabStaff" and "DrumStaff" and "RhythmicStaff" and "FretBoards" and "ChordNames" and "Devnull" and "NullVoice" (!) and "VaticanaStaff" and "GregorianTranscriptionStaff" and "MensuralStaff" and "PetrucciStaff" and "KievanStaff". For most of those, you would _not_ want to change their default clefPosition. Putting \set/\override straight into a \layout definition has more thorough effects than in a particular context definition. Sometimes, that's what you want. Often, it's not. > in with block: > \with { prop = val }| \with { \override Ctx.obj.prop = val } > > in layout block (variant 1): > \layout { \context { \Ctx | \layout { \context { \Ctx > prop = val } | \override obj.prop = val } > > in layout block (variant 2): > \layout { \set Ctx.prop = val } | \layout{\override Ctx.obj.prop = val } That's not a variant but something quite more encompassing. Note that "Ctx." can be left off in which case "Bottom." is implied as usual. Since "Bottom." is only ever an alias, addressing only the named context would confuse people if they use something like "\omit Accidental" in the expectation that it would omit accidentals. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Re: Lilypond structure / implicit - explicit / with statement
interesting discussion! > My ultimate question boils down to how to assign > a value to a property. That should not even be a question. That ("should not be a question") depends on the mental model. Why do you assume that a property is assignable, or in fact that a (sub)program should consist of (state-changing) statements? I guess because of your OO programming background (you mentioned it). But in (pure) functional programming, there are no assignments (no state) at all, and that happens to be my preferred mental model. This is not a question of right or wrong - history shows that both models are useful. The question is to convey to the user the model that was used in the design of the language/system. You described this as "making implicit knowledge explicit". The docs do make considerable effort to explain, e.g., http://lilypond.org/doc/v2.18/Documentation/learning/contexts-and-engravers . If at all, I might criticize this for being in the wrong order: 2. Common Notation, 3. Fundamental Concepts - but how can we use or learn a language (syntax, notation) without knowing its underlying semantical model first? E.g., my lilypond learning problem (I think) is to find out how much of lilypond is pure data (music as an expressions, nested by sequential and parallel composition) and how much is procedural (music as execution of events, that is, of statements) and when and how to switch between these models (if at all). - J. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Would the table in the previous mail be helpful for the docs here? http://lilypond.org/doc/v2.19/Documentation/notation/overview-of-modifying-properties I could write it and some text around it if there is a general feeling that it would help. Cheers, Joram ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Hi Bernard, I would like to try and explain it in other words as the manual: music with implicit voice and staff: { c' } music with explicit staff and implicit voice: \new Staff { c' } adding a with statement: \new Staff \with { clefPosition = 2 } { c' } Please note here: There must be no { after Staff, because that would start a music expression. The braces are not just for grouping things but they start a music expression and \with must come before the music starts. Think of it as a function, if the first argument starts with { it is music and not a \with block: \new Staff \with { clefPosition = 2 } { c' } ^^ ^^ ^^ function optional argument (not music) music Alternatively, you can put this into a layout block: \layout { \context { \Staff clefPosition = 2 } } %or \layout { \set Staff.clefPosition = 2 } ## Contexts and objects Contexts are different from graphical objects and their properties (prop) are changed differently (explained in the docs). Just a summary here (val means value): contexts (Staff, Voice, …) Ctx | graphical objects (Clef, …) obj --- in music: { \set Ctx.prop = val } | { \override Ctx.obj.prop = val } in with block: \with { prop = val }| \with { \override Ctx.obj.prop = val } in layout block (variant 1): \layout { \context { \Ctx | \layout { \context { \Ctx prop = val } | \override obj.prop = val } in layout block (variant 2): \layout { \set Ctx.prop = val } | \layout{\override Ctx.obj.prop = val } td;dr: (1) be careful with {} (2) read the input as functions with some optional arguments (3) context properties and object properties are different HTH, Joram PS: I know you said you won't try any longer, but perhaps this will help someone. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 04.04.2016 21:54, David Kastrup wrote: The only "inconsistency" I am able to see is that context modifications (like context definitions) omit a context name for their sets/overrides, and that they use assignment syntax without \set unlike to how context properties are set inside of actual music. The first is rather obvious (how could a context modification apply to anything but the respective context itself?). The second is kind of a wart due to a mixture of historical and technical reasons. Why a wart? It’s neither ugly nor a nuisance, quite the opposite. Yours, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Bernardwrites: > On 04-04-16 18:35, David Kastrup wrote: >> Bernard writes: >> >>> >>> I think I am getting quite close now. Thanks, >> I have no idea what you think you are doing but I have severe doubts >> that you are getting close to anything useful. It looks to me like you >> are just randomly putting syntactic entities into a bag and shake. >> >> Have you read through the Learning Manual? It should tell you how >> LilyPond organizes its input. > > Thanks David and others, but I give up. > For your info I did read the manual, much more then I wanted to. > My ultimate question boils down to how to assign a value to a > property. That should not even be a question. With \set / \override, and you actually had working code doing just that. For some properties, it might make sense to set them right at the creation of a context rather than afterwards (like instrument names or number of staff lines). For those you use context modifications spelled with \with which may contain assignments or \override inside. If you just had followed the code examples given for setting properties in the manual, all would have worked fine. > Lilypond advertise itself being easy, and it is. > {c'} does create output. > Even a bit more complex examples are made. > This because code is generated implicit. But at the same time it hides > what is behind, creating confusing. > You have implicit knowledge and explicit knowledge. Using implicit > knowledge creates confusing. > As being new to Lilypond I might see inconsistencies, which are, for > those with many experience not noticeable any more. > I might learn those inconsistencies but first I have to comprehend them. > > For me, when someone come new to work for a company, the first two > weeks are most valuable. He can see things nobody else can see, who > do work their many years. Use those info or it be lost. > > Sorry but just assigning a value to a property, when then property is > known and the value is known, should not be such a hassle. It isn't. Nobody except yourself knows why you chose _not_ to stick with the working code for that but rather walk through arbitrary permutations of syntactic elements. > I thought I was close. But you are right, I am not. And I am not > spending more time to just assign a value to a property. I have no idea why you did not just stick with the code that worked. Instead you invented and listed a number of variations that didn't, for a number of reasons that are not actual inconsistencies. The only "inconsistency" I am able to see is that context modifications (like context definitions) omit a context name for their sets/overrides, and that they use assignment syntax without \set unlike to how context properties are set inside of actual music. The first is rather obvious (how could a context modification apply to anything but the respective context itself?). The second is kind of a wart due to a mixture of historical and technical reasons. But that's pretty much it. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Hi Bernard, I’m sorry you’ve had such difficulty learning Lilypond. On Apr 4, 2016, at 3:20 PM, Bernardwrote: > My ultimate question boils down to how to assign a value to a property. That > should not even be a question. The main problem you’re having, I think, is that there are different ways of setting a property, depending on exactly where the setting is being done. With flexibility comes complexity, unfortunately — that’s an almost universal tradeoff in machine design. Best regards, Kieren. Kieren MacMillan, composer ‣ website: www.kierenmacmillan.info ‣ email: i...@kierenmacmillan.info ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 04-04-16 18:35, David Kastrup wrote: Bernardwrites: I think I am getting quite close now. Thanks, I have no idea what you think you are doing but I have severe doubts that you are getting close to anything useful. It looks to me like you are just randomly putting syntactic entities into a bag and shake. Have you read through the Learning Manual? It should tell you how LilyPond organizes its input. Thanks David and others, but I give up. For your info I did read the manual, much more then I wanted to. My ultimate question boils down to how to assign a value to a property. That should not even be a question. Lilypond advertise itself being easy, and it is. {c'} does create output. Even a bit more complex examples are made. This because code is generated implicit. But at the same time it hides what is behind, creating confusing. You have implicit knowledge and explicit knowledge. Using implicit knowledge creates confusing. As being new to Lilypond I might see inconsistencies, which are, for those with many experience not noticeable any more. I might learn those inconsistencies but first I have to comprehend them. For me, when someone come new to work for a company, the first two weeks are most valuable. He can see things nobody else can see, who do work their many years. Use those info or it be lost. Sorry but just assigning a value to a property, when then property is known and the value is known, should not be such a hassle. It has similarities to a Goldovsky-error http://www.joshuakennon.com/mental-model-goldovsky-errors . Similarities but not equal. You all spend a lot of time to help me. I spend a lot of time believing Lilypond is easy to use and to customize. I thought I was close. But you are right, I am not. And I am not spending more time to just assign a value to a property. But still, thank you all for your efforts. Greetings, Bernard At any rate, \new DrumStaff is optionally followed by a context modification before the single music expression it typesets in the DrumStaff context. In the above case, that music expression is { \override ... djembe) }, so \djEen has nothing whatsoever to do with the DrumStaff and is just a spurious expression in the \score. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
> On Apr 4, 2016, at 6:46 AM, Bernardwrote: > > I have attached some more real live code using /with and and example I tried > to skip the /with section and assign properties directly, which fails. Here’s how to fix your example (without \with) that was not working: \score { \new DrumStaff { \override DrumStaff.StaffSymbol.line-count = #3 \set DrumStaff.instrumentName = #"Djembe 2" \set DrumStaff.drumStyleTable = #(alist->hash-table djembe) \djEen } } As others have mentioned, reading the Learning Manual is a good idea, and should answer many of your questions. http://lilypond.org/doc/v2.18/Documentation/learning/index.html HTH, -Paul ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Bernardwrites: > On 04-04-16 16:51, Simon Albrecht wrote: >> On 04.04.2016 12:46, Bernard wrote: >>> I have attached some more real live code using /with and and >>> example I tried to skip the /with section and assign properties >>> directly, which fails. >> >> instrumentName, drumStyleTable are context properties. Inside >> music, these are set with the \set command, e.g. >> \set DrumStaff.instrumentName = "foo" >> Note that a string doesn’t need the # before. >> >> HTH, Simon >> > Hi Simon, > > Thanks, I could do set the properties. > But when the voice is called I get a Error : unexpected MUSIC_IDENTIFIER > > when using "\with" I did not get this error. > > \score { > \new DrumStaff { > \override DrumStaff.StaffSymbol.line-count = #3 > \set DrumStaff.instrumentName = "Djembe 2" > \set DrumStaff.drumStyleTable = #(alist->hash-table djembe) > } > \djEen > } > > I think I am getting quite close now. Thanks, I have no idea what you think you are doing but I have severe doubts that you are getting close to anything useful. It looks to me like you are just randomly putting syntactic entities into a bag and shake. Have you read through the Learning Manual? It should tell you how LilyPond organizes its input. At any rate, \new DrumStaff is optionally followed by a context modification before the single music expression it typesets in the DrumStaff context. In the above case, that music expression is { \override ... djembe) }, so \djEen has nothing whatsoever to do with the DrumStaff and is just a spurious expression in the \score. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Hi Bernard, > \score { > \new DrumStaff { > \override DrumStaff.StaffSymbol.line-count = #3 > \set DrumStaff.instrumentName = "Djembe 2" > \set DrumStaff.drumStyleTable = #(alist->hash-table djembe) > } > \djEen > } If, like me, you prefer separating musical content from presentation as much as possible, maybe modify the context instead: \layout { \context { \DrumStaff \override StaffSymbol.line-count = #3 instrumentName = "Djembe 2" drumStyleTable = #(alist->hash-table djembe) } } \score { \new DrumStaff \djEen } Hope this helps! Kieren. Kieren MacMillan, composer ‣ website: www.kierenmacmillan.info ‣ email: i...@kierenmacmillan.info ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 04.04.2016 17:36, Bernard wrote: On 04-04-16 16:51, Simon Albrecht wrote: On 04.04.2016 12:46, Bernard wrote: I have attached some more real live code using /with and and example I tried to skip the /with section and assign properties directly, which fails. instrumentName, drumStyleTable are context properties. Inside music, these are set with the \set command, e.g. \set DrumStaff.instrumentName = "foo" Note that a string doesn’t need the # before. HTH, Simon Hi Simon, Thanks, I could do set the properties. But when the voice is called I get a Error : unexpected MUSIC_IDENTIFIER when using "\with" I did not get this error. \score { \new DrumStaff { \override DrumStaff.StaffSymbol.line-count = #3 \set DrumStaff.instrumentName = "Djembe 2" \set DrumStaff.drumStyleTable = #(alist->hash-table djembe) } \djEen } Are you familiar with the whole of the Learning Manual? If not, you should read it thoroughly. \score {} can only contain /one/ music expression. Your example has two music expressions, the second without any link to the first. You need to either bind them together as sequential {} or simultaneous <<>> music – in this case it doesn’t really matter which. HTH, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 04-04-16 16:51, Simon Albrecht wrote: On 04.04.2016 12:46, Bernard wrote: I have attached some more real live code using /with and and example I tried to skip the /with section and assign properties directly, which fails. instrumentName, drumStyleTable are context properties. Inside music, these are set with the \set command, e.g. \set DrumStaff.instrumentName = "foo" Note that a string doesn’t need the # before. HTH, Simon Hi Simon, Thanks, I could do set the properties. But when the voice is called I get a Error : unexpected MUSIC_IDENTIFIER when using "\with" I did not get this error. \score { \new DrumStaff { \override DrumStaff.StaffSymbol.line-count = #3 \set DrumStaff.instrumentName = "Djembe 2" \set DrumStaff.drumStyleTable = #(alist->hash-table djembe) } \djEen } I think I am getting quite close now. Thanks, Greetings Bernard ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 04.04.2016 12:46, Bernard wrote: I have attached some more real live code using /with and and example I tried to skip the /with section and assign properties directly, which fails. instrumentName, drumStyleTable are context properties. Inside music, these are set with the \set command, e.g. \set DrumStaff.instrumentName = "foo" Note that a string doesn’t need the # before. HTH, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 03-04-16 22:56, David Kastrup wrote: Bernardwrites: Hi Paul, That does help. I found out \with is a very special statement. Not really. \with can be part of other constructs, just like "else" can be part of other constructs in many programming languages (including Scheme). It is not a "statement" at all. That does help a lot. Now I understand why there can not be anything before /with. It influence what happens before the statement, it must be executed just after \new . That is the reason why my examples 4 and 5 did not work. And it influence what happens after the statement. If within the Staff not a additional Staff property can be set. No wonder it confuses me. \with introduces "context modifications". They are basic expressions in that they can be stored in variables and passed to functions, but to take effect, they need to be applied to an actually created context, and there are various syntactic constructs for doing that. They "influence what happens after the statement" like any modification to anything. Their influence is restricted to contexts they are applied to (possibly via layout or context definitions or wrapped into other context modifications). I still do not get it all. By the way, I am my self a Python programmer and object orientation in known to me. The example of Thomas Morly with his house with rooms is all in line with object orientation and setting values of properties. But still I am missing something. I have attached some more real live code using /with and and example I tried to skip the /with section and assign properties directly, which fails. Thanks very much for all your good work. With regards, Bernard \version "2.18.2" #(define djembe '( (dbassdefault #f -2) (dbassmutedefault "stopped"-2) (dbassopendefault "open" -2) (dopendefault #f 0) (dopenmutedefault "stopped"0) (dopenopendefault "open" 0) (dslapdefault #f 2) (dslapmutedefault "stopped"2) (dslapopendefault "open" 2) (sidestick cross #f -4))) % no abbrevation for the open variant, it is hardly used drumPitchNames.dbass = #'dbass drumPitchNames.dba= #'dbass % db seems to be in use drumPitchNames.dbassmute = #'dbassmute drumPitchNames.dbm= #'dbassmute drumPitchNames.dbassopen = #'dbassopen drumPitchNames.dopen = #'dopen drumPitchNames.do = #'dopen drumPitchNames.dopenmute = #'dopenmute drumPitchNames.dom= #'dopenmute drumPitchNames.dopenopen = #'dopenopen drumPitchNames.dslap = #'dslap drumPitchNames.ds = #'dslap drumPitchNames.dslapmute = #'dslapmute drumPitchNames.dsm= #'dslapmute drumPitchNames.dslapopen = #'dslapopen % assign to full name, assign to abbrevation does not work. midiDrumPitches.dbass = g midiDrumPitches.dopen = a midiDrumPitches.dslap = b midiDrumPitches.dbassmute = fis midiDrumPitches.dopenmute = gis midiDrumPitches.dslapmute = ais djEen = \drummode { dba4 do } % with with section of context % Line count and instrumentname correct processed \markup { with section } \score { \new DrumStaff \with { \override StaffSymbol.line-count = #3 instrumentName = #"Djembe 1" drumStyleTable = #(alist->hash-table djembe) } \djEen } \markup { without the use of the with section } % generate error \score { \new DrumStaff { \override DrumStaff.StaffSymbol.line-count = #3 DrumStaff.instrumentName = #"Djembe 2" DrumStaff.drumStyleTable = #(alist->hash-table djembe) } \djEen } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
2016-04-03 21:02 GMT+02:00 Bernard: > On 03-04-16 18:33, Thomas Morley wrote: >> >> 2016-04-03 16:59 GMT+02:00 Bernard : >> >>> 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) >> #> #> #> #> #> #> #> #> #> #> >> >> The Context-parent-tree: >> (Only contexts of type Global, Score, Staff and Voice are printed) >> #> #> #> # > > 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 ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Bernardwrites: > On 03-04-16 17:57, Paul Morris wrote: >>> On Apr 3, 2016, at 11:53 AM, Paul Morris wrote: >>> >>> This should help: >>> http://lilypond.org/doc/v2.18/Documentation/notation/changing-context-default-settings#index-_005cwith-3 >> See also: >> http://lilypond.org/doc/v2.18/Documentation/notation/modifying-context-plug_002dins#index-_005cwith >> >> -Paul > Hi Paul, > > That does help. I found out \with is a very special statement. Not really. \with can be part of other constructs, just like "else" can be part of other constructs in many programming languages (including Scheme). It is not a "statement" at all. > It influence what happens before the statement, it must be executed > just after \new . That is the reason why my examples 4 and 5 did not > work. > And it influence what happens after the statement. If within the Staff > not a additional Staff property can be set. > > No wonder it confuses me. \with introduces "context modifications". They are basic expressions in that they can be stored in variables and passed to functions, but to take effect, they need to be applied to an actually created context, and there are various syntactic constructs for doing that. They "influence what happens after the statement" like any modification to anything. Their influence is restricted to contexts they are applied to (possibly via layout or context definitions or wrapped into other context modifications). -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
2016-04-03 20:55 GMT+02:00 Bernard: > On 03-04-16 17:57, Paul Morris wrote: >>> >>> On Apr 3, 2016, at 11:53 AM, Paul Morris wrote: >>> >>> This should help: >>> >>> http://lilypond.org/doc/v2.18/Documentation/notation/changing-context-default-settings#index-_005cwith-3 >> >> See also: >> >> http://lilypond.org/doc/v2.18/Documentation/notation/modifying-context-plug_002dins#index-_005cwith >> >> -Paul > > Hi Paul, > > That does help. I found out \with is a very special statement. > > It influence what happens before the statement, it must be executed just > after \new . That is the reason why my examples 4 and 5 did not work. > And it influence what happens after the statement. If within the Staff not a > additional Staff property can be set. No!! To give an image. Think of a house. It is built in a certain way from the fundament up to the roof. (Ofcourse this house may have different rooms.) It likely contains furniture and other stuff. And ofcourse there may be people living in the house. Back to LilyPond. Replace house by Staff, The Staff-context is built from certain engravers. It is sorted among other context (you live in a city). Staff contains other settings as well, the furniture. And is parent to other contexts, p.e. Voices, the rooms. Replace there living people with music. If you write \new Staff \new Voice { c'1 } you have the note c' living in the Voice-context (the room), which is part of Staff (the house) If you want to change something for someone in a room (voice) you can apply tweaks/overrides/context-settings for them. Those are in general sort of temporarary \new Staff \new Voice { c'1 \override NoteHead.color = #red c' \revert NoteHead.color c' } If you want to change it for all people in the room one possibility is to add something to the furniture of the room, i.e. add something to the fundamental settings of said room (voice). \new Staff \new Voice \with { \override NoteHead.color = #red } { c'1 c' c' } Ofcourse this is revertable. \new Staff \new Voice \with { \override NoteHead.color = #red } { c'1 c' \revert NoteHead.color c' } If you want to change it for every room in the house, apply it to the house (staff) \new Staff \with { \override NoteHead.color = #red } \new Voice { c'1 c' \revert Staff.NoteHead.color c' } The difference is more obvious if you watch more than one room (voice): \new Staff << \new Voice \with { \override NoteHead.color = #red } { \voiceOne c'1 c' c' } \new Voice \with { \override NoteHead.color = #cyan } { \voiceTwo c1 c \revert NoteHead.color c } >> \new Staff \with { \override NoteHead.color = #red } << \new Voice \with { \override NoteHead.color = #green } { \voiceOne c'1 \revert NoteHead.color c' \revert Staff.NoteHead.color c' } \new Voice \with { \override NoteHead.color = #cyan } { \voiceTwo c1 \revert NoteHead.color c c } >> For testing such things I always use colors, they are not that invasive. Your own examples uses StaffSymbol-overrides which is bad, if you want to research things. You can't change one and the same grob on the fly. Every of your examples has only _one_ StaffSymbol-grob. So you can't see anything useful. HTH, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 03-04-16 18:33, Thomas Morley wrote: 2016-04-03 16:59 GMT+02:00 Bernard: 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. 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) # You are right, this does not help me. But I am surprised about you code. It does work but I have no idea how. Sometimes I am just searching in the wrong directions and then it is good that you or others point this out to me. Thanks very much. With regards Bernard Don't care about the Global-context, it's not really user accessable. Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 03-04-16 17:57, Paul Morris wrote: On Apr 3, 2016, at 11:53 AM, Paul Morriswrote: This should help: http://lilypond.org/doc/v2.18/Documentation/notation/changing-context-default-settings#index-_005cwith-3 See also: http://lilypond.org/doc/v2.18/Documentation/notation/modifying-context-plug_002dins#index-_005cwith -Paul Hi Paul, That does help. I found out \with is a very special statement. It influence what happens before the statement, it must be executed just after \new . That is the reason why my examples 4 and 5 did not work. And it influence what happens after the statement. If within the Staff not a additional Staff property can be set. No wonder it confuses me. Thanks for your help. Bernard ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
2016-04-03 16:59 GMT+02:00 Bernard: > 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. > 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) #https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
> On Apr 3, 2016, at 11:53 AM, Paul Morriswrote: > > This should help: > http://lilypond.org/doc/v2.18/Documentation/notation/changing-context-default-settings#index-_005cwith-3 See also: http://lilypond.org/doc/v2.18/Documentation/notation/modifying-context-plug_002dins#index-_005cwith -Paul ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
Hi Bernard, > On Apr 3, 2016, at 10:59 AM, Bernardwrote: > > All boils down to what is the \with statement. This should help: http://lilypond.org/doc/v2.18/Documentation/notation/changing-context-default-settings#index-_005cwith-3 I found that section by looking for “\with” in the notation reference index: http://lilypond.org/doc/v2.18/Documentation/notation/lilypond-index You can search that index page quickly by using your browsers “find” command to look for the command you’re interested in on that page. This approach has served me well for finding relevant documentation. HTH, -Paul ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 03-04-16 13:30, Simon Albrecht wrote: On 03.04.2016 08:15, Bernard wrote: I would like to comprehend Lilyponds structure. I read http://lilypond.org/doc/v2.18/Documentation/learning/contexts-explained and https://docs.fedoraproject.org/en-US/Fedora/16/html/Musicians_Guide/sect-Musicians_Guide-LilyPond-Syntax-Commands-Contexts.html That does seems logical. So if I comprehend right : Code implicit : {c'} Code explicit : \score { \new Staff { \new Voice {c'} } } Are similar. Not identical but similar. 1) Is that correct? Yes, that’s what is explained in the Learning Manual. 3) I would like to use and to be able to disable the \with statement. I don’t quite get what you want to do here. Please give more explanation, and an example. Ok Simon, I tried to solve my problem myself, if I had enough info. But that make it to abstract. Please see the attached examples. 1 + 2) The first two are clear now. 3) With a \with statement does execute as expected. 4) Does use the \with statement but within "{ }" This generate the error : unexpected \new 5) As 5 but "<< >>" Also generate an error 6) Does execute, but without a \with statement and without a voice 7) As 6 but with a voice, generate an error My real code is much more complicated. All boils down to what is the \with statement. That seems to be a very specific statement, which controls also what happens outside the statement. I have read http://lilypond.org/doc/v2.18/Documentation/notation/interpretation-contexts.en.html and associates pages. I assume it is related, but I do not really get it. If I could view, within an implicit context , like : {c'} the full explicit context like : \score { \new Staff { \new Voice {c'} } } That would help a lot for understanding (and bug fixing). I just want to comprehend this \with statement and contexts. Thanks for your help, Bernard \version "2.18.2" %1) Implicit {c'} %2) Explicit \score { \new Staff { \new Voice {c'} } } %3) Does run, using \with statement \score { \new Staff \with { \override StaffSymbol.line-count = #0 } \new Voice {c'} } % 4)Generate error, using {} arround \with statement \score { \new Staff { \with { \override StaffSymbol.line-count = #0 } } \new Voice {c'} } % 5) Generate error, using << and >> arround \with statement \score { \new Staff << \with { \override StaffSymbol.line-count = #0 } >> \new Voice {c'} } % 6) Does execute without \with statement and without voice \score { \new Staff { \override Staff.StaffSymbol.line-count = #0 } } % 7) Generate error, without \with statement \score { \new Staff { \override Staff.StaffSymbol.line-count = #0 } % generate unexpected \new \new Voice {c'} } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Lilypond structure / implicit - explicit / with statement
On 03.04.2016 08:15, Bernard wrote: I would like to comprehend Lilyponds structure. I read http://lilypond.org/doc/v2.18/Documentation/learning/contexts-explained and https://docs.fedoraproject.org/en-US/Fedora/16/html/Musicians_Guide/sect-Musicians_Guide-LilyPond-Syntax-Commands-Contexts.html That does seems logical. So if I comprehend right : Code implicit : {c'} Code explicit : \score { \new Staff { \new Voice {c'} } } Are similar. Not identical but similar. 1) Is that correct? Yes, that’s what is explained in the Learning Manual. 3) I would like to use and to be able to disable the \with statement. I don’t quite get what you want to do here. Please give more explanation, and an example. Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Lilypond structure / implicit - explicit / with statement
I would like to comprehend Lilyponds structure. I read http://lilypond.org/doc/v2.18/Documentation/learning/contexts-explained and https://docs.fedoraproject.org/en-US/Fedora/16/html/Musicians_Guide/sect-Musicians_Guide-LilyPond-Syntax-Commands-Contexts.html That does seems logical. So if I comprehend right : Code implicit : {c'} Code explicit : \score { \new Staff { \new Voice {c'} } } Are similar. Not identical but similar. 1) Is that correct? 2) Can from the implicit code the explicit code be generated? So if I have doubt what the structure is, I can view this. 3) I would like to use and to be able to disable the \with statement. But I could not find any documentation about it. Do you have a link for me? Thanks, I really like the style of help of this newsgroups. This stimulate me to continue learning and using Lilypond. With regards Bernard ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user