lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scheme predicative types


From: Martín Rincón Botero
Subject: Scheme predicative types
Date: Wed, 16 Sep 2020 18:57:32 +0200

Dear all,

I just started writing my first scheme function :-). It basically substitutes for now our lack of a "tempo spanners" syntax, something that I still find quite irritating in Lilypond. It accepts a quite "clumsy" set of arguments, namely two markups for tempo and two "numbers" for padding. The little script looks like this

% usage
% \ritToMetronomeMark "Lilypond duration" "= "$yourtempo" #$left-padding #$right-padding
% $music\startTextSpan $music\stopTextSpan

ritToMetronomeMark = #(define-music-function
                   (parser location notemarkup tempomarkup paddingleft paddingright)
                   (markup? markup? number? number?)
                   #{
\once \override TextSpanner #'(bound-details left text) =  \markup \halign #paddingleft {"rit."}
\once \override TextSpanner #'(bound-details right text) = \markup \halign #paddingright { \general-align #Y #DOWN \smaller \note #notemarkup #1 \upright #tempomarkup }
                   #})

accelToMetronomeMark = #(define-music-function
                   (parser location notemarkup tempomarkup paddingleft paddingright)
                   (markup? markup? number? number?)
                   #{
\once \override TextSpanner #'(bound-details left text) =  \markup \halign #paddingleft {"accel."}
\once \override TextSpanner #'(bound-details right text) = \markup \halign #paddingright { \general-align #Y #DOWN \smaller \note #notemarkup #1 \upright #tempomarkup }
                   #})

After struggling with understanding Lilypond/Scheme's predicative types, of which I found basically no documentation other than a list of them with a minimal description here http://lilypond.org/doc/v2.20/Documentation/notation/predefined-type-predicates, I would like to ask what type of predicatives the \tempo function accepts. When you write \tempo 4 = 56, what does "4 = 56" for Scheme mean? This is of course something that I'm not using in my script yet, but knowing this might let me extend the script, namely that its usage accepts a proper tempo definition, so that (maybe with a more elegant syntax that doesn't use "" for each argument) I can also use that same number to give to an omitted tempo marking for MIDI playback.

Best regards,
Martín.

--
www.martinrinconbotero.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]