Re: Need help displaying note names in 2.22

2023-08-08 Thread Viktor Mastoridis
Dear all,

Thank you very much for the time taken to comment on my problem.

I tried all the suggestions one by one - the best solution was to upgrade
to Lilypond 2.24 (much easier than I thought) and to use Jean's code below:

\version "2.24.1"

\layout {
  \context {
\NoteNames
noteNameFunction =
  #(lambda args
 #{ \markup \with-string-transformer #(lambda (layout props str)
(string-upcase str))
#(apply note-name-markup args) #})
  }
}

music = \relative c { c, cis d es }

\score {
 <<
\new TabStaff \with {
  stringTunings = #bass-tuning
}
{ \music  }
\new NoteNames { \music }
  >>
  \layout { }
  \midi { }
}

---
Viktor Mastoridis





On Mon, 7 Aug 2023 at 19:04, Jean Abou Samra  wrote:

> Le lundi 07 août 2023 à 19:00 +0100, Viktor Mastoridis a écrit :
>
> How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without
> braking the system?
>
>
>
>
> Just follow the tutorial, it will not interfere with the system in any way.
>
>
> https://lilypond.org/doc/v2.24/Documentation/learning/graphical-setup-under-gnu_002flinux.html
>
>
> (You presumably already have Frescobaldi, so you don't need that part,
> only the part where it explains how to add a new LilyPond version to
> Frescobaldi.)
>


Re: Need help displaying note names in 2.22

2023-08-07 Thread Jean Abou Samra
Le lundi 07 août 2023 à 19:00 +0100, Viktor Mastoridis a écrit :
> How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without braking
> the system?



Just follow the tutorial, it will not interfere with the system in any way.

https://lilypond.org/doc/v2.24/Documentation/learning/graphical-setup-under-gnu_002flinux.html


(You presumably already have Frescobaldi, so you don't need that part, only the
part where it explains how to add a new LilyPond version to Frescobaldi.)


signature.asc
Description: This is a digitally signed message part


Re: Need help displaying note names in 2.22

2023-08-07 Thread Viktor Mastoridis
On Sunday, 6 August 2023, Jean Abou Samra  wrote:

> Oops, except that this is not going to work in 2.22, since
> \with-string-transformer is new in 2.24.
>
> However, 2.22 is not supported anymore, I would recommend upgrading to
> 2.24 anyway.
>

How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without
braking the system?

Viktor


-- 
Viktor Mastoridis


Re: Need help displaying note names in 2.22

2023-08-06 Thread Silvain Dupertuis

Le 06.08.23 à 16:59, David Kastrup a écrit :

Strange...
I tried a few things, but did not find a way to make it work.

I noticed  2 things :

1. In this association table :
chimenames =
#`(
     ("c" . "C")
     ("cis" . "C♯")
     ("d" . "D")
     ("es" . "E♭")
)
It only takes into account notes of names with one single character as
the default-name, but it does print the new-note if it has more
characters. I do not understand why...

Note names have changed to use ♯ and ♭ characters, so you need to look
up "c♯" instead of "cis".


I do not understand...

