Re: Align markdown to barline?
Great, thanks! I'm using 2.22.2, so I suppose \mark is my new friend Kenneth -- Roosna & Flak - Contemporary Dance & Music Web: roosnaflak.com Code: {github,gitlab}.com/kflak Mastodon: @k...@sonomu.club On 20 Nov 2022 00:24, Paul Scott wrote: >On 11/19/22 11:34 PM, Kenneth Flak wrote: >> Hi list, >> >> Is there a way to (easily) attach a text to a barline? Currently I am doing >> this kind of a stunt in order to line it up correctly: >> >> >> left = { >> \relative c { >> \clef bass >> c1_"C" d_"P" f_" C" e_" C" >> f_" P" g_"P" a_" C" g_" S" >> e_" C" d_"C" c >> } >> } >> >> ... which obviously is not very sustainable. >> >You don't say what version you are using. \mark for 2.22.2 or \textMark >for 2.23.81 should be what you want. > >NR 1.8.1 for 2.22.2 or 2.23.81 (Notation Reference} > >HTH > >Paul > >
Re: Align markdown to barline?
On 11/19/22 11:34 PM, Kenneth Flak wrote: Hi list, Is there a way to (easily) attach a text to a barline? Currently I am doing this kind of a stunt in order to line it up correctly: left = { \relative c { \clef bass c1_"C" d_"P" f_" C" e_" C" f_" P" g_"P" a_" C" g_" S" e_" C" d_"C" c } } ... which obviously is not very sustainable. You don't say what version you are using. \mark for 2.22.2 or \textMark for 2.23.81 should be what you want. NR 1.8.1 for 2.22.2 or 2.23.81 (Notation Reference} HTH Paul
Align markdown to barline?
Hi list, Is there a way to (easily) attach a text to a barline? Currently I am doing this kind of a stunt in order to line it up correctly: left = { \relative c { \clef bass c1_"C" d_"P" f_" C" e_" C" f_" P" g_"P" a_" C" g_" S" e_" C" d_"C" c } } ... which obviously is not very sustainable. Best, Kenneth -- Roosna & Flak - Contemporary Dance & Music Web: roosnaflak.com Code: {github,gitlab}.com/kflak Mastodon: @k...@sonomu.club
Re: Flexible lyric alignment,Re: Flexible lyric alignment
On Sat, Nov 19, 2022 at 6:59 PM Abraham Lee wrote: > > > On Sat, Nov 19, 2022 at 6:50 PM Abraham Lee > wrote: > >> >> >> On Sat, Nov 19, 2022 at 5:16 PM Jean Abou Samra >> wrote: >> >>> >>> >>> Le 20 nov. 2022 à 01:11, Abraham Lee a >>> écrit : >>> >>> Still running into compiler errors. I figured my version was just out of >>> date, but after downloading 2.23.81, I still get the following log: >>> >>> %<-SNIP--- >>> >>> Starting lilypond.exe 2.23.81 [tricky-lyrics.ly]... >>> Processing `K:/music-related/lilypond/snippets/lyric-autospacer/ >>> tricky-lyrics.ly' >>> Parsing... >>> K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:8:2: >>> error: Guile signaled an error for the expression beginning here >>> # >>> (use-modules (ice-9 match) >>> >>> In procedure bytevector-u64-set!: Value out of range: -149659645 >>> >>> >>> >>> >>> I have never seen this kind of error. >>> >>> First, can you try to comment out #(ly:set-option 'compile-scheme-code) >>> at the top and see what happens? >>> >> >> That actually did allow it to compile. Interesting. What am I missing out >> on without this option set? >> >> >>> Second, what OS are you running, Windows? How did you install LilyPond? >>> >> >> My apologies. I should have included that already. Yes, I'm on Windows >> and since the Windows download isn't an actual installer, I just unzipped >> it and ran it from there. >> >> > Jean, this is absolutely brilliant! It works perfectly for a HUGE majority > of the cases of my real score where I had to do so many manual adjustments. > Wow! Your code has reduced the tweaking to almost zero. Even then, it's > totally usable as-is. Thank you soo much! I'm definitely going to have > to study your code to see why this works so well. I've only created a > handful of Scheme fixes for things I'd done in the past, but this is way > out of my league. Well done! > > Kieren, you've got to try this out! It will blow your mind! > Jean, seriously, this is amazing! Thank you so much for this awesome tool. I can see how it's not going to be perfect for every situation, but, man, what a great job it does. I think I've ended up adjusting only 5 total places just a hair because of some close proximity to the Stanza text, but compared to the over 60 syllables I had to tweak before, your fix easily beats what I was trying to do manually!!! What a time saver! Follow-on realization: This code even works with the LSR snippet that ignores punctuation! ( http://lilypond.1069038.n5.nabble.com/LyricText-center-on-word-breaks-lyricMelismaAlignment-tt183456.html). This has turned a so-so day into an amazing one! Thank you, Jean! As a choir director for my local church congregation, this will save me so much time! Best, Abraham P.S. I hope my enthusiasm for this fix doesn't eclipse my sincere appreciation for all the amazing work done by the regular developers past and present. I've had lots of generous help over the years from many developers and other users here. So grateful to you all for creating a truly awesome tool and helping me and so many others!
Re: Flexible lyric alignment,Re: Flexible lyric alignment
On Sat, Nov 19, 2022 at 6:50 PM Abraham Lee wrote: > > > On Sat, Nov 19, 2022 at 5:16 PM Jean Abou Samra > wrote: > >> >> >> Le 20 nov. 2022 à 01:11, Abraham Lee a >> écrit : >> >> Still running into compiler errors. I figured my version was just out of >> date, but after downloading 2.23.81, I still get the following log: >> >> %<-SNIP--- >> >> Starting lilypond.exe 2.23.81 [tricky-lyrics.ly]... >> Processing `K:/music-related/lilypond/snippets/lyric-autospacer/ >> tricky-lyrics.ly' >> Parsing... >> K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:8:2: >> error: Guile signaled an error for the expression beginning here >> # >> (use-modules (ice-9 match) >> >> In procedure bytevector-u64-set!: Value out of range: -149659645 >> >> >> >> >> I have never seen this kind of error. >> >> First, can you try to comment out #(ly:set-option 'compile-scheme-code) >> at the top and see what happens? >> > > That actually did allow it to compile. Interesting. What am I missing out > on without this option set? > > >> Second, what OS are you running, Windows? How did you install LilyPond? >> > > My apologies. I should have included that already. Yes, I'm on Windows and > since the Windows download isn't an actual installer, I just unzipped it > and ran it from there. > > Jean, this is absolutely brilliant! It works perfectly for a HUGE majority of the cases of my real score where I had to do so many manual adjustments. Wow! Your code has reduced the tweaking to almost zero. Even then, it's totally usable as-is. Thank you soo much! I'm definitely going to have to study your code to see why this works so well. I've only created a handful of Scheme fixes for things I'd done in the past, but this is way out of my league. Well done! Kieren, you've got to try this out! It will blow your mind! Best, Abraham
Re: Flexible lyric alignment,Re: Flexible lyric alignment
On Sat, Nov 19, 2022 at 5:16 PM Jean Abou Samra wrote: > > > Le 20 nov. 2022 à 01:11, Abraham Lee a > écrit : > > Still running into compiler errors. I figured my version was just out of > date, but after downloading 2.23.81, I still get the following log: > > %<-SNIP--- > > Starting lilypond.exe 2.23.81 [tricky-lyrics.ly]... > Processing `K:/music-related/lilypond/snippets/lyric-autospacer/ > tricky-lyrics.ly' > Parsing... > K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:8:2: > error: Guile signaled an error for the expression beginning here > # > (use-modules (ice-9 match) > > In procedure bytevector-u64-set!: Value out of range: -149659645 > > > > > I have never seen this kind of error. > > First, can you try to comment out #(ly:set-option 'compile-scheme-code) at > the top and see what happens? > That actually did allow it to compile. Interesting. What am I missing out on without this option set? > Second, what OS are you running, Windows? How did you install LilyPond? > My apologies. I should have included that already. Yes, I'm on Windows and since the Windows download isn't an actual installer, I just unzipped it and ran it from there. Thanks for the tip! Abraham
Re: Splitting voices
Awesome, thanks Jean! L On Sun, 20 Nov 2022, 00:30 Jean Abou Samra, wrote: > Le 20/11/2022 à 00:02, Luca Fascione a écrit : > > Hi all, > > I have some 2 voice music coming from musicxml like this > > > > 4 8. 16 ~ ~ 2. > > > > and I'd like to split it into 2 voices instead: > > > > << > > \new Voice ... { ... a4 g8. d16~ d2. ... } > > \new Voice ... { ... c4 b8. g16~ g2. ... } > > >> > > > > is there any software / trick that I could use? > > (I use Frescobaldi, but I couldn't find a transformation for this > purpose) > > > There are a number of snippets floating around for that IIRC, basically > variations on the theme > > \version "2.22.2" > > #(use-modules (ice-9 receive)) > > selectNote = > #(define-music-function (index music) (index? ly:music?) > (music-map > (lambda (m) >(if (music-is-of-type? m 'event-chord) >(let ((elts (ly:music-property m 'elements))) > (receive (rhythmic arts) >(partition (music-type-predicate 'rhythmic-event) > elts) >(if (< (1- index) > (length rhythmic)) >(let* ((elt (list-ref elts (1- index))) > (elt-arts (ly:music-property elt > 'articulations))) > (set! (ly:music-property elt 'articulations) >(append elt-arts (map ly:music-deep-copy arts))) > elt) >#{ #}))) >m)) > music)) > > mus = \relative { >4 8. 16~ 2. > } > > \new Staff << >\new Voice { > \voiceOne > \selectNote 2 \mus >} >\new Voice { > \voiceTwo > \selectNote 1 \mus >} > >> > > > Best, > Jean > >
Re: Flexible lyric alignment,Re: Flexible lyric alignment
Le 20 nov. 2022 à 01:11, Abraham Lee a écrit :Still running into compiler errors. I figured my version was just out of date, but after downloading 2.23.81, I still get the following log:%<-SNIP---Starting lilypond.exe 2.23.81 [tricky-lyrics.ly]...Processing `K:/music-related/lilypond/snippets/lyric-autospacer/tricky-lyrics.ly'Parsing...K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:8:2: error: Guile signaled an error for the _expression_ beginning here# (use-modules (ice-9 match)In procedure bytevector-u64-set!: Value out of range: -149659645I have never seen this kind of error.First, can you try to comment out #(ly:set-option 'compile-scheme-code) at the top and see what happens?Second, what OS are you running, Windows? How did you install LilyPond?Thanks,Jean
Re: Flexible lyric alignment,Re: Flexible lyric alignment
On Sat, Nov 19, 2022 at 4:34 PM Abraham Lee wrote: > > > On Sat, Nov 19, 2022 at 3:23 PM Jean Abou Samra > wrote: > >> Le 17/11/2022 à 23:02, Jean Abou Samra a écrit : >> > Le 17/11/2022 à 23:01, Werner LEMBERG a écrit : >> > But how do you take into account the constraints from lyrics here? >> > That is the whole problem. >> They should be completely ignored. >> >>> In that case, it should be completely doable even in Scheme now. >> >>> (I started writing some code yesterday in response to Abraham that >> >>> does essentially that, maybe I'll have it finished today). >> >> Aah, nice! >> > >> > No so fast, wait until it actually works before calling >> > it nice, otherwise if it doesn't work I'll feel bad :-) >> >> >> >> >> Here you go. >> >> This is a vast refinement of the initial \autoMove function that takes all >> lyric words into account simultaneously, finding an optimal solution that >> minimizes the distance from each lyric word to its note while respecting >> the minimal distances between lyric words as configured by >> LyricSpace.minimum-distance / LyricHyphen.minimum-distance. >> >> I used the first algorithm with acceptable complexity that I could >> think of, so there may be a simpler solution for this. Nevertheless, >> it runs in linear time, so I'm happy enough. (If it were quadratic >> or worse, the running time could potentially be problematic if >> ly:one-line-auto-height breaking is used, in which case there can >> be lots of lyrics on the same line.) >> >> Caveats: >> >> - As said in a previous message, this is the other extreme compared >>to what LilyPond does by default: lyrics are not taken into account >>*at all* into note spacing. In particular, LilyPond may produce >>a page breaking configuration in which there are too many notes on >>the same system to fit the lyrics comfortably. I expect that using >>\break in those cases will often be enough to get an acceptable result, >>but I have zero experience with typesetting music with lyrics. >>(And little actual practical experience with typesetting music at >>all, to be honest.) >> >> - I have barely tested it. >> >> Additional featurelets: >> >> - You can still set LyricText.self-alignment-X. It defines the position >>of the LyricText that the algorithm will consider optimal. >> >> - You can set LyricText.details.strength to tell the algorithm to >>place one specific syllable closer to its note at the expense >>of the others. See the example. >> >> Before someone asks: this is not good to integrate into LilyPond as-is, >> because it breaks assumptions that grob implementors and LilyPond in >> general make (namely, the assumption that the X-offset of an item is >> known before line breaking). One would have to either go for a full >> solution as brainstormed in one of my earlier messages, or at least >> find a way for an Item to declare that its positioning depends on other >> things (akin to the current cross-staff property, but preferably less >> invasive). >> >> Hope that helps, >> Jean >> >> > This looks absolutely amazing! I'm running into some compiler issues when > I try to run it on my machine, but I'll see if I can work out why and let > you know if I'm unable. Either way, bravo! The output looks like it will > fix many situations automagically. This seems to be a fantastic step in the > right direction. > > Generally, I end up controlling the system breaking in the end, anyway, so > I'm not too concerned about the possibility of too long a line. > > Many thanks, > Abraham > Still running into compiler errors. I figured my version was just out of date, but after downloading 2.23.81, I still get the following log: %<-SNIP--- Starting lilypond.exe 2.23.81 [tricky-lyrics.ly]... Processing `K:/music-related/lilypond/snippets/lyric-autospacer/ tricky-lyrics.ly' Parsing... K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:8:2: error: Guile signaled an error for the expression beginning here # (use-modules (ice-9 match) In procedure bytevector-u64-set!: Value out of range: -149659645 K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:14:2: error: Guile signaled an error for the expression beginning here # (define-syntax-rule (transform! lval proc) In procedure bytevector-u64-set!: Value out of range: -149659645 K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:17:2: error: Guile signaled an error for the expression beginning here # (define -> In procedure bytevector-u64-set!: Value out of range: -149659645 K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:36:2: error: Guile signaled an error for the expression beginning here # (define-class () In procedure bytevector-u64-set!: Value out of range: -149659645 K:/music-related/lilypond/snippets/lyric-autospacer/respace-lyrics.ily:44:2: error: Guile signaled an error for the expression beginning here
Re: Flexible lyric alignment,Re: Flexible lyric alignment
On Sat, Nov 19, 2022 at 3:23 PM Jean Abou Samra wrote: > Le 17/11/2022 à 23:02, Jean Abou Samra a écrit : > > Le 17/11/2022 à 23:01, Werner LEMBERG a écrit : > > But how do you take into account the constraints from lyrics here? > > That is the whole problem. > They should be completely ignored. > >>> In that case, it should be completely doable even in Scheme now. > >>> (I started writing some code yesterday in response to Abraham that > >>> does essentially that, maybe I'll have it finished today). > >> Aah, nice! > > > > No so fast, wait until it actually works before calling > > it nice, otherwise if it doesn't work I'll feel bad :-) > > > > > Here you go. > > This is a vast refinement of the initial \autoMove function that takes all > lyric words into account simultaneously, finding an optimal solution that > minimizes the distance from each lyric word to its note while respecting > the minimal distances between lyric words as configured by > LyricSpace.minimum-distance / LyricHyphen.minimum-distance. > > I used the first algorithm with acceptable complexity that I could > think of, so there may be a simpler solution for this. Nevertheless, > it runs in linear time, so I'm happy enough. (If it were quadratic > or worse, the running time could potentially be problematic if > ly:one-line-auto-height breaking is used, in which case there can > be lots of lyrics on the same line.) > > Caveats: > > - As said in a previous message, this is the other extreme compared >to what LilyPond does by default: lyrics are not taken into account >*at all* into note spacing. In particular, LilyPond may produce >a page breaking configuration in which there are too many notes on >the same system to fit the lyrics comfortably. I expect that using >\break in those cases will often be enough to get an acceptable result, >but I have zero experience with typesetting music with lyrics. >(And little actual practical experience with typesetting music at >all, to be honest.) > > - I have barely tested it. > > Additional featurelets: > > - You can still set LyricText.self-alignment-X. It defines the position >of the LyricText that the algorithm will consider optimal. > > - You can set LyricText.details.strength to tell the algorithm to >place one specific syllable closer to its note at the expense >of the others. See the example. > > Before someone asks: this is not good to integrate into LilyPond as-is, > because it breaks assumptions that grob implementors and LilyPond in > general make (namely, the assumption that the X-offset of an item is > known before line breaking). One would have to either go for a full > solution as brainstormed in one of my earlier messages, or at least > find a way for an Item to declare that its positioning depends on other > things (akin to the current cross-staff property, but preferably less > invasive). > > Hope that helps, > Jean > > This looks absolutely amazing! I'm running into some compiler issues when I try to run it on my machine, but I'll see if I can work out why and let you know if I'm unable. Either way, bravo! The output looks like it will fix many situations automagically. This seems to be a fantastic step in the right direction. Generally, I end up controlling the system breaking in the end, anyway, so I'm not too concerned about the possibility of too long a line. Many thanks, Abraham
Re: Splitting voices
Le 20/11/2022 à 00:02, Luca Fascione a écrit : Hi all, I have some 2 voice music coming from musicxml like this 4 8. 16 ~ ~ 2. and I'd like to split it into 2 voices instead: << \new Voice ... { ... a4 g8. d16~ d2. ... } \new Voice ... { ... c4 b8. g16~ g2. ... } >> is there any software / trick that I could use? (I use Frescobaldi, but I couldn't find a transformation for this purpose) There are a number of snippets floating around for that IIRC, basically variations on the theme \version "2.22.2" #(use-modules (ice-9 receive)) selectNote = #(define-music-function (index music) (index? ly:music?) (music-map (lambda (m) (if (music-is-of-type? m 'event-chord) (let ((elts (ly:music-property m 'elements))) (receive (rhythmic arts) (partition (music-type-predicate 'rhythmic-event) elts) (if (< (1- index) (length rhythmic)) (let* ((elt (list-ref elts (1- index))) (elt-arts (ly:music-property elt 'articulations))) (set! (ly:music-property elt 'articulations) (append elt-arts (map ly:music-deep-copy arts))) elt) #{ #}))) m)) music)) mus = \relative { 4 8. 16~ 2. } \new Staff << \new Voice { \voiceOne \selectNote 2 \mus } \new Voice { \voiceTwo \selectNote 1 \mus } >> Best, Jean OpenPGP_signature Description: OpenPGP digital signature
Re: Polymetric math
Le 20/11/2022 à 00:01, David Santamauro a écrit : Indeed … thanks for the quick response. This is at least the third time someone posts on a LilyPond list with this question, so I've submitted a patch to add the extra (redundant) braces in the documentation. https://gitlab.com/lilypond/lilypond/-/merge_requests/1738 Best, Jean OpenPGP_signature Description: OpenPGP digital signature
Splitting voices
Hi all, I have some 2 voice music coming from musicxml like this 4 8. 16 ~ ~ 2. and I'd like to split it into 2 voices instead: << \new Voice ... { ... a4 g8. d16~ d2. ... } \new Voice ... { ... c4 b8. g16~ g2. ... } >> is there any software / trick that I could use? (I use Frescobaldi, but I couldn't find a transformation for this purpose) Cheers, Luca -- Luca Fascione
Re: Polymetric math
Indeed … thanks for the quick response. On 11/19/22, 5:55 PM, "Jean Abou Samra" wrote: Le 19/11/2022 à 23:45, David Santamauro a écrit : > > Hi, > > I’m typesetting an ensemble piece in 4/4 where one instrument goes to > 6/4 – basically short-hand for not having to write two groups of > quarter note triples for a longer duration. If I follow the > documentation, it should be (according to the math): 2/3 * 6/4 = 12/12 > (4/4). But the following doesn’t work: > > \version "2.22.2" > > \include "english.ly" > > \relative << > > \new Staff { > > \time 4/4 > > c'4 c c c | > > c4 c c c | > > } > > \new Staff { > > \time 4/4 > > \set Staff.timeSignatureFraction = 6/4 > > \scaleDurations 2/3 > > c4 c c c c c > > } > > >> > > This is my first sojourn into polymetrics with lilpond, so any > rudimentary help would be appreciated. > Interestingly, someone else asked about the exact same misunderstanding not long ago. https://lists.gnu.org/archive/html/lilypond-user/2022-10/msg00362.html TL;DR: mind the braces. Best, Jean
Re: Polymetric math
Le 19/11/2022 à 23:45, David Santamauro a écrit : Hi, I’m typesetting an ensemble piece in 4/4 where one instrument goes to 6/4 – basically short-hand for not having to write two groups of quarter note triples for a longer duration. If I follow the documentation, it should be (according to the math): 2/3 * 6/4 = 12/12 (4/4). But the following doesn’t work: \version "2.22.2" \include "english.ly" \relative << \new Staff { \time 4/4 c'4 c c c | c4 c c c | } \new Staff { \time 4/4 \set Staff.timeSignatureFraction = 6/4 \scaleDurations 2/3 c4 c c c c c } >> This is my first sojourn into polymetrics with lilpond, so any rudimentary help would be appreciated. Interestingly, someone else asked about the exact same misunderstanding not long ago. https://lists.gnu.org/archive/html/lilypond-user/2022-10/msg00362.html TL;DR: mind the braces. Best, Jean OpenPGP_signature Description: OpenPGP digital signature
Polymetric math
Hi, I’m typesetting an ensemble piece in 4/4 where one instrument goes to 6/4 – basically short-hand for not having to write two groups of quarter note triples for a longer duration. If I follow the documentation, it should be (according to the math): 2/3 * 6/4 = 12/12 (4/4). But the following doesn’t work: \version "2.22.2" \include "english.ly" \relative << \new Staff { \time 4/4 c'4 c c c | c4 c c c | } \new Staff { \time 4/4 \set Staff.timeSignatureFraction = 6/4 \scaleDurations 2/3 c4 c c c c c } >> This is my first sojourn into polymetrics with lilpond, so any rudimentary help would be appreciated. Thanks
Re: Flexible lyric alignment,Re: Flexible lyric alignment
Le 17/11/2022 à 23:02, Jean Abou Samra a écrit : Le 17/11/2022 à 23:01, Werner LEMBERG a écrit : But how do you take into account the constraints from lyrics here? That is the whole problem. They should be completely ignored. In that case, it should be completely doable even in Scheme now. (I started writing some code yesterday in response to Abraham that does essentially that, maybe I'll have it finished today). Aah, nice! No so fast, wait until it actually works before calling it nice, otherwise if it doesn't work I'll feel bad :-) Here you go. This is a vast refinement of the initial \autoMove function that takes all lyric words into account simultaneously, finding an optimal solution that minimizes the distance from each lyric word to its note while respecting the minimal distances between lyric words as configured by LyricSpace.minimum-distance / LyricHyphen.minimum-distance. I used the first algorithm with acceptable complexity that I could think of, so there may be a simpler solution for this. Nevertheless, it runs in linear time, so I'm happy enough. (If it were quadratic or worse, the running time could potentially be problematic if ly:one-line-auto-height breaking is used, in which case there can be lots of lyrics on the same line.) Caveats: - As said in a previous message, this is the other extreme compared to what LilyPond does by default: lyrics are not taken into account *at all* into note spacing. In particular, LilyPond may produce a page breaking configuration in which there are too many notes on the same system to fit the lyrics comfortably. I expect that using \break in those cases will often be enough to get an acceptable result, but I have zero experience with typesetting music with lyrics. (And little actual practical experience with typesetting music at all, to be honest.) - I have barely tested it. Additional featurelets: - You can still set LyricText.self-alignment-X. It defines the position of the LyricText that the algorithm will consider optimal. - You can set LyricText.details.strength to tell the algorithm to place one specific syllable closer to its note at the expense of the others. See the example. Before someone asks: this is not good to integrate into LilyPond as-is, because it breaks assumptions that grob implementors and LilyPond in general make (namely, the assumption that the X-offset of an item is known before line breaking). One would have to either go for a full solution as brainstormed in one of my earlier messages, or at least find a way for an Item to declare that its positioning depends on other things (akin to the current cross-staff property, but preferably less invasive). Hope that helps, Jean % Copyright (C) 2022, Jean Abou Samra % Placed under the Creative Commons CC0 1.0 Universal license. \version "2.23.81" #(ly:set-option 'compile-scheme-code) #(use-modules (ice-9 match) (ice-9 hash-table) (oop goops)) %% convenience stuff: #(define-syntax-rule (transform! lval proc) (set! lval (proc lval))) #(define -> (make-procedure-with-setter (lambda (instance . path) (let loop ((instance instance) (path path)) (match path ((slot) (slot-ref instance slot)) ((slot . rest) (loop (slot-ref instance slot) rest) (lambda (instance . args) (let loop ((instance instance) (args args)) (match args ((slot new) (slot-set! instance slot new)) ((slot . rest) (loop (slot-ref instance slot) rest))) #(define-class () (ideal #:init-keyword #:ideal) (extent #:init-keyword #:extent) (strength #:init-keyword #:strength) (tied-to #:init-value #f) (tied-offset #:init-value #f) (final #:init-value #f)) #(define (merged-variable! group var) (let* ((delta (- (interval-end (-> group 'extent)) (interval-start (-> var 'extent (new (make #:ideal (/ (+ (* (-> group 'strength) (-> group 'ideal)) (* (-> var 'strength) (- (-> var 'ideal) delta))) (+ (-> group 'strength) (-> var 'strength))) #:extent (cons (interval-start (-> group 'extent)) (+ (interval-end (-> group 'extent)) (interval-length (-> var 'extent #:strength (+ (-> group 'strength) (-> var 'strength) (set! (-> group 'tied-to) new) (set! (-> group 'tied-offset) 0) (set! (-> var 'tied-to) new) (set! (-> var 'tied-offset) delta) new)) #(define (propagate! variables) (match variables ((var) variables) ((var group . rest) (let
Re: table-of-contents for multiple books per ly-file
Am Sa., 19. Nov. 2022 um 14:48 Uhr schrieb Jean Abou Samra : > > Le 19/11/2022 à 14:43, Thomas Morley a écrit : > > Though, I can't use a modified version of the new code setting > > `toc-items' because dong so in an own ly-file causes: > > fatal error: call-after-session used after session start > > > This comes from > > (call-after-session (lambda () > (hash-clear! toc-hashtab) > (set! toc-alist '()) > (hash-clear! toc-name-id-hashtab))) > > This clears the TOC data structures after processing each > .ly file, to ensure there are no leaks from a .ly file to > the next if processing several files with the same lilypond > invocation. > > call-after-session can only be used in LilyPond's internal > .ly files, not in user files. > > If you don't care about that, just delete it. > > Best, > Jean > > Hi Jean, thanks for the hint. Attached my current (ugly) workaround. Thanks, Harm \version "2.23.80" %% TODO: this should be per-book, issue #4227 #(let (;; Maps TOC item IDs (symbols) to alists (toc-hashtab (make-hash-table)) ;; Same, in alist form. This is what we eventually want to return, but a ;; hash table avoids quadratic algorithms while constructing the TOC tree. (toc-alist '()) ;; Map names, i.e. terminal symbols of the paths ;; (\tocItem foo.bar.baz ... has the name 'baz) to ;; TOC IDs. (toc-name-id-hashtab (make-hash-table))) ;; NB Commenting next lines may cause bleed-over into next session, while ;; doing: lilypond file-1.ly file-2.ly ;; Though otherwise we cannpt use this coding ;; ;; (call-after-session (lambda () ;; (hash-clear! toc-hashtab) ;; (set! toc-alist '()) ;; (hash-clear! toc-name-id-hashtab))) (set! add-toc-item! (lambda* (markup-symbol text #:optional raw-path) (let* ((id (gensym "toc")) (path (cond ((symbol? raw-path) (list raw-path)) ;; Without a raw-path, we add an entry at the toplevel, which ;; is the same as a one-element raw-path. ((or (not raw-path) (null? raw-path)) (list id)) ((list? raw-path) raw-path) (else (begin (ly:warning (_i "Invalid toc label: ~a") raw-path)) (list id (level ;; Find which existing TOC entry, if any, to attach this entry to. ;; The principle is that the first element of path is interpreted specially: ;; it can refer to a previously defined nested node, as with ;; \tocItem foo.bar "x" ;; \tocItem bar.baz "y" ;; This attaches bar as a subtree of foo, which can be handy in ;; large nested TOCs. If there are several possibilities (foo.bar ;; and baz.bar), we choose the one that added last. This is ;; achieved by simply overwriting any existing entry in ;; toc-name-id-hashtab when doing the hashq-set!. (match path ((single) (hashq-set! toc-name-id-hashtab single id) 0) ((head . tail) (let* ((node-id (hashq-ref toc-name-id-hashtab head)) (entry (and node-id (hashq-ref toc-hashtab node-id (let loop ((path path) ;; entry corresponds to the entry for the first element ;; in the path. path still contains its name so a warning ;; can be emitted if entry is #f. (entry entry) (level (and entry (1+ (assq-ref entry 'level) (if entry (let ((children (assq-ref entry 'children))) (match path ((head name) ;; The last component is a newly created node. (hashq-set! children name id) (hashq-set! toc-name-id-hashtab name id) level) ((head . (and remaining (child . rest))) (loop remaining (let ((child-id (hashq-ref children child))) (and child-id (hashq-ref toc-hashtab child-id))) (1+ level) (begin
Re: Checkpoints
At 11:46 on 19 Nov 2022, Kieren MacMillan wrote: >>> p.s. Jean: Any reason why this shouldn’t be in the core codebase?! >>> I will gladly take this one on — including documentation — if it’s >>> patch-worthy. >> >> IMHO it is. > and watched everything Do The Right Thing™. The only buglet I've come across is that final notes can be silently converted to whole notes, however this is easy to work around. (Probably also fixable, but I've never bothered.) Change the definition of accompaniment to the following to demonstrate: accompaniment = \relative c' { \repeat unfold 3 b1 R1 \tag #'verse b2 b2 R2 \tag #'bridge c1 R1 \tag #'coda d2. d4. R1*9/8*3 r2. d8 8 8 % NB final 8th note becomes a whole note... % | ... unless it is followed by a barcheck } -- Mark Knoop
Re: Checkpoints
Hi all, >> p.s. Jean: Any reason why this shouldn’t be in the core codebase?! >> I will gladly take this one on — including documentation — if it’s >> patch-worthy. > > IMHO it is. I just changed s4*3*5 in global to s4*3*10 and watched everything Do The Right Thing™. I’m not too proud to admit I teared up a little. :) — Kieren
Re: Checkpoints
>> > > Oh, goodness… This is like a Plato’s Cave moment for me in Lilypond. > I honestly can’t believe I haven’t had this in my quiver. Unless > somebody (Jean? David K?) says this is somehow a sub-optimal > implementation, I am using this in everything from now on. Indeed, this looks extremely useful. For example, I can imagine to combine this with a small function that automatically adds a tag for a rehearsal mark... > p.s. Jean: Any reason why this shouldn’t be in the core codebase?! > I will gladly take this one on — including documentation — if it’s > patch-worthy. IMHO it is. Werner
Re: Checkpoints (was re: Adding durations (for \after))
Hi Mark, > Oh, goodness… This is like a Plato’s Cave moment for me in Lilypond. I honestly can’t believe I haven’t had this in my quiver. Unless somebody (Jean? David K?) says this is somehow a sub-optimal implementation, I am using this in everything from now on. Thank you so much! Kieren. p.s. Jean: Any reason why this shouldn’t be in the core codebase?! I will gladly take this one on — including documentation — if it’s patch-worthy.
Re: Checkpoints (was re: Adding durations (for \after))
At 08:59 on 19 Nov 2022, Kieren MacMillan wrote: >> I have been using \alignTo for years for this purpose, I think >> originally from this thread: >> https://lists.gnu.org/archive/html/lilypond-user/2013-12/msg01296.html > I'm somewhat embarrassed to say that I was on that thread and totally > forgot about it! > Can you provide a MWE of the feature for us? Attached is the ily file from my standard library. Just uncomment the bottom section for the example. alignTo.ily Description: Binary data -- Mark Knoop
Re: Checkpoints (was re: Adding durations (for \after))
Hi Mark, > I have been using \alignTo for years for this purpose, I think originally > from this thread: > https://lists.gnu.org/archive/html/lilypond-user/2013-12/msg01296.html I'm somewhat embarrassed to say that I was on that thread and totally forgot about it! Can you provide a MWE of the feature for us? Thanks! Kieren.
Re: table-of-contents for multiple books per ly-file
Le 19/11/2022 à 14:43, Thomas Morley a écrit : Though, I can't use a modified version of the new code setting `toc-items' because dong so in an own ly-file causes: fatal error: call-after-session used after session start This comes from (call-after-session (lambda () (hash-clear! toc-hashtab) (set! toc-alist '()) (hash-clear! toc-name-id-hashtab))) This clears the TOC data structures after processing each .ly file, to ensure there are no leaks from a .ly file to the next if processing several files with the same lilypond invocation. call-after-session can only be used in LilyPond's internal .ly files, not in user files. If you don't care about that, just delete it. Best, Jean OpenPGP_signature Description: OpenPGP digital signature
Re: ghostscript 9.56.1 in lilypond 2.23.14 no longer finds font Helvetica-Bold, but gs in 2.22.1 did
For what it's worth, I have submitted a patch to clearly document why \postscript should be a last resort. https://gitlab.com/lilypond/lilypond/-/merge_requests/1735 Best, Jean OpenPGP_signature Description: OpenPGP digital signature
table-of-contents for multiple books per ly-file
Hi, this is about #4227 "Tables of contents are not independent between \books" https://gitlab.com/lilypond/lilypond/-/issues/4227 My previous workaround was to abuse the 'name entry in each toc-item, i.e. I used a custom `tabel-of-contents'-markup-command filtering `toc-items' for a certain name and only print the remaining ones per book (ofcourse this made hierarchical indents impossible, which was acceptable). Alas, that 'name-entry is gone with: commit 33ca296b8c71d0e30352653d2108445e3395b74e Author: Jean Abou Samra Date: Mon Jul 11 13:34:34 2022 +0200 Fix possible naming conflicts in structured TOCs While the head of the path can refer to a nested node, the rest of the path is now interpreted by always looking up a direct child of the previous node. This fixes odd conflicts when several nested nodes have the same path, although it is still not possible (by design) to have a nested node called something, and then a root node called the same. Nonexistent nodes (trying to do \tocItem foo.bar before \tocItem foo) are no longer silent, but now emit a warning. This uses modification of hash tables instead of mutation of alists, so it also happens to fix #6302, caused by alist pairs being shared. Fixes #6302, #6384 Though, I can't use a modified version of the new code setting `toc-items' because dong so in an own ly-file causes: fatal error: call-after-session used after session start So, #4227 persist and my workaround is gone... Any idea how to make it work? Here some basic code to play with: \version "2.23.80" \book { \markuplist \table-of-contents \tocItem \markup "bookI" { r1 } } \book { \markuplist \table-of-contents \tocItem \markup \italic "bookII" { r1 } } Thanks, Harm
Re: Getting grob Y position (spacing error)
> Le 19 nov. 2022 à 02:37, Gregory Evans a > écrit : > > Hello Jean, > thank you for the information about after-line-breaking and the timing of > skyline computing. Is there an equivalent property to trigger callback after > the skylines are calculated? > I’m afraid not. There are lower-level techniques you can use for that though, but see below for why you won’t need them. > I am trying to use (ly:stencil-add ...) to add to the stencil of a notehead > by drawing a line from one notehead in one staff to a notehead in another > staff. > Have you seen the VoiceFollower grob? Try using that instead. By reading things in 'left-bound-info and 'right-bound-info, you can also spare yourself quite some code. > The notehead grob does not appear to have a cross-staff property to delay > stencil callback. > NoteHead is a very fundamental grob at the heart of a lot of code (note collision handling, beams, note spacing, etc.). That code makes reasonable assumptions about the note heads and doesn’t expect cross-staff note heads. > \language "english" > \version "2.23.14" > > #(set-global-staff-size 12) > > \score { > << > \new Staff { > \override NoteHead.cross-staff = ##t > \once \override NoteHead.after-line-breaking = #(lambda (grob) > (let* > ( >(sys (ly:grob-system grob)) >(x-extent (ly:grob-extent grob sys X)) >(y-extent (ly:grob-extent grob sys Y)) > ) > (display (list x-extent )) > ) > ) > c'1 > c'1 > c'1 > c'1 > } > \new Staff { > c'1 > c'1 > c'1 > c'1 > } > >> > } > A larger example of the function (without a great deal of context) looks like > this: > > interrupt = #(define-music-function (value) (number?) > #{ > \once \override Staff.NoteHead.after-line-breaking = #(lambda (grob) > (let* ( > (stem (ly:grob-object grob 'stem)) > (stem-dir (ly:grob-property stem 'direction)) > (stem-thickness (ly:grob-property stem 'thickness)) > (thickness (/ stem-thickness 10)) > (notecol (ly:grob-parent grob X)) > (meta (assoc 'other-grob (ly:grob-property notecol 'meta))) Have you seen ly:grob-object and ly:grob-set-object! ? That would be way cleaner than abusing 'meta for this purpose. There is also 'details you can use instead of 'meta. > (other (if meta > (cdr meta) > grob > )) > (notehead-width (cdr (ly:grob-property grob 'X-extent))) > (sys (ly:grob-system grob)) > (now-pos (ly:grob-extent grob sys X)) > (next-pos (ly:grob-extent other sys X)) > > ;;the offending lines > (now-pos-y (ly:grob-extent grob common Y)) > (next-pos-y (ly:grob-extent other common Y)) > > (x-distance > (if (= stem-dir -1) > (+ (- (get-distance now-pos next-pos) notehead-width ) > (/ thickness 2)) > (- (get-distance now-pos next-pos) (/ thickness 2)) > )) > (y-distance > (if (= stem-dir -1) > (+ (- (get-distance now-pos-y next-pos-y) > notehead-width ) (/ thickness 2)) > (- (get-distance now-pos-y next-pos-y) (/ thickness 2)) > )) > > ;; alternative which takes input number > ;(ps-bracket > ;(if (= stem-dir -1) > ; (draw-ps-bracket x-distance notehead-width (- value > 0.5) thickness) > ; (draw-ps-bracket x-distance notehead-width value > thickness) > ;)) > (ps-bracket Does 'ps' stand for PostScript? Best, Jean