Re: drawing a range reguardless of transposition
On Thu, Nov 28, 2019 at 10:40:17AM -0800, Aaron Hill wrote: > On 2019-11-28 9:27 am, Sandro Santilli wrote: > > On Mon, Nov 25, 2019 at 04:40:12AM -0800, Aaron Hill wrote: > > > On 2019-11-25 2:26 am, Sandro Santilli wrote: > > > > I'm trying, for backward compatibility, to keep that > > > > highlightOutOfRange function, is that possible ? > > > > > > What compatibility are you needing? > > > > As I've used the old function in existing scores, I'd like > > to avoid changing them all to use the new function. That's > > the kind of compatibility I'd be needing. > > Forgive me, but did I not invent that function only two weeks ago? How busy > have you been to have used it in so many scores?! (: $ git grep -c highlightOutOfRange Sidewinder/sidewinder.ly:4 SoDancoSamba/sodancosamba.ly:4 Summertime/summertime.ly:4 > But, really, it should involve little more than a find-and-replace to > convert the older usage to the newer. Here's a bash script to do the work: Uhm, I might be still not getting the 2.18.2 compatibility, as this is what I get: warning: type check for `color' failed; value `#) (void . #t))((name . Music) (types general-music)) > ' must be of type `color' When using: altoRange = \override NoteHead.color = \highlightPitches outside \altoDesignedWrittenRange Top lines of the highlightPitches are: highlightPitches = #(define-music-function (parser location color method music) ((color? red) symbol? ly:music?) --strk;
Re: drawing a range reguardless of transposition
On Fri, Nov 29, 2019 at 10:28:04AM +0100, Sandro Santilli wrote: > Uhm, I might be still not getting the 2.18.2 compatibility, as this > is what I get: > > warning: type check for `color' failed; value `# Music((origin . #) (void . #t))((name . Music) > (types general-music)) > ' must be of type `color' > > When using: > > altoRange = \override NoteHead.color = \highlightPitches outside > \altoDesignedWrittenRange Ok, I was misusing it. Had to be (and it works): altoRange = \highlightPitches outside \altoDesignedWrittenRange --strk;
programming error: note column without heads and stem
When using \partcombine I'm getting 3 of these errors: programming error: note column without heads and stem continuing, cross fingers The errors doesn't tell which line/column they come from. How can I debug it ? The source code is attached --strk; \version "2.18.2" #(load "../lilylib/swing.scm") \include "../lilylib/range.ly" \include "../lilylib/parenthesis.ly" \header { title = "Sidewinder" %year = "1935" %poet = "DuBose Hayward" composer = "Lee Morgan" %arranger = "arranged by Sandro Santilli" %piece = "Funk (Pseudo Bossa)" tagline = \markup { \column { "Lilypond typesetting by Sandro Santilli - https://strk.kbt.io - November 2019" } } } % Giorgio Gadotti capabilities giorgioGadottiRange = { d' b'' } altoRange = \highlightPitches outside \giorgioGadottiRange % Sandro Santilli capabilities as of 2019 sandroSantilliRange = { c' g'' } trumpetRange = \highlightPitches outside \sandroSantilliRange % Desy Vaselli capabilities (just a guess) desyVaselliRange = { a g'' } voiceRange = \highlightPitches outside \desyVaselliRange bassRange = \highlightPitches outside \doubleBassDesignedWrittenRange %#(set-global-staff-size 21) \paper { %indent = 0\cm } \layout { \override Glissando #'style = #'zigzag \set Score.markFormatter = #format-mark-box-alphabet \context { \Voice \consists "Ambitus_engraver" } } % Available range: c' -- b'' melody_alto = \relative c' { \clef "treble" \key c \major \numericTimeSignature \time 4/4 r1 | \repeat volta 2 { \repeat percent 2 { r4 dis-^ r8 e8-^ r4 | } r8 a,8 bes4 c d | a8 bes a g~ g2 | % 6 \repeat percent 2 { r4 dis'-^ r8 e8-^ r4 | } r8 a,8 bes4 c d | dis8 e c bes r8 fis8 r4 | % 10 \parenthesize f4-- gis'-^ r8 a-^ r4 | r4 gis-^ r8 a-^ r4 | r8 d, ees f g f ees d | f c d ees~ ees \glissando g, f g | % 14 c4-- dis-^ r8 e-^ r4 | r4 dis-^ r8 e-^ r4 | r8 g,8 a[ bes] c d4. | r8 e f[ fis] g a4. | % 18 \repeat percent 2 { r4 f-^ r8 g-^ r4 | } r8 d e4 f fis | fis8 g f cis r cis g[ cis] | % 22 c?4-- dis-^ r8 e-^ r4 | r4 dis-^ r8 e-^ r4 \bar "||" r4 r8 g,16 bes c8 c c16 g bes8 | c4-^ r8 bes~ bes g f g | } } melody_trp = \relative c'' { \clef "treble" \key c \major \numericTimeSignature \time 4/4 r1 | \repeat volta 2 { \repeat percent 2 { r4 a-^ r8 bes-^ r4 | } r8 a bes4 c d | a8 bes a g~ g2 | \repeat percent 2 { r4 a-^ r8 bes-^ r4 | } r8 a bes4 c d | dis8 e c bes r8 fis8 r4 | % 10 \parenthesize f4-- d'-^ r8 ees8-^ r4 | r4 d-^ r8 ees-^ r4 | r8 d ees f g f ees d | f c d ees~ ees \glissando g, f g | % 14 c,4-- a'-^ r8 bes-^ r4 | r4 a-^ r8 bes8-^ r4 | r8 g a[ bes] c d4. | r8 e f[ fis] g a4. | % 18 \repeat percent 2 { r4 d,-^ r8 e-^ r4 | } r8 d e4 f fis | fis8 g f cis r8 cis? g[ cis?] | % 22 c?4-- a-^ r8 bes-^ r4 | r4 a-^ r8 bes-^ r4 \bar "||" r4 r8 g16 bes c8 c c16 g bes?8 | c4-^ r8 bes8~ bes g f g | } } melody_bass = \relative c' { \bassRange \clef "bass" \key c \major \numericTimeSignature \time 4/4 r4 r8 g r f cis4 | \repeat volta 2 { \repeat percent 4 { c4 r8 c g4 bes | } % TODO: change notehead to slash \repeat percent 4 { r4 b r8 c8 r4 | } % TODO: change notehead to slash \repeat percent 4 { r4 b r8 c8 r4 | } \repeat percent 4 { r4 b r8 c8 r4 | } % TODO: change notehead to slash \repeat percent 4 { r4 b r8 c8 r4 | } \repeat percent 2 { r4 b r8 c8 r4 | } %TODO: change notehead to X c4 r4 r2 | r1 | } } harmony_realbook = \chords \with { \consists Percent_repeat_engraver \override PercentRepeat.Y-offset = 1 } { r1 | \repeat volta 2 { \repeat percent 4 { b2:7 c:7 | } \break \repeat percent 4 { b2:7 c:7 | } \bar "||" \break \repeat percent 4 { e2:7 f:7 | } \break \repeat percent 3 { b2:7 c:7 | } e:m7.5- c:7.9- | \bar "||" \break \repeat percent 4 { d2:m7 g:7 | } \break \repeat percent 2 { b2:7 c:7 | } \bar "||" c4:7 r2. | r1 | } } harmony = \harmony_realbook % The alto sax part altoSheet = { << \context ChordNames { \harmony } \new Staff \with { instrumentName = #"Alto" } { \new Voice = "alto" { \melody_alto } } >> } % The trumpet part trumpetSheet = { << \context ChordNames { \harmony } \new Staff \with { instrumentName = #"Trumpet" } { \new Voice = "trp" { \melody_trp } } >> } % The full score fullScore = { << \new Staff \with { instrumentName = #"Trp" } { \new Voice = "trp" { \trumpetRange \transpose c d \melody_trp } } \new Staff \with { instrumentName = #"Alto" } { \new Voice = "alt
A question about \override in markuplist
I'm a bit confused by he documentation concerning \override. In most of the LR and NR it is described as a LilyPond command which changes the value of a property. However, it also seems to appear as a special function within a \markup which adds, as opposed to changes, a property.value pair to the property list (which one isn't explicitly stated, but it can presumably be inferred from the context). Presumably the property value is removed from the list after the markup argument has been evaluated, so there is no need for a \revert command. To sum up, am I right in thinking that within a \markup, the function supersedes the command? I have to say, this does not feel like good program design. One does not usually have two built-in operators with the same name and different scopes. :) Regards, Peter www.ptoye.com
RE: Generate pitches between pitches
From: lilypond-user On Behalf Of Paolo Prete Sent: Friday, November 29, 2019 12:27 AM To: Lilypond-User Mailing List Subject: Generate pitches between pitches Hello, given two pitches, for example: c' and c'', is there a way to automatically generate all the pitches between them? In three different ways: 1) all the "white keys" between them: d' e' f' g' a' b' 2) all the "black keys" between them: des' ees' ges' aes' bes' 3) all the pitches: des' d' ees' e' f' ges' g' aes' a' bes' b' This feature would be very useful for simulating (piano) glissandos with MIDI. thanks. [>] Like this? \version "2.19.83" glisando = #(define-music-function (parser location arg1 arg2) (ly:music? ly:music? ) (letrec ((first-note-fn (lambda (lst) (cond ((ly:music? lst) lst) ((null? lst) '()) ((not (pair? lst)) '()) (else (car lst) (last-note-fn (lambda (lst) (cond ((ly:music? lst) lst) ((null? lst) '()) ((not (pair? lst)) '()) ((null? (cdr lst)) (car lst)) (else (last-note-fn (cdr lst))) (let* ((lst1 (ly:music-property arg1 'elements)) (lst2 (ly:music-property arg2 'elements)) (pp-pitch '((0 . (0 . 0)) (1 . (1 . -1/2 )) (2 . (1 . 0)) (3 . (2 . -1/2 )) (4 . (2 . 0)) (5 . (3 . 0)) (6 . (4 . -1/2 )) (7 . (4 . 0)) (8 . (5 . -1/2 )) (9 . (5 . 0)) (10 . (6 . -1/2 )) (11 . (6 . 0 (make-pitch (lambda (p) (let* ((note (assoc-get (modulo p 12) pp-pitch)) (octave (quotient p 12))) (ly:make-pitch octave (car note) (cdr note) (first-note (last-note-fn lst1)) (last-note (first-note-fn lst2)) (first-pitch (ly:music-property first-note 'pitch)) (last-pitch (ly:music-property last-note 'pitch)) (first-duration (ly:duration-log (ly:music-property first-note 'duration))) (first-type (ly:music-property first-note 'name)) (last-type (ly:music-property last-note 'name))) (cond ((null? first-note) (throw 'glisando-err "arg1 must be a music expression with notes")) ((null? last-note) (throw 'glisando-err "arg2 must be a music expression with notes")) ((not (equal? first-type 'NoteEvent))(throw 'glisando-err "arg1 must end with a note")) ((not (equal? last-type 'NoteEvent))(throw 'glisando-err "arg2 must begin with a note")) (else (let* ((ps-first (ly:pitch-semitones first-pitch)) (ps-last ( - (ly:pitch-semitones last-pitch) 1)) (dir (if (> ps-first ps-last) 1+ 1- )) (glis '())) (do ((p ps-last (dir p)))((equal? p ps-first)) (set! glis (cons (make-music 'NoteEvent 'pitch (make-pitch p) 'duration (ly:make-duration first-duration) ) glis))) (make-music 'SequentialMusic 'elements (append (list arg1) glis (list arg2) \glisando { e'2 d' c'32 } { c''4 b' a'}
Coloring adjacent notes by interval
Hi all, I would like to color all successive notes in a voice that span a certain interval, like e.g. a perfect fifth upwards. Seems to me the most straightforward and extensible way would be to write a scheme engraver for this, right? Does someone know existing examples of scheme engravers that I could look at as a starting point? I am somewhat confused by the different hooks (start-translation-timestep, acknowledge-music etc.) and where to do which kind of things. Kind regards, Michael
Re: Identifying non-chord notes in Scheme
Aaron, thanks a million for the solution (with the convincing demo). I'm examining note data rather than tweaking output, but with your example as a guide the rest will be 'easy' (as easy as Scheme goes for me). If you have time for a question: The "for-some-music" function is new to me. Any quick comments when to use each of the different functions/methods for recursion through input music? Or do you know of any tutorials/explications of recursion through music? LilyPond offers 'music-map,' 'map-some-music,' and 'for-some-music,' and I've also seen code based on plain old 'map.' Steve From: Aaron Hill Subject:Re: Identifying non-chord notes in Scheme Date: Wed, 27 Nov 2019 11:09:12 -0800 User-agent: Roundcube Webmail/1.3.8 Hi Steve, Sorry for the delay in responding to your original query. But as some say, "better late, than never." (: \version "2.19.83" colorNonChordNotes = #(define-music-function (color music) (color? ly:music?) (define (color-stop? mus) (if (music-is-of-type? mus 'note-event) (let* ((curr (ly:music-property mus 'tweaks '())) (new `((color . ,color) ((Accidental . color) . ,color))) (tweaks (append curr new))) (set! (ly:music-property mus 'tweaks) tweaks)) ;; Stop recursion on chords. (music-is-of-type? mus 'event-chord))) (for-some-music color-stop? music) music) soprano = \fixed c' { 4 b8 d' 2 } alto = \fixed c' { e8 d 4 dis2 } tenor = \fixed c { 4 b2 } bass = \fixed c { c4 d 2 } \score { \colorNonChordNotes #(x11-color 'tomato) \new ChoirStaff << \new Staff \voices 1,2 << \clef "treble" \soprano \\ \alto >> \new Staff \voices 1,2 << \clef "bass" \tenor \\ \bass >> >> } Not knowing *what* you intended to do with non-chord notes, I just simply appended a few \tweaks to those notes to demonstrate the technique of using for-some-music with a custom stop? procedure. -- Aaron Hill non-chord-notes.cropped.png* *
how to \crossStaff?
Hi there, I don’t know how to implement the cross staff as you see in the attached figure. Another question is how to tweak the staccato position? What I have tried is following: Thanks a lot in advance. Best, Jinsong \version "2.19.83" \layout { \context { \PianoStaff \consists #Span_stem_engraver } } \relative { \new PianoStaff << \new Staff { \key g \major \time 3/4 << { 8 e'16-. \p fis-. g8-. g16-. a-. b8-. -. } \\ { s4. \autoBeamOff \crossStaff { e16 fis } \autoBeamOn g8 s } >> } \new Staff { \clef bass \key g \major \time 3/4 8 g'16-. b-. e8-. e16-. fis-. s8 8-. } >> }
question about ottava spanner
Hi there, In the following MWE, you may notice that the ottava spanner have different behavior. It may be my fault. However, I don’t know how to correct it. The first question is why the first ottava spanner extent to the second note? The second question is how to prevent the ottava spanner merging, shown as the last two notes. Any suggestion will be really appreciated. Best, Jinsong \version "2.19.83" \relative{ \clef bass \key g \major \time 3/4 \override Staff.OttavaBracket.direction = #DOWN << { s4 2 } \\ { \ottava #1 \set Staff.ottavation = #"8" 2 \ottava #0 \ottava #1 \set Staff.ottavation = #"8" 4 \ottava #0 } >> \ottava #1 2 \ottava #0 \ottava #1 4 \ottava #0 }
Re: question about ottava spanner
Am Fr., 29. Nov. 2019 um 18:20 Uhr schrieb Jinsong Zhao : > > Hi there, > > > > In the following MWE, you may notice that the ottava spanner have different > behavior. It may be my fault. However, I don’t know how to correct it. > > > > The first question is why the first ottava spanner extent to the second note? > The second question is how to prevent the ottava spanner merging, shown as > the last two notes. > > > > Any suggestion will be really appreciated. > > > > Best, > > Jinsong > > > > \version "2.19.83" > > > > \relative{ > > \clef bass > > \key g \major > > \time 3/4 > > \override Staff.OttavaBracket.direction = #DOWN > > << > > { s4 2 } > > \\ > > { > > \ottava #1 > > \set Staff.ottavation = #"8" > > 2 > > \ottava #0 > > \ottava #1 > > \set Staff.ottavation = #"8" > > 4 > > \ottava #0 > > } > > >> > > \ottava #1 > > 2 > > \ottava #0 > > \ottava #1 > > 4 > > \ottava #0 > > } \ottava works for Staff. You told LilyPond to write your entered Staff-input one octave below. Thus the OttavaBracket _needs_ to span the upper Voice (although you tweaked it's direction down) Though, I somehow doubt that's what you intended ... Cheers, Harm
Re: A question about \override in markuplist
From: Peter Toye Reply-To: Peter Toye Date: Friday, November 29, 2019 at 5:58 AM To: Subject: A question about override in markuplist Peter, Thank you for asking this question. It is good for us to have relatively new users let us know what things are confusing, so we can try to improve them. I'm a bit confused by he documentation concerning \override. In most of the LR and NR it is described as a LilyPond command which changes the value of a property. This is correct. \override changes the value of Grob properties and \markup properties (but not Context properties, which are changed with \set, as described in the Learning Manual). However, it also seems to appear as a special function within a \markup which adds, as opposed to changes, a property.value pair to the property list (which one isn't explicitly stated, but it can presumably be inferred from the context). Presumably the property value is removed from the list after the markup argument has been evaluated, so there is no need for a \revert command. The property list is an argument to the \markup function (which applies to only a specific markup), rather than a property of a Grob, so it doesn’t affect anything other than the specific markup. When Context properties are \set, they affect every item in the Context. When Grob properties are \override(n), all Grobs of that type at the current moment (and forward, unless there is a \once) are affected. When \markup properties are \override(n), only that specific markup is affected. The Notation Reference appendices A.10 and A.11 list the properties used by each \markup command. Any properties not used by a \markup command will be ignored if they are added to the property list by the use of \override. Any required properties not found in the property list will be given default values as described in the Notation Reference appendices. To sum up, am I right in thinking that within a \markup, the function supersedes the command? I hope my explanation above answers this question. I have to say, this does not feel like good program design. One does not usually have two built-in operators with the same name and different scopes. :) I think it’s good program design. It’s not unlike overloading the “+” operator such that it can both add integers and concatenate strings. I think our documentation of the use of \markup properties could be made clearer. One has to jump between multiple books to see how this works. Thanks, Carl
Re: A question about \override in markuplist
Peter Toye writes: > I'm a bit confused by he documentation concerning \override. In most > of the LR and NR it is described as a LilyPond command which changes > the value of a property. > > However, it also seems to appear as a special function within a > \markup which adds, as opposed to changes, a property.value pair to > the property list (which one isn't explicitly stated, but it can > presumably be inferred from the context). What is "the property list"? What is "adds to"? You make it sound like something gets modified. It doesn't. A new list is constructed for passing to subordinate markup functions, a list that has some overrides in front while using the passed property list for its tail. > Presumably the property value is removed from the list after the > markup argument has been evaluated, so there is no need for a \revert > command. There is nothing added anywhere, so nothing needs get "removed". The property lists are only passed downwards in markup functions, never upwards, so there would not even be a sane way of removing something. > To sum up, am I right in thinking that within a \markup, the function > supersedes the command? The markup command takes the task of adding overrides to a markup's properties that are usually set up from a variety of sources including the grob properties of a grob containing markup, which in turn are initialized from the context's respective grob properties for this grob type. > I have to say, this does not feel like good program design. One does > not usually have two built-in operators with the same name and > different scopes. :) Well, LilyPond is not competing for a "good program design" prize. I have retrofitted some logic and coherence into a number of its parts in order to have people more confident in being able to work with it and predict its behavior. The various property regimes are one of the more complex inherited messes and fundamental to its operation. You are not going to fundamentally change it. Though being able to get rid of override-property eventually would be a good thing. That's a really ugly duckling. -- David Kastrup
Re: Coloring adjacent notes by interval
Michael Käppler writes: > Hi all, > I would like to color all successive notes in a voice that span a > certain interval, like e.g. a perfect fifth upwards. > Seems to me the most straightforward and extensible way would be to > write a scheme engraver for this, right? No, just a callback function for a NoteHead's color property should be fine. -- David Kastrup
Re: how to \crossStaff?
Hi Jinsong, to get the result you want, you have to give a name to each staff, e.g. \new Staff = "upper" << etc. Then you have to use \change to tell LilyPond in which staff a specific voice shall be engraved. \relative { \new PianoStaff << \new Staff = "upper" { \key g \major \time 3/4 << { 8 e'16^. \p fis^. g8^. g16^. a^. b8^. ^. } >> } \new Staff = "lower" { \clef bass \key g \major \time 3/4 8 g'16-. b-. e8-. \change Staff = "upper" e16_. fis_. \autoBeamOff \stemDown g8 \change Staff = "lower" \stemNeutral 8-. } >> } Kind regards, Martin Am Freitag, 29. November 2019, 23:17:00 CET schrieb Jinsong Zhao: > Hi there, > > I don’t know how to implement the cross staff as you see in the attached > figure. Another question is how to tweak the staccato position? > > What I have tried is following: > > Thanks a lot in advance. > > Best, > Jinsong > > \version "2.19.83" > > \layout { > \context { > \PianoStaff > \consists #Span_stem_engraver > } > } > > \relative { > \new PianoStaff << > \new Staff { > \key g \major > \time 3/4 > << > { > 8 e'16-. \p fis-. > g8-. g16-. a-. b8-. > -. > } > \\ > { > s4. > \autoBeamOff > \crossStaff { e16 fis } > \autoBeamOn g8 s > } > > > } > \new Staff { > \clef bass > \key g \major > \time 3/4 > 8 g'16-. b-. e8-. > e16-. fis-. > s8 8-. > } > > } -- Mag. Martin Wadsack, BBBakk.art. Stiftskapellmeister Stift Altenburg Abt Placidus Much-Straße 1 3591 Altenburg +43(0)664 80 11 44 25 kirchenmu...@stift-altenburg.at www.stift-altenburg.at www.stiftsmusik-altenburg.at www.altenburger-saengerknaben.at Oberlaaer Straße 31 1100 Wien 0699 11 94 92 86 mar...@wadsack.at www.martinwadsack.at
Re: question about ottava spanner
On 2019/11/30 2:23, Thomas Morley wrote: \ottava works for Staff. You told LilyPond to write your entered Staff-input one octave below. Thus the OttavaBracket _needs_ to span the upper Voice (although you tweaked it's direction down) Though, I somehow doubt that's what you intended ... Cheers, Harm Thanks a lot. However, I don't understand your reply very well. The snippet I want to input is something like the attached figure. BTW, where can I find the reference for every command used in Lilypond? Thanks again. Best, Jinsong
Re: question about ottava spanner
Hello Jinsong. In the Notation Reference manual (NR). It's complete. But its not a ordered alphabetical list of commands. It's arranged by topic, with extensive explanatory material. There is also an alphabetical index. http://lilypond.org/doc/v2.18/Documentation/notation/index.html You can find the same for 2.91.83 if you download the documentation for that. Translations to many languages are available. On 30/11/19 12:16 pm, Jinsong Zhao wrote: BTW, where can I find the reference for every command used in Lilypond?
Re: how to \crossStaff?
Hi Martin, Thank you very much for helping. It works well. I learn Lilypond by doing and by helps from all of you. Thanks again. Best, Jinsong On 2019/11/30 9:07, Martin Wadsack wrote: Hi Jinsong, to get the result you want, you have to give a name to each staff, e.g. \new Staff = "upper" << etc. Then you have to use \change to tell LilyPond in which staff a specific voice shall be engraved. \relative { \new PianoStaff << \new Staff = "upper" { \key g \major \time 3/4 << { 8 e'16^. \p fis^. g8^. g16^. a^. b8^. ^. } >> } \new Staff = "lower" { \clef bass \key g \major \time 3/4 8 g'16-. b-. e8-. \change Staff = "upper" e16_. fis_. \autoBeamOff \stemDown g8 \change Staff = "lower" \stemNeutral 8-. } >> } Kind regards, Martin Am Freitag, 29. November 2019, 23:17:00 CET schrieb Jinsong Zhao: Hi there, I don’t know how to implement the cross staff as you see in the attached figure. Another question is how to tweak the staccato position? What I have tried is following: Thanks a lot in advance. Best, Jinsong \version "2.19.83" \layout { \context { \PianoStaff \consists #Span_stem_engraver } } \relative { \new PianoStaff << \new Staff { \key g \major \time 3/4 << { 8 e'16-. \p fis-. g8-. g16-. a-. b8-. -. } \\ { s4. \autoBeamOff \crossStaff { e16 fis } \autoBeamOn g8 s } } \new Staff { \clef bass \key g \major \time 3/4 8 g'16-. b-. e8-. e16-. fis-. s8 8-. } }