lilypond-user
[Top][All Lists]
Advanced

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

Re: issue with \transpose and \relative


From: David Kastrup
Subject: Re: issue with \transpose and \relative
Date: Wed, 06 Feb 2019 08:29:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

John Doe <address@hidden> writes:

> Hi, all,
>
> The Notation Reference section 1.1.2 says "Music inside a \transpose block
> is absolute unless a \relative is included in the block". I'm writing a
> function that uses \transpose to change a variable's pitch in a function.
>
> How can I check if the music entered was entered in a \relative block? Can
> I?
>
> Below is a minimal example showing the problem I'm having, along with a png
> (attached) demonstrating the output:
>
>     \version "2.19.82"
>     fall = #(define-music-function (input) (ly:music?)
>         #{ $input \transpose c g, $input #})
>               { \fall <e' b' e''>4 e2^"absolute"_"right"}
>     \relative { \fall <e' b' e>4e,2^"relative"_"wrong" }
>
> I hope this is clear enough—running low on sleep…

It's comparatively crappy but you can do

\version "2.19.82"
fall = #(define-music-function (input) (ly:music?)
    (make-relative (input) input #{ $input \transpose c g, $input #}))
          { \fall <e' b' e''>4 e2^"absolute"_"right"}
\relative { \fall <e' b' e>4e,2^"relative"_"wrong" }

This uses really involved code to simulate something that does not
really map well to LilyPond's internals so it may interfere with other
tricky code.  Particularly code that tries analyzing LilyPond code.

-- 
David Kastrup



reply via email to

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