lilypond-user
[Top][All Lists]
Advanced

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

Re: Question re: scheme, \transpose function


From: Yoshiaki Onishi
Subject: Re: Question re: scheme, \transpose function
Date: Fri, 13 Sep 2024 14:54:01 -0400

Thank you for your insight, Saul,

For the foregoing code, I replaced $ with #, but now that isn't working, producing similar result as the first example of this LilyPond manual: https://lilypond.org/doc/v2.25/Documentation/notation/substitution-functions-and-relative-octave-entry 

I will try to keep experimenting, trying again with make-relative function, but if you or anyone have any insight, I'd be happy to hear.

Thanks again,
Yoshi

On Fri, Sep 13, 2024 at 11:10 AM Saul Tobin <saul.james.tobin@gmail.com> wrote:

I believe this stems from using $ rather than #, since this will insert literally c' and cause the apostrophe to be parsed twice. I'm away from my computer right now so can't actually test the example.

Saul


On Fri, Sep 13, 2024, 10:58 AM Yoshiaki Onishi <info@yoshionishi.com> wrote:
Dear LilyPond Community,

In the interest of learning more about Scheme as used in LilyPond (and learning LilyPond in general!), I am currently in the process of making a shortcut function that handles the artificial harmonic notation of string instruments instead of typing "<note note \harmonic >"However, something must be wrong with the way I am handling \transpose in the scheme code, and there are some instances of the artificial harmonics that don't render correctly. Code (as tiny as I could manage!) and screenshot attached. I'd be grateful in advance if anyone could enlighten me on this. 

(Context: I am/was a Finale user with some coding background who rediscovered the LilyPond's goodness and this is week 3 of learning it together with students at the university I work. Part of me wished there was a way to specify the interval of transposition by some kind of interval name followed by a direction, rather than "frompitch topitch"...but I know this has some intricacies with absolute vs relative pitch notation...)

Thanks in advance!
Yoshi

=====

\version "2.24.4"
% I tried to use (make-relative) macro to see if it helped with anything, but to no avail.
hf = #(define-music-function (note1) (ly:music?)
        #{ < #note1 \transpose c f $note1 \harmonic > #}
        )
{
  \time 3/4
  \relative c'
  {c'16 \hf b \hf bes \hf a \hf as \hf g \hf fis \hf f \hf e \hf es \hf d \hf des | \hf c \hf b }
}

image.png



reply via email to

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