|
From: | Jean Abou Samra |
Subject: | Re: Automatic annotation of slide positions/fingerings for brass instruments. |
Date: | Mon, 28 Aug 2023 11:59:34 +0200 |
User-agent: | Evolution 3.48.4 (3.48.4-1.fc38) |
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
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] | Current Thread | [Next in Thread] |