lilypond-user
[Top][All Lists]
Advanced

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

Re: Hide and replace a note with text


From: Rajesh Baskar
Subject: Re: Hide and replace a note with text
Date: Wed, 8 Dec 2021 12:08:39 -0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2

Thanks Lukas, it works, but for the accidentals. If you see the example code below, is there a way to hide the sharp/flat signs also?

\version "2.22.0"

\language english

questionMark = \markup \general-align #Y #CENTER {
  \fontsize #7 \with-color "#6A00F4" "?"
}

\new Staff \with {
  \omit TimeSignature
}
{
  \cadenzaOn
  \key c \major
  \clef bass
  f1 g
  a
   % comment to center the question mark
  % on the actual notehead position:
  \once \override NoteHead.Y-offset = 0
  \once \override NoteHead.stencil =
  #(lambda (grob) (grob-interpret-markup grob questionMark))
  bf
  c'
  \bar "||"
}

On 12/8/2021 11:30 AM, Lukas-Fabian Moser wrote:
PS. I made some other changes to your code, maybe some of them turn out to be helpful.

Am 08.12.21 um 20:29 schrieb Lukas-Fabian Moser:
Hi Dav,

Am 08.12.21 um 19:50 schrieb Rajesh Baskar:
Can you hide and replace a note with a question mark? I kind of achieved this with the below example. But the question mark is not in place of the note, it appears below the staff. I can use \override TextScript.extra-offset = #'(0 . 4.275) to achieve this but I don't want to hard code the offset as the note to hide can appear anywhere on the staff.

You can exchange the note head by a markup:

\version "2.22.0"

\language english

questionMark = \markup \general-align #Y #CENTER {
  \fontsize #7 \with-color "#6A00F4" "?"
}

\new Staff \with {
  \omit TimeSignature
}
{
  \cadenzaOn
  \key c \major
  \clef bass
  f1 g
  % comment to center the question mark
  % on the actual notehead position:
  \once \override NoteHead.Y-offset = 0
  \once \override NoteHead.stencil =
  #(lambda (grob) (grob-interpret-markup grob questionMark))
  a
  bf c'
  \bar "||"
}

If you want to do this more often, you might define a shorthand (that then should also contain a "\once \omit Stem" etc.)

Lukas

reply via email to

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