Here's a little self-help reference I made a little while back. Maybe it
will illustrate your point about different positions for different octaves
more clearly than words can.

Perhaps something in the tablature code can be adapted to this end.

On Mon, 28 Aug 2023, 21:44 samarutuk, <samaru...@aim.com> wrote:

> Sorry, I didn't really specify what exactly I was asking.
> But your answer was right, thanks!
> The final hurdle with your code now is that it doesn't really take pitch
> into account. C3 (c) has a different default slide position on the trombone
> than C4 (c'). So no matter if you notate notes absolute or relative in
> Lilypond, you would always have to use the absolute pitch (also for
> transposing instruments) as basis, so that the assigned slide positions or
> fingerings are correct.
> Here is my slightly modified code to better illustrate what I mean
> regarding pitch and different slide positions. Can Lilypond always use the
> exact pitch to assign slide positions/fingerings to a note?
>
> \version "2.24.2"
>
> #(use-modules (srfi srfi-2))
>
> autoFingerings =
> #(define-music-function (spec music) (ly:music? ly:music?)
>    (define (get-fingering ev)
>      (find (music-type-predicate 'fingering-event)
>            (ly:music-property ev 'articulations)))
>    (define (pitch-key p)
>      (cons (ly:pitch-notename p)
>            (ly:pitch-alteration p)))
>    (let ((spec-alist
>           (filter-map
>            (lambda (ev)
>              (and-let* ((pitch (ly:music-property ev 'pitch #f))
>                         (fingering (get-fingering ev)))
>                (cons (pitch-key pitch)
>                      fingering)))
>            (extract-typed-music spec 'note-event))))
>      (for-each
>       (lambda (ev)
>         (and-let* ((pitch (ly:music-property ev 'pitch #f))
>                    ((not (get-fingering ev)))
>                    (fingering (assoc-ref spec-alist (pitch-key pitch))))
>           (set! (ly:music-property ev 'articulations)
>                 (cons (music-clone fingering)
>                       (ly:music-property ev 'articulations)))))
>       (extract-typed-music music 'note-event))
>      music))
>
> spec = { bes-1 f-1 fis-5 c,-"q6" e-2 c-6 d-4 c'-3 eis'-\finger \markup
> \normal-text "foo" }
>
> \autoFingerings \spec {\clef "bass" bes,, c, e fis d c c' eis'' }
>
> Thanks in advance
> Andreas
>
> Am 28.08.2023 um 11:59 schrieb Jean Abou Samra:
>
> Hi,
>
> I'm not sure I understand your problem. If I infer your goal from the
> ChatGPT output, you're trying to add a fingering to each note based on its
> pitch. Is that right?
>
> \version "2.24.2"
>
> #(use-modules (srfi srfi-2))
>
> autoFingerings =
> #(define-music-function (spec music) (ly:music? ly:music?)
>    (define (get-fingering ev)
>      (find (music-type-predicate 'fingering-event)
>            (ly:music-property ev 'articulations)))
>    (define (pitch-key p)
>      (cons (ly:pitch-notename p)
>            (ly:pitch-alteration p)))
>    (let ((spec-alist
>           (filter-map
>            (lambda (ev)
>              (and-let* ((pitch (ly:music-property ev 'pitch #f))
>                         (fingering (get-fingering ev)))
>                (cons (pitch-key pitch)
>                      fingering)))
>            (extract-typed-music spec 'note-event))))
>      (for-each
>       (lambda (ev)
>         (and-let* ((pitch (ly:music-property ev 'pitch #f))
>                    ((not (get-fingering ev)))
>                    (fingering (assoc-ref spec-alist (pitch-key pitch))))
>           (set! (ly:music-property ev 'articulations)
>                 (cons (music-clone fingering)
>                       (ly:music-property ev 'articulations)))))
>       (extract-typed-music music 'note-event))
>      music))
>
>
>
> spec = { c'-1 d'-2 eis'-\finger \markup \normal-text "foo" }
>
> \autoFingerings \spec { d c eis'' }
>
> 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:
>
> As with typical ChatGPT output, it looks interesting on the surface but
> none of the details makes any sense.
>
> Best,
>
> Jean
>
>
>

Attachment: trombone_positions.pdf
Description: Adobe PDF document

Reply via email to