[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Combine Text/Lyrics with bass figures
From: |
Lukas-Fabian Moser |
Subject: |
Re: Combine Text/Lyrics with bass figures |
Date: |
Fri, 26 Jun 2020 15:01:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
Hi Urs, hi Moritz,
thanks for the improvements to my code! (I tend to stop thinking
about it as soon as it works for my case, which always leaves lots of
room for improvement.)
Seems to be the opposite of my approach. I'm always starting to think
in terms of reusability and "packages" right away - leading to working
code much later than would be good ;-)
When your default working mode is "I need this worksheet tomorrow by 9
o'clock", the approach of using the first sort-of viable solution
becomes much more tempting ;-).
(2) There might also be cases where you have more that one row of arabic
numbers to indicate other options. My first intention here would be to have a
single layer for every key, that is used in the analysis. If there’s an option
to hide the layer where it is not used.
Each layer is a Lyrics or FiguredBass context, [...]
That's exactly what occurred to me over lunch: Everything we talked
about concerning spacing just expresses the fact that scale degrees and
bass figures should behave as if they were independent contexts (one
FiguredBass, one Lyrics).
So let's scrap the idea of inserting scale degrees artificially into
bass figures where they do not belong!
Hence:
\version "2.20.0"
#(define (scale-degree degree)
(if (eqv? degree 0)
(markup #:null)
(markup #:circle #:small #:number (number->string degree))))
#(define (bass-degree? obj)
"A bass degree is either a number between 1 and 7 or 0 (eqv. to
nothing)!"
(and (integer? obj) (> 8 obj) (< -1 obj)))
#(define (event-chord? obj)
(and (ly:music? obj) (music-is-of-type? obj 'event-chord)))
#(define (figure-signature? obj)
"A figure signature is either an EventChord music or a duration."
(or
(event-chord? obj)
(ly:duration? obj)))
duration-from-event-chord =
#(define-scheme-function (chord) (event-chord?)
(let ((els (ly:music-property chord 'elements)))
(ly:music-property (first els) 'duration)))
scaledeg =
#(define-music-function (num signature) ((bass-degree? 0) figure-signature?)
(let ((dur (if (ly:duration? signature)
signature
(duration-from-event-chord signature))))
#{
<<
#(if (ly:music? signature)
signature
#{ s $signature #})
\context Lyrics = "scaleDegrees" \lyricmode
{
\markup { #(scale-degree num) } $dur
}
>>
#}))
<<
\new Staff {
\time 3/4
\clef bass
c4 d e f2 g4 as2^"or g sharp?" a4 b4 c'4 % Morgenlich leuchtend ...
}
\figures \with { \override
VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = 1 } {
\scaledeg 1 4
\scaledeg 2 <4 3>4
\scaledeg 3 <6>4
\scaledeg 4 <7>4
\scaledeg 0 <6>
\scaledeg 5 4
\scaledeg 6 <6>2
\scaledeg 6 <6>4
\scaledeg 7 <6 5>4
\scaledeg 1 4
}
\new Lyrics = "scaleDegrees" { \skip 1*8 }
>>
Of course this is just proof-of-concept: The Lyrics context should be
created (and kept alive) automatically ... or, even better: it should be
user-settable with an interface like:
\figures {
\inject-scaledegrees-into-context "scaleDegrees"
...
}
which would enable all sorts of vertical configuration.
Best
Lukas
- Combine Text/Lyrics with bass figures, Urs Liska, 2020/06/25
- Combine Text/Lyrics with bass figures, Jean Abou Samra, 2020/06/25
- Re: Combine Text/Lyrics with bass figures, Urs Liska, 2020/06/25
- Re: Combine Text/Lyrics with bass figures, Moritz Heffter, 2020/06/26
- Re: Combine Text/Lyrics with bass figures, Urs Liska, 2020/06/26
- Re: Combine Text/Lyrics with bass figures,
Lukas-Fabian Moser <=
- Re: Combine Text/Lyrics with bass figures, Urs Liska, 2020/06/26
- Re: Combine Text/Lyrics with bass figures, Urs Liska, 2020/06/26