lilypond-user
[Top][All Lists]
Advanced

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

A matter of optional arguments


From: Rip _Mus
Subject: A matter of optional arguments
Date: Fri, 23 Dec 2022 17:54:06 +0100

Hello everyone,
I'm working on a function that prints a personal type of tremolo.
This function has four arguments, the first and the last are optional.
The first is actually optional, as you can see in the minimal exemple attached. The last, instead, is problematic: if I omit it, there is an error.

%%%%
\version "2.24.0"

% to be used in a \relative environment
myTremolo = #(define-music-function
              (fr main-note aux-pitch st)
              ((fraction? 1/4) ly:music? ly:pitch? (symbol? 'default))
              #{
                $(remove-grace-property 'Voice 'Stem 'direction)
                \afterGrace #fr #main-note {
                  \autoBeamOff
                  \once \omit Beam
                  \once \omit Flag
                  \once \omit Accidental
                  \once \override Stem.transparent = ##t
                  \once \override StemTremolo.beam-width = 1
                  \once \override StemTremolo.slope = 0
                  \once \override NoteHead.transparent = ##t
                  \once \override NoteHead.no-ledgers = ##t
                  
                  #(make-music
                    'NoteEvent
                    'articulations
                    (list (make-music 'TremoloEvent 'tremolo-type 64))
                    'duration
                    (ly:make-duration 3)
                    'pitch
                    (ly:make-pitch
                     -1
                     (ly:pitch-notename
                      (ly:music-property #{ #main-note #} 'pitch))
                     (ly:pitch-alteration
                      (ly:music-property #{ #main-note #} 'pitch))
                     )
                    )
                  
                  \once \omit Stem
                  \once \omit Beam
                  \once \omit Flag
                  \once \override NoteHead.style = #st
                  
                  #(make-music
                    'NoteEvent
                    'duration
                    (ly:make-duration 3)
                    'pitch
                    (ly:make-pitch
                     (ly:pitch-octave aux-pitch)
                     (ly:pitch-notename aux-pitch) (ly:pitch-alteration aux-pitch))
                    )
                  \autoBeamOn
                }
              #}
              )

\relative c' { 
  \myTremolo 1/4 c1 e #'harmonic
  \myTremolo c1 ees #'default
  %with the following line uncommented, there's an error
  %\myTremolo a'1 bes
}
%%%%

May I ask for your help?

Thank you! 

Rip_mus

reply via email to

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