10
votes
Accepted
Difference between "Extending LilyPond" and "Scheme (in LilyPond)"
I will give my personal perspective as the author of “Extending LilyPond”.
Urs Liska's “Scheme (in LilyPond)” was left largely unfinished. Around 2020, having written most of the part about the Scheme ...
7
votes
Accepted
LilyPond: How to avoid pitch-squashed chords ending up as colliding noteheads?
The problem is that a chord consists of multiple notes, and squashing the pitch will only squash everything to the same pitch, but it does not remove notes from a chord. Thus you have multiple ...
7
votes
Accepted
How to pass duration to lilypond function
You need to call your function either like this
\disdn 8
or like this
\disdn #(ly:make-duration 3)
When you write #8 you tell Lilypond to use the guile object 8, which is a number. But if you write ...
7
votes
Accepted
How can I engrave consecutive rehearsal marks now that the multi-mark engraver does not work anymore for this purpose in Lilypond 2.24.1?
After reading the release notes, I have found a solution. It turned out we don't need anymore to use \mark to place our custom symbols and text above notes. Thus, multi-mark-engraver is not needed ...
6
votes
Accepted
Re-define lilypond's `format-mark-box-alphabet`
I think this is an XY question. Redefining a built-in procedure is called monkey-patching, and it is not advised, neither in LilyPond nor in most programming languages that allow it. Instead, you want ...
5
votes
Accepted
Get the current time signature numerator/denominator
Sadly, that's not really possible in LilyPond's current design. After the file has been parsed and music objects have been preprocessed by music functions, music enters "iteration", where ...
5
votes
Accepted
correctly calling a lilypond scheme function
What happens with the code
music = { ... }
$(pageSong title music)
is that the LilyPond parser scans the input just after the music expression { ... }, because if there were something like \addlyrics,...
5
votes
Accepted
Lilypond (v2.24) macro delivers unexpected results
The problem is very simple: in the first line of the definition, you have
#(define-markup-command (arrup layout props text) (markup?)
The words in the first set of parentheses are the function name ...
4
votes
Accepted
Custom dynamic mark
You can explicitly set the dimension of your markup using \with-dimensions (or in this case, as we are already within the definition of a Scheme macro, #:with-dimensions. This macro takes two Scheme ...
4
votes
Accepted
LilyPond: modifying woodwind diagrams
You can create new patterns using Scheme:
Creating new diagrams is possible, although this will require Scheme ability and may not be accessible to all users. The patterns for the diagrams are in ‘...
4
votes
Accepted
LilyPond: parenthesized hairpin
Just adjust the hairpin's span as needed using shorten-pair.
dynamics = {
s8 s8 s8 \parenthesizedHairpin s8\tweak shorten-pair #'(0 . 0.9)\> s8 s8 s8 s8 \! |
}
See the snippet "Moving the ...
4
votes
Accepted
How to define a LilyPond function to return set of notes given a pitch?
Your last attempt is almost good, you just need to use $note instead of #note. What's the difference? # introduces a Scheme expression directly as a music expression bypassing any change or ...
4
votes
Lilypond function to interpolate two notes
Here's a small library I wrote to write scales for my students that does somewhat what you are asking.
\version "2.18.2"
%{
Before: scaleNotes is an AssociationList mapping all integers from ...
4
votes
Custom dynamic mark
If you use this definition that looks just like a dynamic mark,
mff= _ \markup { \dynamic mf \italic \teeny "2ème fois" \dynamic f }
then the result is this:
4
votes
Get the current time signature numerator/denominator
It would be possible to wrap each part in music functions that keep track of the time signatures (if we only have one part we would not in fact need this and would be able to do this on toplevel). ...
4
votes
Accepted
How to display Alt chords in Lilypond?
Of course we could use \chordmode to enter that chord as e:9-.10-.11+.13-. But if you need this more often you could define the chord modifier alt to simply be able to enter e:alt like this:
\version &...
4
votes
Accepted
How to conditionally add dynamics in music function?
There are two things fundamentally wrong here. First defining a new music function uses the command define-music-function, not make-music-function. Second to access something like \sf from within ...
4
votes
Accepted
Adding a page break to a book via Scheme
Toplevel \pageBreak et al. calls are translated to special objects that are called "page markers". This is internally done using collect-music-aux, which takes as first argument the score ...
4
votes
Re-define lilypond's `format-mark-box-alphabet`
I fully support Jeans answer, but I want to fill in some details about why your version does not work. The reason is not that you are trying to redefine built-in procedures (which you can totally do, ...
3
votes
Get the current time signature numerator/denominator
You can replace \time by a custom function which does the same and stores the current time signature in a global variable. This is very much contrary to the spirit of functional programming but should ...
3
votes
Accepted
Create new \score-like context/template in Lilypond
First a little remark: You can call the scheme function directly by \dscore.
Then you need to enter your music in drummode, so you need to use \drummode in the argument instead of the score. Then your ...
3
votes
Conditionally transpose up versus down in LilyPond?
I am still not fully sure whether I really understood what you want. Perhaps this code can help you:
The function takes three parameters before a musical expression (which would be your chord): the ...
Only top scored, non community-wiki answers of a minimum length are eligible