"c♯"
- is not recognized in the music description only "cis" works
- it is not recognized either in the table as (markup->string (ly:grob-property 
grob 'text))
in the associative table either,

--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.org 

Re: Need help displaying note names in 2.22

2023-08-06 Thread Jean Abou Samra
Oops, except that this is not going to work in 2.22, since \with-string-
transformer is new in 2.24.

However, 2.22 is not supported anymore, I would recommend upgrading to 2.24
anyway.


signature.asc
Description: This is a digitally signed message part


Re: Need help displaying note names in 2.22

2023-08-06 Thread Jean Abou Samra
Le dimanche 06 août 2023 à 18:36 +0200, Robin Bannister a écrit :

> David Kastrup wrote:
> 
> 
> > Note names have changed to use ♯ and ♭ characters, so you need to look
> > up "c♯" instead of "cis".
> 
> 
> I got no hits that way.


That's because the sharp sign is printed with \markup \accidental in the text 
property, i.e., (ly:grob-property grob 'text), but \accidental does not yet 
have a markup->string handler giving Unicode accidental characters.

Michael's solution works, but it will nullify the effect of certain 
NoteNames-specific properties like printOctaveNames.

I think the best solution here is

```
\version "2.24.1"

\layout {
  \context {
\NoteNames
noteNameFunction =
  #(lambda args
 #{ \markup \with-string-transformer #(lambda (layout props str) 
(string-upcase str))
#(apply note-name-markup args) #})
  }
}

music = \relative c { c, cis d es }

\score {
 <<
\new TabStaff \with {
  stringTunings = #bass-tuning
}  
{ \music  }
\new NoteNames { \music }
  >>
  \layout { }
  \midi { }
}
```

Best

Jean


signature.asc
Description: This is a digitally signed message part


Re: Need help displaying note names in 2.22

2023-08-06 Thread Robin Bannister

David Kastrup wrote:


Note names have changed to use ♯ and ♭ characters, so you need to look
up "c♯" instead of "cis".


I got no hits that way.

An alternative is to add
   printAccidentalNames = #'lily
to the NoteNames \with.



And if I change the "es" lookup key to the more canonical "ees" it finds 
the corresponding markup instead of returning the errored #f.




Cheers,
Robin



Re: Need help displaying note names in 2.22

2023-08-06 Thread Michael Werner
Hi Victor,

On Sat, Aug 5, 2023 at 7:12 PM Viktor Mastoridis <
viktor.mastori...@gmail.com> wrote:

> Hello,
>
> I have been using the syntax below for several years; the last code update
> I did was in December 2022, and it worked well since.
> Today I noticed that I can't get the sharp/flat note names properly.
> C# & Eb are not displayed.
> Can you please help?
> ---
>
>
> \version "2.22.1"
> chimenames =
> #`(
> ("c" . "C")
> ("cis" . "C♯")
>("d" . "D")
>   ("es" . "E♭")
>)
>
> ChimeNoteNames =
> #(lambda (grob)
> (let* ((default-name (markup->string (ly:grob-property grob 'text)))
>(new-name (assoc-get default-name chimenames)))
>   (ly:grob-set-property! grob 'text new-name)
> (ly:text-interface::print grob)))
>

Is the main idea here to just get the note names displayed in uppercase? If
so, I've been doing basically the same thing with this:

\version "2.25.6"

music = \relative c { c, cis d es }

\score
{
  <<
\new TabStaff
\with {
  stringTunings = #bass-tuning
}
{ \music  }

\new NoteNames {
  \set noteNameFunction = #(lambda (pitch ctx)
 (markup #:sans (note-name->markup pitch #f))
 )

  \music
}
  >>
  \layout { }  \midi { }
}

It might not be perfect but it gets the job done. For reference, the
note-name->markup function reference is:

*Function:* *note-name->markup** pitch lowercase?*

Return pitch markup for pitch, including accidentals printed as glyphs. If
lowercase? is set to false, the note names are capitalized.
-- 
Michael


Re: Need help displaying note names in 2.22

2023-08-06 Thread David Kastrup
Silvain Dupertuis  writes:

> Strange...
> I tried a few things, but did not find a way to make it work.
>
> I noticed  2 things :
>
> 1. In this association table :
> chimenames =
> #`(
>     ("c" . "C")
>     ("cis" . "C♯")
>     ("d" . "D")
>     ("es" . "E♭")
> )
> It only takes into account notes of names with one single character as
> the default-name, but it does print the new-note if it has more
> characters. I do not understand why...

Note names have changed to use ♯ and ♭ characters, so you need to look
up "c♯" instead of "cis".

> 2. In my version (2.24), I get a warning of a deprecated syntax for
> the expression
> {\override NoteName #'stencil = #ChimeNoteNames }
> saying it should be written with a dot notation
> {\override NoteName.#'stencil = #ChimeNoteNames }
> and the warning disappear with this notation

Ugh.  Please just write NoteName.stencil here.  This is 2.18+ syntax.

-- 
David Kastrup



Re: Need help displaying note names in 2.22

2023-08-06 Thread Silvain Dupertuis

Strange...
I tried a few things, but did not find a way to make it work.

I noticed  2 things :

1. In this association table :
chimenames =
#`(
    ("c" . "C")
    ("cis" . "C♯")
    ("d" . "D")
    ("es" . "E♭")
)
It only takes into account notes of names with one single character as the default-name, 
but it does print the new-note if it has more characters. I do not understand why...


2. In my version (2.24), I get a warning of a deprecated syntax for the 
expression
{\override NoteName #'stencil = #ChimeNoteNames }
saying it should be written with a dot notation
{\override NoteName.#'stencil = #ChimeNoteNames }
and the warning disappear with this notation


Le 06.08.23 à 01:11, Viktor Mastoridis a écrit :

Hello,

I have been using the syntax below for several years; the last code update I did was in 
December 2022, and it worked well since.

Today I noticed that I can't get the sharp/flat note names properly.
C# & Eb are not displayed.
Can you please help?
---


\version "2.22.1"
chimenames =
#`(
    ("c" . "C")
    ("cis" . "C♯")
   ("d" . "D")
      ("es" . "E♭")
   )

ChimeNoteNames =
#(lambda (grob)
    (let* ((default-name (markup->string (ly:grob-property grob 'text)))
           (new-name (assoc-get default-name chimenames)))
          (ly:grob-set-property! grob 'text new-name)
    (ly:text-interface::print grob)))

music = \relative c { c, cis d es }

\score
{
 <<
    \new TabStaff
    \with {
      stringTunings = #bass-tuning
    }
      { \music  }

    \new NoteNames \with {\override NoteName #'stencil = #ChimeNoteNames }
    { \music }
  >>
  \layout { }  \midi { }
}


---
Viktor Mastoridis





--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.org