lilypond-user
[Top][All Lists]
Advanced

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

Automatic annotation of slide positions/fingerings for brass instruments


From: samarutuk
Subject: Automatic annotation of slide positions/fingerings for brass instruments.
Date: Sat, 26 Aug 2023 14:01:54 +0200
User-agent: Mozilla Thunderbird

Hello,

I have been looking for a long time for a way to automatically annotate slide positions or fingerings for brass instruments below or above the notes. There have been one or two requests for this, but never a complete solution, at least the oracle of Google has not been able to tell me anything wise.
I can't program and have now tried to put together a suitable function with ChatGPT. Unfortunately this does not work. Here is the code ChatGPT came up with, maybe it is complete nonsense:

\version "2.22.1"

% Define the function for adding trumpet fingerings
#(define (add-trumpet-fingerings layout props)
   (define fingerings-alist
      '((c4 . "1")
        (d4 . "2")
        (e4 . "1+2")
        ; Add more note-fingering pairs here
        ))

   (define (get-fingering pitch)
      (cdr (assoc pitch fingerings-alist)))

   (define (annotate-note-fingering grob)
      (let* ((note (ly:grob-object grob))
             (pitch (ly:event-property note 'pitch))
             (fingering (get-fingering pitch)))
         (when fingering
            (ly:note-event-set-property! note 'text
               (markup #:center fingering))
            grob)))

   (ly:context-modify-layout layout 'NoteHead #'stencil annotate-note-fingering))

% Define a simple melody
melody = {
  c4 d4 e4 d4 c4
}

% Create a score
\score {
  \new Staff \melody
  \layout {
    \context {
      \Score
      \override NoteColumn #'layout = #add-trumpet-fingerings
    }
  }
}

Regards
Andreas

@Devs: For educational purposes, I think fingerings, slide positions, etc. are pretty important. It would be nice if you could basically implement something to be able to add default or individual slide positions, fingerings etc. relatively easily.

reply via email to

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