Re: Leadsheet with cadenza / ad lib.
Hi Leo Hi Valentin Thanks a lot for your quick replies. Since my need is very local and limited, Leo's proposal works perfectly fine for me. Valentin, your extensive solution might be worth adding to the LSR, right? Best regards Stephan Am 08.06.2023 um 15:28 schrieb Valentin Petzel: Hello Stephan, hello Leo, depending on the circumstances it might be useful to replace cadenzas with scaled duration such that the music fits a whole measue. Using a small helper function one might do something like this: % scaleMusicTo = #(define-music-function (duration mus) (fraction? ly:music?) (let* ((mdur (ly:music-length mus)) (mdur (/ (ly:moment-main-numerator mdur) (ly:moment-main-denominator mdur))) (tdur (/ (car duration) (cdr duration (scaleDurations (/ tdur mdur) mus))) melody = \relative c'' { \global \scaleMusicTo 1/1 { \repeat unfold 19 { a16 } } R1\fermata \scaleMusicTo 1/1 { \repeat unfold 21 { f16 } f16\fermata } R1 \fine } % The disadvantage of this is of course that Lilypond is going to treat these note values as smaller note values than what is notated, which will affect spacing. Alternatively you could define your cadenzas outside and automatically have correct length rests and skips done: % cadenza = #(define-music-function (n) (number?) #{ \cadenzaOn $(assoc-get n cadenzas) \cadenzaOff \bar "|" #}) cadenzaD = #(define-scheme-function (n) (number?) (let* ((c (assoc-get n cadenzas)) (dur (ly:music-length c)) (dur (/ (ly:moment-main-numerator dur) (ly:moment-main-denominator dur dur)) cadenzaR = #(define-music-function (n) (number?) #{ R1*$(cadenzaD n) #}) cadenzaS = #(define-music-function (n) (number?) #{ s1*$(cadenzaD n) #}) cadenzas.1 = \repeat unfold 19 { a16 } cadenzas.2 = { \repeat unfold 21 { f16 } f16\fermata } melody = \relative c'' { \global \cadenza 1 R1\fermata \cadenza 2 R1 \fine } harmonies = \chordmode { \global \cadenzaS 1 a1:m \cadenzaS 2 f1:m \fine } % But note that this still causes bugs, because cadenzas do not play well with multimeasure rests: { \cadenzaOn c8 \cadenzaOff \bar "|" R1 } This is because Lilypond does not handle cadenzas as an arbitrary length measure, but simply stops timing. So instead of \cadenzaOn and \cadenzaOff you could automatically use a suitable \partial: % cadenza = #(define-music-function (n) (number?) #{ \partial #(ly:make-duration 0 0 (cadenzaD n)) $(assoc-get n cadenzas) #}) % Cheers, Valentin
Re: Leadsheet with cadenza / ad lib.
Hello Stephan, hello Leo, depending on the circumstances it might be useful to replace cadenzas with scaled duration such that the music fits a whole measue. Using a small helper function one might do something like this: % scaleMusicTo = #(define-music-function (duration mus) (fraction? ly:music?) (let* ((mdur (ly:music-length mus)) (mdur (/ (ly:moment-main-numerator mdur) (ly:moment-main-denominator mdur))) (tdur (/ (car duration) (cdr duration (scaleDurations (/ tdur mdur) mus))) melody = \relative c'' { \global \scaleMusicTo 1/1 { \repeat unfold 19 { a16 } } R1\fermata \scaleMusicTo 1/1 { \repeat unfold 21 { f16 } f16\fermata } R1 \fine } % The disadvantage of this is of course that Lilypond is going to treat these note values as smaller note values than what is notated, which will affect spacing. Alternatively you could define your cadenzas outside and automatically have correct length rests and skips done: % cadenza = #(define-music-function (n) (number?) #{ \cadenzaOn $(assoc-get n cadenzas) \cadenzaOff \bar "|" #}) cadenzaD = #(define-scheme-function (n) (number?) (let* ((c (assoc-get n cadenzas)) (dur (ly:music-length c)) (dur (/ (ly:moment-main-numerator dur) (ly:moment-main-denominator dur dur)) cadenzaR = #(define-music-function (n) (number?) #{ R1*$(cadenzaD n) #}) cadenzaS = #(define-music-function (n) (number?) #{ s1*$(cadenzaD n) #}) cadenzas.1 = \repeat unfold 19 { a16 } cadenzas.2 = { \repeat unfold 21 { f16 } f16\fermata } melody = \relative c'' { \global \cadenza 1 R1\fermata \cadenza 2 R1 \fine } harmonies = \chordmode { \global \cadenzaS 1 a1:m \cadenzaS 2 f1:m \fine } % But note that this still causes bugs, because cadenzas do not play well with multimeasure rests: { \cadenzaOn c8 \cadenzaOff \bar "|" R1 } This is because Lilypond does not handle cadenzas as an arbitrary length measure, but simply stops timing. So instead of \cadenzaOn and \cadenzaOff you could automatically use a suitable \partial: % cadenza = #(define-music-function (n) (number?) #{ \partial #(ly:make-duration 0 0 (cadenzaD n)) $(assoc-get n cadenzas) #}) % Cheers, Valentin signature.asc Description: This is a digitally signed message part.
Re: Leadsheet with cadenza / ad lib.
What is aligned in Lilypond is not the bars, but the lengths of the notes/skips/rests. CadenzaOn allows you to have a bar of arbitrary length, but does not negate the alignment of the note values (it’s also valid for all staves, as long as you haven’t moved engravers around). Your harmonies still need to have the same length as the melody, so: harmonies = \chordmode { \global s16*19 a1:m s16*22 f1:m \fine } HTH /Leo > 8 juni 2023 kl. 00:44 skrev Stephan Schöll : > > Hi all > > I have a song that starts with 1 bar of adlib (without accompaniment), 1 > bar of silence in the melody, but with a chord, then another melody > adlib bar without accompaniment, and finally (in this example) again a > bar with chords only (w/o accompaniment). I cannot figure out how to > align the bars of the two parts (melody and chords, and further ones > later) properly. I tried to move the Timing_translator from the score to > the staff context but without success. Any advice is highly appreciated. > > TIA, Stephan > > BTW: the song is "Somethings' Got A Hold On Me" by Etta James - the > notes in the MVE do not match yet of course ;-) > > \version "2.24.1" > > global = { > \key c \major > \time 4/4 > } > > melody = \relative c'' { > \global > \cadenzaOn > \repeat unfold 19 { a16 } > \cadenzaOff > \bar "|" > R1\fermata > \cadenzaOn > \repeat unfold 21 { f16 } f16\fermata > \cadenzaOff > \bar "|" > R1 > \fine > } > > harmonies = \chordmode { > \global > s1 > a1:m > s1 > f1:m > \fine > } > > melodyPart = \new Staff { > \melody > } > > chordPart = \new ChordNames { \harmonies } > > \score { > << > \chordPart > \melodyPart > >> > \layout {} > } > >
Leadsheet with cadenza / ad lib.
Hi all I have a song that starts with 1 bar of adlib (without accompaniment), 1 bar of silence in the melody, but with a chord, then another melody adlib bar without accompaniment, and finally (in this example) again a bar with chords only (w/o accompaniment). I cannot figure out how to align the bars of the two parts (melody and chords, and further ones later) properly. I tried to move the Timing_translator from the score to the staff context but without success. Any advice is highly appreciated. TIA, Stephan BTW: the song is "Somethings' Got A Hold On Me" by Etta James - the notes in the MVE do not match yet of course ;-) \version "2.24.1" global = { \key c \major \time 4/4 } melody = \relative c'' { \global \cadenzaOn \repeat unfold 19 { a16 } \cadenzaOff \bar "|" R1\fermata \cadenzaOn \repeat unfold 21 { f16 } f16\fermata \cadenzaOff \bar "|" R1 \fine } harmonies = \chordmode { \global s1 a1:m s1 f1:m \fine } melodyPart = \new Staff { \melody } chordPart = \new ChordNames { \harmonies } \score { << \chordPart \melodyPart >> \layout {} }