If I understand you correctly you want to be able to have a variable with music and potentially some additional stuff like TextScripts.
You can use functions like this
var =
#(define-music-function (dur) (ly:duration?)
#{
a $dur ^\markup \translate #'(-1 . 0) "+5"
#})
\displayMusic {
\var4 \var2 \var8. \var16
}
The one disadvantage of this is that you cannot use this without specifying a duration.
You can also use music function to replace certain notes by different music like this:
mapMyNote =
#(define-music-function (music) (ly:music?)
(define (walk music)
(let* ((elts (ly:music-property music 'elements))
(elt (ly:music-property music 'element)))
(if (music-is-of-type? music 'note-event)
(if (= (ly:pitch-notename (ly:music-property music 'pitch)) 5) ; a
#{
\transpose #(ly:make-pitch -1 0) #(ly:make-pitch (ly:pitch-octave (ly:music-property music 'pitch)) 0)
<a c' e'> $(ly:music-property music 'duration) ^"+5"
#}
(begin
(if (not (null? elt))
(ly:music-set-property! music 'element (walk elt)))
(ly:music-set-property! music 'elements (map walk elts))
music))
(begin
(if (not (null? elt))
(ly:music-set-property! music 'element (walk elt)))
(ly:music-set-property! music 'elements (map walk elts))
music))))
(walk music))
\mapMyNote { a a' }
EDIT: @semiono Aha. Seeing this is about microtonality: Something like this might also be useful:
t=
#(define-event-function (ct) (number?)
#{
-\tweak self-alignment-X #CENTER
-\tweak parent-alignment-X #CENTER
-\tweak font-size #-3.4
-\markup \bold #(format #f (if (integer? ct) "~@d" "~@f") ct)
#})
{ c' d' e'\t2 f'^\t-2 g'\t2.3 }