Hello Omid,

Maybe something like this could work.

Cheers,
Valentin

Am Montag, 24. Jänner 2022, 20:56:11 CET schrieb Omid Mo'menzadeh:
> Hello all.
> I am trying to create some sort of tablature for Kalimba, treating it like
> a one-string instrument with fret-labels. I want to use letters like c, ċ,
> ċ̇ (or c𐽉), etc. I figured there are Unicode characters to do exactly
> that, "combining dot above" and "combining two dots above", etc. However,
> LilyPond does not seem to be able to render "combining two dots above", and
> two "combining dot above" characters (rendered correctly by my browser, as
> well as Emacs) result in the two dots to be rendered almost on top of each
> other in LilyPond. I have attached a rather minimal example.
> 
> I would appreciate any other solutions to this problem, or a way to fix the
> rendering issue.
> 
> Thanks everyone.
%%% minimal example start
\version "2.22.1"

notes = \relative c' {
  \time 3/4
  c c' c' |
}

#(define (normalize-pitch pitch)
   (let* ((octave-r (ly:pitch-octave pitch))
          (nn-r (ly:pitch-notename pitch))
          (octave (+ octave-r (quotient nn-r 7)))
          (nn (modulo nn-r 7))
          (alt (ly:pitch-alteration pitch)))
     (if (< alt -1/2)
         (normalize-pitch (ly:pitch-transpose pitch (ly:make-pitch 0 -1 1/2)))
         (if (> alt 1/2)
             (normalize-pitch (ly:pitch-transpose pitch (ly:make-pitch 0 1 -1)))
             (if (= alt 1/2)
                 (if (or (= nn 2) (= nn 6))
                     (normalize-pitch (ly:pitch-transpose pitch (ly:make-pitch 0 1 -1)))
                     (ly:make-pitch octave nn alt))
                 (if (= alt -1/2)
                     (if (or (= nn 3) (= nn 0))
                         (normalize-pitch (ly:pitch-transpose pitch (ly:make-pitch 0 -1 1/2)))
                         (ly:make-pitch octave nn alt))
                     (ly:make-pitch octave nn alt)))))))

#(define (transpose-by-semitone pitch st)
   (normalize-pitch (ly:pitch-transpose pitch (ly:make-pitch 0 0 (/ st 2)))))

#(define (fret-letter-tablature-format-kalimba context string-number fret-number)
   (let* ((string-tuning (list-ref (ly:context-property context 'stringTunings) (1- string-number)))
          (pitch (transpose-by-semitone string-tuning fret-number))
          (root (make-translate-scaled-markup '(0 . -0.5) (note-name->markup pitch #t)))
          (dotc (quotient fret-number 12))
          (dotm (markup #:with-dimensions '(0 . 0) '(0 . 0) #:center-align #:pattern dotc X 0.2 #:musicglyph "scripts.staccato"))
          (comb-mu (markup #:override '(direction . 1) #:override '(baseline-skip . 0.8) #:dir-column (#:center-align root dotm))))
     comb-mu))

\score {
  <<
    \new StaffGroup = "tab with traditional" <<
      \new Staff = "standard" \with {
        midiInstrument = "kalimba"
        instrumentName = "Kalimba"
      } <<
        \clef "treble"
        \context Voice = "music" \notes
      >>
      \new TabStaff = "tab" \with {
        stringTunings = \stringTuning <c'>
        tablatureFormat = #fret-letter-tablature-format-kalimba
      } <<
        \tabFullNotation
        \context TabVoice = "tab" \notes
      >>
    >>
  >>
}
%%% minimal example end

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

Reply via email to