lilypond-user
[Top][All Lists]
Advanced

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

Re: Testing testing is there connection?


From: David Kastrup
Subject: Re: Testing testing is there connection?
Date: Thu, 13 May 2021 18:19:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

darkijah@jesusgod-pope666.info writes:

> On 2021-05-13 10:45, Jacques Menu wrote:
>> Hello Darkijah,
>> In order to be able to help you, we need so-called Minimum Working
>> Examples, exhibiting the problem in as much isolation as possible.
>> I’d advise you to start with much simpler examples, so as to grasp
>> the look and feel of working with LilyPond.
>> A nice day!
>> JM
>> 
>
> Yea, I will further look into things as time goes - I am totally green
> so I should wait for further experience on reporting bugs.
>
> I think I am doing pretty good with toying around with Lilypond :) As
> far as I am enjoying myself doing it and building things - everything
> is good. I am now looking into getting Flute images working, I would
> think it is possible to have a active script make it automatically
> with the holes like the Color script. Anyone have something I can look
> into that has already been made, so I can fine tune it for my own use
> and others? I would think Lilypond should be able to automaticalle
> fill the holes in the flute for a specific note so one does not need
> to fill it every single time. That would be very helpful.

Not flutes at all.  But maybe this may provide some food for thought?
Different diagram type, homebrewn.  This will not run in recent LilyPond
without using convert-ly -ed on the file.  But I don't know how recent
the version is you are using, so I include the unconverted version.

It at least shows the kind of "automatism" you asked about, though with
a regular key layout.

\version "2.18.0"

#(define semitone->canon
  (make-semitone->pitch (music-pitches #{ c cis d dis e f fis g gis a ais b 
#})))

#(define (black-key? canon)
  (not (zero? (ly:note-alteration canon))))

%% A system is defined by a key drawing routine.  Keys are given a
%% number (with 0 being middle C and expected to be drawn in a central
%% position).

%%#(define (piano-key position pressed)
%%   (let ((can (semitone->canon position))
%%       (black (black-key? can)))   
%%     (if black
%%       #{ \markup \translate #(cons 0 position)
%%          #(let ((block #{ \markup \filled-box #'(0 . 3) #'(0 . 0.5) #0.1 }))
%%             (if pressed
%%                 #{ \markup \combine \override #'(layer . 1)
%%                    \with-color #white
%%                    \draw-circle #0.3 #0 ##t
%%                    #block
%%                  #}
%%                 block))
%%          #}
%%       #{ \markup \translate #(cons 0 (* (ly:pitch-steps can) 7/12))
%%          #(let ((block #{ \markup \path #0.2 #`((moveto 4.8 0)
%%                                                 (curveto 5 0 5 0.1)
%%                                                 (lineto 5 ,(- 7/12 0.2))
%%                                                 (curveto 5 7/12 4.9
%%             
%%
%%    #{ \markup \translate-scaled #(cons 0 position)
%%         \f
%%

#(define (c-griff start end pressed)
   (define (add-circle prev n filled?)
     #{ \markup \combine #prev
                \translate #(cons (- 3 (modulo n 3))
                                  (- (/ n 3)))
                           \draw-circle #0.35 #0.1 #filled? #})
   (let loop ((i start)
              (m #{ \markup \null #})
              (pressed (member start (sort pressed <) <=)))
     (if (> i end)
         m
         (loop (1+ i)
               (add-circle m
                           (- i (- start (modulo start 3)))
                           (and (pair? pressed) (= (car pressed) i)))
               (and pressed (member i pressed <))))))

Dia_engraver =
#(define-scheme-function ((parser location low hi) context)
   (ly:pitch? ly:pitch?)
     (let ((pitches '()) (cause #f))
       (make-engraver
        ((start-translation-timestep engraver)
         (set! pitches '())
         (set! cause #f))
        (listeners
         ((note-event engraver event)
          (set! pitches (cons (ly:event-property event 'pitch) pitches))
          (if (not cause)
              (set! cause event))))
        ((process-music engraver)
         (if cause
             (let ((g (ly:engraver-make-grob engraver 'LyricText cause)))
               (set! (ly:grob-property g 'text)
                     (c-griff (ly:pitch-semitones low)
                              (ly:pitch-semitones hi)
                              (map ly:pitch-semitones pitches)))))))))

#(use-modules (scm accreg))

treble =
\relative {
  \tag full \clef "treble"  \discant "10"
  r8 s32 f'[ bes f] s e[ a e] s d[ g d] s16 e32[ a]
  \discant "121"
  << { r16 <f bes> r <e a> r <d g> } \tag full \\
     { d r a r bes r } >> |
  <cis e a>1
}

\new PianoStaff
<<
  \new Lyrics \with { \consists \Dia_engraver a b' }
              \removeWithTag full \treble
  \new Staff \treble
  \new Staff \relative
  { \clef "treble"  \freeBass "1"
    r8 d'32 s16. c32 s16. bes32 s16. a32[ cis] s16
    \clef "bass"  \stdBass "Master"
    << { r16 <f, bes d>^"b" r <e a c>^"am" r <d g bes>^"gm" |
         <e a cis>1^"a" } \\
       { d8_"D" c_"C" bes_"B" | a1_"A" }
    >>
  }
>>

-- 
David Kastrup

reply via email to

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