Hi,

David, the code you provided is almost perfect for our purposes.

However, there are still some aspects that need to be refined. I still don't understand clearly the lilypond code, but so far I have managed to do the code that I attach.

By the way, following are the aspects that I would like to improve.
-> The first note after a new line is not on the bar
-> When a note duration goes over a bar duration (as in the case of the example, with 1/4), the "empty" bar is not drawn. That needs to be further improved with special duration symbols... -> We would like to be able to draw, apart from bar lines, "pulsation" lines, which might serve as a reference for the time-proportional system. Those lines should be automatically added, but with a thiner line. In the example, I defined 1/4, but in fact I would prefer to be 4/4, with wider lines indicating the bars...

Any hint in that direction would be highly appreciated...

Thank you very much,

Best,

Andrés

El 12/05/15 a las 02:28, David Nalesnik escribió:
Hi Andrés.

On Mon, May 11, 2015 at 7:06 PM, AndrésPérezLópez <[email protected] <mailto:[email protected]>> wrote:

    Dear all,

    it's a pleasure for me to write my first email in the list. I'm
    still very
    new to Lilypond, so please forgive my ignorance.


Welcome to Lilypond and to the list!


    We are in the development of an alternative music notation system,
    based on
    proportional pitch and time representation. At the moment we have a
    SuperCollider-based GUI for music edition and automatic
    transcription trough
    MIDI.

    We have considered using Lilypond for the graphical score output,
    due to its
    wonderful features. Most of our required graphical notation
    symbols are
    already implemented.

    However, we are having problems with position of bar lines. We do use
    regular bar lines for separating the bars but, in our proposal,
    the notes
    are placed over the bars (and not at the right side, as in normal
    notation).
    We still didn't find any property of the bar lines that would
    allow us to
    place them in top of the first bar's note.

    Therefore, I would like to ask you if someone has an advice about
    the point.


I remember this coming up on the user list a while ago. Actually, quite a while ago: http://www.mail-archive.com/[email protected]/msg70143.html.

I've updated the file attached to that thread to work with current versions. I haven't looked at the code beyond that, and I'm guessing there's room for quite a bit of improvement.

Maybe it will prove useful, or at least pave the way to a better tool.

Best,
David

--
Andrés Pérez López
www.andresperezlopez.com
\version "2.16.2"


#(define adjust-for-note-head
  (lambda (grob)
    (let* ((refp (ly:grob-system grob))
           (bar-coord (ly:grob-relative-coordinate grob refp X))
           (all (ly:grob-array->list (ly:grob-object refp 'all-elements)))
           (note-heads
             (filter
               (lambda (n)
                 (eq? (assq-ref (ly:grob-property n 'meta) 'name)
                      'NoteColumn))
               all))
           (note-head-coords
             (map
               (lambda (heads)
                 (interval-center (ly:grob-extent heads refp X)))
               note-heads))
           (coords-to-right
             (filter
               (lambda (coord) (< bar-coord coord))
               note-head-coords))
           (closest-coord
             (if (pair? coords-to-right)
                 (apply min
                       (map (lambda (coord) (- coord bar-coord))
                            coords-to-right))
                 0)))
          
      (set! (ly:grob-property grob 'extra-offset) (cons closest-coord 0)))))
      
centerBarToNote = \override Staff.BarLine.after-line-breaking = #adjust-for-note-head   
centerSpanBarToNote = \override StaffGroup.SpanBar.after-line-breaking = #adjust-for-note-head


#(define (mnpNoteHeads pattern cfill midpoint) 
  (lambda (grob)
	(let* (
		(fsz  (ly:grob-property grob 'font-size 0.0))
		(mult (magstep fsz))

		(ptch (ly:event-property (event-cause grob) 'pitch))  
		(semi (ly:pitch-semitones ptch))
               (note-shape 0) 

		(notecol (ly:grob-parent   grob    X))
		(stm     (ly:grob-object   notecol 'stem))
               (ypos (ly:grob-staff-position grob))
		;; (stmdir  (ly:grob-property stm     'direction))
		
               (fn (ly:grob-default-font grob))
               (whitenote (ly:font-get-glyph fn "noteheads.s1"))
               (blacknote (ly:font-get-glyph fn "noteheads.s2"))  
		)
		
		;; NOTEHEADS
              (case pattern
                ((66) ;; 6-6 pattern
                  (set! note-shape (modulo (+ semi cfill) 2))
		    (set! (ly:grob-property grob 'stencil) 
			(ly:stencil-scale 
                         (case note-shape 
                           ((0) blacknote)
                           ((1) whitenote)
                         )
			mult mult)
		    ))
                ((75) ;; 7-5 pattern
                  (set! note-shape (modulo semi 12))
                  (set! (ly:grob-property grob 'stencil) 
			(ly:stencil-scale 
                         (case note-shape 
                           ((0) blacknote)
                           ((1) whitenote)
                           ((2) blacknote)
                           ((3) whitenote)
                           ((4) blacknote)
                           ((5) whitenote)
                           ((6) blacknote)
                           ((7) whitenote)
                           ((8) blacknote)
                           ((9) whitenote)
                           ((10) blacknote)
                           ((11) whitenote)
                         )
			mult mult)
		      )) 
                 )
            ;; DEFAULT STEM DIRECTION
            (if (< ypos midpoint) 
              (set! (ly:grob-property stm 'default-direction) 1)
              (set! (ly:grob-property stm 'default-direction) -1)
            )
	)
))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



notes =   \relative c' {

   a2 ais4 \bar b c8 cis d dis e4 f fis g gis a1
   a,8 a ais b c cis d dis e f fis g gis a
  }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bigrama
\score {
  \new Staff \with {
    \centerBarToNote
    
    \name Bigram
    \remove "Accidental_engraver"
    \remove "Key_engraver"
     \remove "Clef_engraver"
     
     \override Stem #'stencil = ##f
      \override Beam #'stencil = ##f
     \override TimeSignature #'stencil = ##f
     
    
     \numericTimeSignature
     \override NoteHead #'before-line-breaking = #(mnpNoteHeads 66 1 2)
  } 
  {\notes }
  
  
 \layout {
    \context {
      \Score
      \override SpacingSpanner.strict-note-spacing = ##t
      \time 1/4
      %time proportional
      proportionalNotationDuration = #(ly:make-moment 1/10) 
      % semitione spacing
      staffLineLayoutFunction = #ly:pitch-semitones 
      % bigram staff lines
      \override StaffSymbol #'line-positions = #'( -9 -9.1 -8.9 -3  2.9 3 3.1 ) 
      % no ledger lines
      \override StaffSymbol #'ledger-positions = #'(0)
      
    }
  }
}






_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to