Re: Help with custom noteheads

2022-08-11 Thread Jean Abou Samra

Le 11/08/2022 à 14:32, Valentin Petzel a écrit :

Hello Andrew,

is there any reason for using a custom circle approximation instead of simply
using (make-circle-stencil r th #f)?

The reason why your note heads are off is that a path stencil does not have an
extent. A path cotains arbitrary drawing commands, which means that Lilypond
does not really know how large the result would be. As such your Note Heads
are handled as points, but then draw outside of this, which means that
Lilypond cannot handle spacing properly.

What you need to do is to give the stencil an actual extent by using
ly:stencil-outline, as done here:

\version "2.23.11"

circa =
#(let* ((k 0.5522)
 (r 1)
 (th 0.1)
 (th2 (/ th 2))
 (rth (+ r th2)))
(ly:stencil-outline
(ly:make-stencil `(path ,th
  (moveto ,r 0
  curveto ,r ,k ,k ,r 0 ,r
  curveto ,(- k) ,r ,(- r) ,k ,(- r) 0
  curveto ,(- r) ,(- k) ,(- k) ,(- r) 0 ,(- r)
  curveto ,k -1 1 ,(- k) 1 0
  ))
  (cons 1 1) (cons 1 1))
(make-filled-box-stencil (cons (- rth) rth) (cons (- rth) rth




You could also just replace the two (cons 1 1), which specify
the X and Y extents, with (cons (- rth) rth).

Better yet: use make-path-stencil, which computes the extents
automatically. (It used to do it wrongly in some cases, but I
fixed that in 2.23.11.)

Better yet: use make-circle-stencil, which draws a true circle
with the right extents, as you already said, and as demonstrated in
the message I sent at exactly the same time.

Cheers,
Jean




Re: Help with custom noteheads

2022-08-11 Thread Jean Abou Samra

Le 11/08/2022 à 13:40, Andrew Bernard a écrit :
So here is an MWE showing the start of what I want to do - make 
circular unfilled noteheads, and fitting in the staff size. This is 
only a start, as the set of note styles I need have many extra 
doodads, so this is just to get going.


It's been a long time since I have done any Lilypond Scheme. I'm 
wanting help on how to size and position the noteheads properly. This 
initial code is only my first sketch. I'm aware I need to flip the 
side when the stem points down - that's not the main focus. I am also 
foggy on the last arguments specfying the x and y extents. I can't 
recall what extents are and how they affect this context (having 
trouble searching for extent in the NR).




Extents are also called 'dimensions'. The extents of a grob
don't affect it itself, but they affect how other grobs react
to it, for example how a stem will attach to a note head, or
what space is reserved between two staves.

Stencils also have extents. They are used whenever stacking
stencils, aligning them, etc.

If the X-extent and Y-extent are not set to something particular,
the default to compute a grob's extents is to get them from
the stencil.

I don't think you'll find much about this topic in the
official documentation, but there is a bit of info here:

https://extending-lilypond.readthedocs.io/en/latest/backend.html#coordinates-extents-and-reference-points



The code is my own using the Bezier approximation for a circle. The 
variable k is kappa - as referenced in a previous post on 'Circles' 
and r is radius.



LilyPond supports exact circles, as you have found out in the
PostScript code in the other thread. Use make-circle-stencil to
create a circle. By the way, if you don't want to learn about
stencil functions, you could also use a markup:

  (grob-interpret-markup grob #{ \markup \draw-circle ... #})


Here's a commented snippet that should help you get started:


\version "2.23.11"

\layout {
  \context {
    \Score
    % custom circular noteheads
    \override NoteHead.stencil =
  #(lambda (grob)
 (let* (;; The thickness of lines in the staff symbol; depends
    ;; on font size.
    (staff-thickness (ly:staff-symbol-line-thickness grob))
    ;; Our own thickness -- scale it by the staff symbol's
    ;; thickness.
    (thickness (* staff-thickness (ly:grob-property grob 
'thickness)))

    ;; Our radius, measured to the center of the line.
    (radius (- (* 1/2 (ly:staff-symbol-staff-space grob)) ; 
half space

   (* 1/2 thickness) ; account for our thickness
   (* 1/2 staff-thickness) ; account for staff 
line thickness

   ))
    ;; Draw the circle.
    (circle (make-circle-stencil radius thickness #f)))
   ;; LilyPond expects a note head to tell how it should mesh with
   ;; other with its X extent.  The part of the X extent before 0
   ;; is the “breapth” value.  In our case, use 1/2*thickness 
for the
   ;; breapth so that a reversed note head (not on the normal 
size of

   ;; the stem due to seconds in chords) has the center of its
   ;; circle line on the stem.
   (ly:stencil-translate-axis
    (ly:stencil-aligned-to circle X LEFT)
    (* -1/2 thickness)
    X)))%}
 \override NoteHead.thickness = 1.15
 \override Stem.thickness = 1.15 % match stem to note head
 %% Attach stem exactly on the left or right of the note head, and at
 %% the vertical center.  In coordinates relative to the note head 
dimensions,

 %% that means '(1 . 0) or '(-1 . 0)
 \override NoteHead.stem-attachment =
   #(lambda (grob)
  (let* ((stem (ly:grob-object grob 'stem))
 (direction (ly:grob-property stem 'direction)))
    (cons direction 0)))
  }
}


test =
#(define-music-function (size) (number?)
   #{
 \new Staff \with { \magnifyStaff #size } \relative {
   c'4 d e f |
   g a b c |
   c2 b | a g | f e | d c |
   c1 | d | e | f | e | d | c |
   1 | 2 4 8 16 16
 }
   #})

\test 0.5
\test 0.7
\test 0.9
\test 1.1
\test 1.3
\test 1.6



Regards,
Jean




Re: Help with custom noteheads

2022-08-11 Thread Valentin Petzel
Hello Andrew,

is there any reason for using a custom circle approximation instead of simply 
using (make-circle-stencil r th #f)?

The reason why your note heads are off is that a path stencil does not have an 
extent. A path cotains arbitrary drawing commands, which means that Lilypond 
does not really know how large the result would be. As such your Note Heads 
are handled as points, but then draw outside of this, which means that 
Lilypond cannot handle spacing properly.

What you need to do is to give the stencil an actual extent by using 
ly:stencil-outline, as done here:

\version "2.23.11"

circa =
#(let* ((k 0.5522)
(r 1)
(th 0.1)
(th2 (/ th 2))
(rth (+ r th2)))
   (ly:stencil-outline
   (ly:make-stencil `(path ,th
 (moveto ,r 0
 curveto ,r ,k ,k ,r 0 ,r
 curveto ,(- k) ,r ,(- r) ,k ,(- r) 0
 curveto ,(- r) ,(- k) ,(- k) ,(- r) 0 ,(- r)
 curveto ,k -1 1 ,(- k) 1 0
 ))
 (cons 1 1) (cons 1 1))
   (make-filled-box-stencil (cons (- rth) rth) (cons (- rth) rth


circ =
#(make-circle-stencil 1 0.1 #f)

insta = {
   c'4 d' e' f' g' a' b' c''
}

\score {
   \new Staff \insta

   \layout {
 \context {
   \Score
   % custom circular noteheads
   \override NoteHead.stencil = #circa
 }
   }
}

\score {
   \new Staff \insta

   \layout {
 \context {
   \Score
   % builtin circular noteheads
   \override NoteHead.stencil = #circ
 }
   }
}

Cheers,
Valentin

Am Donnerstag, 11. August 2022, 13:40:06 CEST schrieb Andrew Bernard:
> So here is an MWE showing the start of what I want to do - make circular
> unfilled noteheads, and fitting in the staff size. This is only a start,
> as the set of note styles I need have many extra doodads, so this is
> just to get going.
> 
> It's been a long time since I have done any Lilypond Scheme. I'm wanting
> help on how to size and position the noteheads properly. This initial
> code is only my first sketch. I'm aware I need to flip the side when the
> stem points down - that's not the main focus. I am also foggy on the
> last arguments specfying the x and y extents. I can't recall what
> extents are and how they affect this context (having trouble searching
> for extent in the NR).
> 
> The code is my own using the Bezier approximation for a circle. The
> variable k is kappa - as referenced in a previous post on 'Circles' and
> r is radius.
> 
> 
> 
> \version "2.23.11"
> 
> circa =
> #(let ((k 0.5522)
>(r 1))
>(ly:make-stencil `(path 0.1
>  (moveto ,r 0
>  curveto ,r ,k ,k ,r 0 ,r
>  curveto ,(- k) ,r ,(- r) ,k ,(- r) 0
>  curveto ,(- r) ,(- k) ,(- k) ,(- r) 0 ,(- r)
>  curveto ,k -1 1 ,(- k) 1 0
>  ))
>  (cons 1 1) (cons 1 1)))
> 
> insta = {
>c'4 d' e' f' g' a' b' c''
> }
> 
> \score {
>\new Staff \insta
> 
>\layout {
>  \context {
>\Score
>% custom circular noteheads
>\override NoteHead.stencil = #circa
>  }
>}
> }
> 
> 
> 
> 
> Andrew



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


Help with custom noteheads

2022-08-11 Thread Andrew Bernard
So here is an MWE showing the start of what I want to do - make circular 
unfilled noteheads, and fitting in the staff size. This is only a start, 
as the set of note styles I need have many extra doodads, so this is 
just to get going.


It's been a long time since I have done any Lilypond Scheme. I'm wanting 
help on how to size and position the noteheads properly. This initial 
code is only my first sketch. I'm aware I need to flip the side when the 
stem points down - that's not the main focus. I am also foggy on the 
last arguments specfying the x and y extents. I can't recall what 
extents are and how they affect this context (having trouble searching 
for extent in the NR).


The code is my own using the Bezier approximation for a circle. The 
variable k is kappa - as referenced in a previous post on 'Circles' and 
r is radius.




\version "2.23.11"

circa =
#(let ((k 0.5522)
  (r 1))
  (ly:make-stencil `(path 0.1
    (moveto ,r 0
    curveto ,r ,k ,k ,r 0 ,r
    curveto ,(- k) ,r ,(- r) ,k ,(- r) 0
    curveto ,(- r) ,(- k) ,(- k) ,(- r) 0 ,(- r)
    curveto ,k -1 1 ,(- k) 1 0
    ))
    (cons 1 1) (cons 1 1)))

insta = {
  c'4 d' e' f' g' a' b' c''
}

\score {
  \new Staff \insta

  \layout {
    \context {
  \Score
  % custom circular noteheads
  \override NoteHead.stencil = #circa
    }
  }
}




Andrew





Re: Custom noteheads stem alignment

2015-04-13 Thread Pierre Perol-Schneider
Hi Andrew,

2015-04-13 2:05 GMT+02:00 Andrew Bernard andrew.bern...@gmail.com:

 Dear Pierre,

 Thank you so very very much for this. You have solved two problems in one
 - the stem attachment and the elliptical counter, and it looks excellent.

 I can’t find words to express my appreciation for your help to me and the
 list in general. It’s most appreciated.


You're welcome, I'm glad you like it ! :)


 Of course, when you help somebody, there’s always one more thing, isn’t
 there? I can’t resize the noteheads with

 \override NoteHead.font-size = #n

 What is going on there?


2015-04-13 2:36 GMT+02:00 Andrew Bernard :

Now I understand - font size changes won’t affect this code as it is not
 drawing from the font. But I am not sure what code will scale the
 noteheads. Do I need a separate stencil for different sizes? That’s not so
 bad, as I only want to differentiate normal notes and grace notes.


Yes, I think you'll have to scale note heads for graces' (e.g. \scale #'(.8
. .8) \sOne)
Does it help?
Cheers,
Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads stem alignment

2015-04-13 Thread Pierre Perol-Schneider
Hi Paul,

Thanks for the reminder! Makes me think that I could simplified lots of my
path's codes ;).
Anyway...
I suppose that for 'make-path-stencil',  'Z' stays for 'closepath', doesn't
it? So what's 'z' for ?

Cheers,
Pierre

2015-04-13 15:40 GMT+02:00 Paul Morris p...@paulwmorris.com:

 Schneidy wrote
  Now I understand - font size changes won’t affect this code as it is not
  drawing from the font. But I am not sure what code will scale the
  noteheads. Do I need a separate stencil for different sizes? That’s not
  so
  bad, as I only want to differentiate normal notes and grace notes.
 
 
  Yes, I think you'll have to scale note heads for graces' (e.g. \scale
  #'(.8
  . .8) \sOne)
  Does it help?
  Cheers,
  Pierre

 For another example of how to scale such custom stencils, especially with
 the font size, but also to create a smaller grace note version, see:
 http://lsr.di.unimi.it/LSR/Item?id=623

 Especially this part:

 scaleCustomClefStencilTwo =
 #(lambda (grob)
 (let* ((sz (ly:grob-property grob 'font-size 0.0))
(mult (magstep sz)))
 (set! (ly:grob-property grob 'stencil)
   (ly:stencil-scale
 customClefStencilTwo
 mult mult


 This snippet shows a different way to make a path stencil with:
   #(ly:make-stencil `(path
 this is a low level way and it requires you to specify the X and Y extents
 of the stencil.

 See a higher level method here:
   Using make-connected-path-stencil to draw custom shapes
   http://lsr.di.unimi.it/LSR/Item?id=891
 Which calculates the X and Y extents for you, but the path has to be
 connected.

 In 2.19 there is an improved version make-path-stencil where the path
 doesn't need to be connected. There's not a snippet for it yet because it's
 not in 2.18.  As far as I know this method provides the most flexibility
 and
 least constraints.  Here are some examples (the use of \markup here is just
 for convenient demonstration):

 %
 \version 2.19

 {

   c'1^\markup \stencil
   #(make-path-stencil
 ;; path, accepts both rmoveto and m, curveto and C, etc.
 '(rmoveto -1 1
rcurveto 0 0.75 1 0.75 1 0
rcurveto 0 -0.75 -1 -0.75 -1 0
rcurveto -1 0 -1 1.5 -0.5 1.5
rmoveto 0.5 -1.5
c -1 0 -1 -1.5 -0.5 -1.5
m 1.5 1.5
c 2.5 0 2.5 4 4 4
m -4 -4
c 2.5 0 2.5 -4 4 -4)
 ;; line thickness
 0.2
 ;; x and y scaling factors
 1 1
 ;; filled?
 #f)

   c'1^\markup \stencil
   #(make-path-stencil
 `(rmoveto 0 0
rlineto 2 0
rlineto 0 -2
rlineto -2 0
closepath
rmoveto 1.1 -1.1
rlineto 2 0
rlineto 0 -2
rlineto -2 0
closepath
rmoveto 1.1 -1.1
rlineto 2 0
rlineto 0 -2
rlineto -2 0
closepath)
 0.2 1 1 #f)

   c'1^\markup \stencil
   #(make-path-stencil
 '(moveto 6 0
curveto 0 -2 0 7 6 5
curveto 3 5 3 0 6 0)
 0.2 0.5 0.5 #f)

   c'1^\markup \stencil
   #(make-path-stencil `(L 0 0 L 1 2 L 2 0 Z M 1 3 L 1 0) 0.2 1 1 #f)

   c'1^\markup \stencil
   #(make-path-stencil `(l 1 2  L 2 0 z) 0.2 1 2 #t)

 }

 %%%

 And then there's the \path markup command method that Pierre used.  This
 one
 requires that you have access to a grob so you can do grob-interpret-markup
 (which is not required by the other methods).

 I think that covers it!
 -Paul






 --
 View this message in context:
 http://lilypond.1069038.n5.nabble.com/Custom-noteheads-stem-alignment-tp174412p174461.html
 Sent from the User mailing list archive at Nabble.com.

 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 https://lists.gnu.org/mailman/listinfo/lilypond-user

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads stem alignment

2015-04-13 Thread Paul Morris
Schneidy wrote
 Now I understand - font size changes won’t affect this code as it is not
 drawing from the font. But I am not sure what code will scale the
 noteheads. Do I need a separate stencil for different sizes? That’s not
 so
 bad, as I only want to differentiate normal notes and grace notes.

 
 Yes, I think you'll have to scale note heads for graces' (e.g. \scale
 #'(.8
 . .8) \sOne)
 Does it help?
 Cheers,
 Pierre

For another example of how to scale such custom stencils, especially with
the font size, but also to create a smaller grace note version, see:
http://lsr.di.unimi.it/LSR/Item?id=623

Especially this part:

scaleCustomClefStencilTwo =
#(lambda (grob)
(let* ((sz (ly:grob-property grob 'font-size 0.0))
   (mult (magstep sz)))
(set! (ly:grob-property grob 'stencil) 
  (ly:stencil-scale
customClefStencilTwo
mult mult


This snippet shows a different way to make a path stencil with:
  #(ly:make-stencil `(path 
this is a low level way and it requires you to specify the X and Y extents
of the stencil.

See a higher level method here:
  Using make-connected-path-stencil to draw custom shapes
  http://lsr.di.unimi.it/LSR/Item?id=891
Which calculates the X and Y extents for you, but the path has to be
connected.

In 2.19 there is an improved version make-path-stencil where the path
doesn't need to be connected. There's not a snippet for it yet because it's
not in 2.18.  As far as I know this method provides the most flexibility and
least constraints.  Here are some examples (the use of \markup here is just
for convenient demonstration):

%
\version 2.19

{

  c'1^\markup \stencil
  #(make-path-stencil
;; path, accepts both rmoveto and m, curveto and C, etc.
'(rmoveto -1 1
   rcurveto 0 0.75 1 0.75 1 0
   rcurveto 0 -0.75 -1 -0.75 -1 0
   rcurveto -1 0 -1 1.5 -0.5 1.5
   rmoveto 0.5 -1.5
   c -1 0 -1 -1.5 -0.5 -1.5
   m 1.5 1.5
   c 2.5 0 2.5 4 4 4
   m -4 -4
   c 2.5 0 2.5 -4 4 -4)
;; line thickness
0.2 
;; x and y scaling factors
1 1 
;; filled?
#f)

  c'1^\markup \stencil
  #(make-path-stencil
`(rmoveto 0 0
   rlineto 2 0
   rlineto 0 -2
   rlineto -2 0
   closepath
   rmoveto 1.1 -1.1
   rlineto 2 0
   rlineto 0 -2
   rlineto -2 0
   closepath
   rmoveto 1.1 -1.1
   rlineto 2 0
   rlineto 0 -2
   rlineto -2 0
   closepath)
0.2 1 1 #f)

  c'1^\markup \stencil
  #(make-path-stencil
'(moveto 6 0
   curveto 0 -2 0 7 6 5
   curveto 3 5 3 0 6 0)
0.2 0.5 0.5 #f)

  c'1^\markup \stencil
  #(make-path-stencil `(L 0 0 L 1 2 L 2 0 Z M 1 3 L 1 0) 0.2 1 1 #f)

  c'1^\markup \stencil
  #(make-path-stencil `(l 1 2  L 2 0 z) 0.2 1 2 #t)

}

%%%

And then there's the \path markup command method that Pierre used.  This one
requires that you have access to a grob so you can do grob-interpret-markup
(which is not required by the other methods).  

I think that covers it!
-Paul






--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Custom-noteheads-stem-alignment-tp174412p174461.html
Sent from the User mailing list archive at Nabble.com.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads stem alignment

2015-04-13 Thread Paul Morris
Schneidy wrote
 Thanks for the reminder! Makes me think that I could simplified lots of my
 path's codes ;).

Sure thing!  When make-path-stencil arrives in the stable version things
will be much simpler, as I can't think of a reason to use any of the other
methods instead of it.  It doesn't require a grob (as with
grob-interpret-markup), it doesn't require manually specifying the X and Y
extents, and the path can be disconnected / discontinuous.

(It might even be worth deprecating and removing make-connected-path-stencil
at some point, maybe in 2.22, that way 2.20 would have both
make-path-stencil and make-connected-path-stencil for an easy transition for
anyone using these.)


Schneidy wrote
 Anyway...
 I suppose that for 'make-path-stencil',  'Z' stays for 'closepath',
 doesn't
 it? So what's 'z' for ?

z and Z are both equivalent to closepath.  This follows the SVG convention
where both z and Z are included.

Just for completeness sake, make-path-stencil works with either kind of
commands, the more verbose or the single letters:

moveto, rmoveto, lineto, rlineto, curveto, rcurveto, closepath

M, m, L, l, C, c, Z, z

Cheers,
-Paul




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Custom-noteheads-stem-alignment-tp174412p174474.html
Sent from the User mailing list archive at Nabble.com.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads stem alignment

2015-04-12 Thread Andrew Bernard
In typography, the hole in characters such as ‘o’ and ‘a’ is called the 
counter. Most notes are engraved with an ellipse as the empty space, with 
‘italic pen’ style thick and thin.

The standard lilypond noteheads do this.

Andrew


On 12 April 2015 at 23:35:58, Pierre Perol-Schneider 
(pierre.schneider.pa...@gmail.com) wrote:

1. How does one achieve an elliptical counter in unfilled notes? I know how to 
do this in Postscript, but not here.

Sorry, I don't understand the question. :(
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads stem alignment

2015-04-12 Thread Pierre Perol-Schneider
Hi Andrew,

2015-04-12 13:45 GMT+02:00 Andrew Bernard andrew.bern...@gmail.com:

 Here is my very first attempt at making custom noteheads. The shape is
 what we desire, but there are two questions that I have.

 1. How does one achieve an elliptical counter in unfilled notes? I know
 how to do this in Postscript, but not here.


Sorry, I don't understand the question. :(


 2. How can the stem alignment be corrected in the chord situation
 illustrated?


I can't test anything right now but what I can tell is that changing the
'stem-attachement' won't solve anything.
Since you're using 'rotate', the grob width remain as if the ellipse was
horizontal; So all you have to do is giving the proper dimensions of the
rotated note head.

Hope that helps a bit,
Cheers,
Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Custom noteheads stem alignment

2015-04-12 Thread Andrew Bernard
Here is my very first attempt at making custom noteheads. The shape is what we 
desire, but there are two questions that I have.

1. How does one achieve an elliptical counter in unfilled notes? I know how to 
do this in Postscript, but not here.
2. How can the stem alignment be corrected in the chord situation illustrated?

This is based on concepts in LSR-861, but I don’t want to call an adjustment 
function for stems every time they wander off, as used in that snippet.

Andrew

\version 2.19.18

#(define exp-stencil-1
   (lambda (grob)
     (let* ((duration (ly:grob-property grob 'duration-log))
            (filled? (if ( duration 1) #t #f))
            (stil-1 (make-partial-ellipse-stencil 0.65 0.26 10 10 0.15 #t 
filled?))
            (stil-2 (ly:stencil-rotate stil-1 45 0 0))
            )
       stil-2)))


treble = \relative c'' {
  \clef treble
  \time 4/4
  c c8 c16 c2 c16 |
  c1
  b4 bes a ais
  bes cis des e fis ges8
}

bass = \relative c {
  \clef bass
  \time 4/4
  c4 c8 c16 c2 c16 |
  c1
  d4 dis ees e
  
  \stemUp
  c d e f g4
}

\score {
  \new PianoStaff \with {
  }
  
    \new Staff = treble { \treble }

    \new Staff = bass { \bass }
  

  \layout {
    \context {
      \Score
      \override NoteHead.stencil = #exp-stencil-1
      \override NoteHead.stem-attachment = #'(0.75 . 0.7)
    }
  }
}




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads stem alignment

2015-04-12 Thread Pierre Perol-Schneider
Ok, thanks for the explanation Andrew.
But I'm afraid you can't do that here since 'elipse' draws a single line
with a specific thickness. A note head with a counter would need at least
two lines/elipses, one filled 'inside' and the other filled 'outside' (but
I don't know how to do that).
So I'm afraid you'll have to go through a postscript - that you don't want
if I understood you well - or a 'path' drawing.

Here's a draft for a 'path' (counter has, of course, to be adapted to your
design):

\version 2.19.18

sOne =
\markup
\override #'(filled . #t)
\path #0.01
#'((moveto0.00  -0.35)
   (lineto0.08  -0.28)
   (curveto   0.08  -0.32   0.10  -0.33   0.18  -0.33)
   (curveto   0.48  -0.33   1.03   0.08   1.03   0.28)
   (curveto   1.03   0.34   0.94   0.33   0.93   0.33)
   (curveto   0.65   0.33   0.08  -0.05   0.08  -0.28)
   (lineto0.00  -0.35)
   (curveto   0.00   0.00   0.55   0.55   0.90   0.55)
   (curveto   1.00   0.55   1.10   0.50   1.10   0.35)
   (curveto   1.10   0.00   0.55  -0.55   0.20  -0.55)
   (curveto   0.05  -0.55   0.00  -0.45   0.00  -0.35))

sTwo =
\markup
\override #'(filled . #t)
\path #0.01
#'((moveto0.00  -0.35)
   (curveto   0.00   0.00   0.55   0.55   0.90   0.55)
   (curveto   1.00   0.55   1.10   0.50   1.10   0.35)
   (curveto   1.10   0.00   0.55  -0.55   0.20  -0.55)
   (curveto   0.05  -0.55   0.00  -0.45   0.00  -0.35))

#(define exp-stencil-2
   (lambda (grob)
 (let ((duration (ly:grob-property grob 'duration-log)))
(if ( duration 1)
  (grob-interpret-markup grob sTwo)
  (grob-interpret-markup grob sOne)

%%% test:
treble = \relative c'' {
  \clef treble
  \time 4/4
  c c8 c16 c2 c16 |
  c1
  b4 bes a ais
  bes cis des e fis ges8
}

bass = \relative c {
  \clef bass
  \time 4/4
  c4 c8 c16 c2 c16 |
  c1
  d4 dis ees e
  \stemUp
  c d e f g4
}

\score {
  \new PianoStaff 
\new Staff = treble { \treble }
\new Staff = bass { \bass }
  
  \layout {
\context {
  \Score
  \override NoteHead.stencil = #exp-stencil-2
}
  }
}


I hope this will bring you a better help than my previous answer ;)

Cheers,
Pierre



2015-04-12 15:56 GMT+02:00 Andrew Bernard andrew.bern...@gmail.com:

 In typography, the hole in characters such as ‘o’ and ‘a’ is called the
 counter. Most notes are engraved with an ellipse as the empty space, with
 ‘italic pen’ style thick and thin.

 The standard lilypond noteheads do this.

 Andrew


 On 12 April 2015 at 23:35:58, Pierre Perol-Schneider (
 pierre.schneider.pa...@gmail.com) wrote:

  1. How does one achieve an elliptical counter in unfilled notes? I know
 how to do this in Postscript, but not here.


 Sorry, I don't understand the question. :(

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom drumstyle-tables with custom noteheads?

2009-02-18 Thread Tao Cumplido
 Original-Nachricht 
 Datum: Mon, 9 Feb 2009 14:27:28 -0700
 Von: Carl D. Sorensen c_soren...@byu.edu
 An: Tao Cumplido tao_lilypondu...@gmx.net, lilypond-user@gnu.org 
 lilypond-user@gnu.org
 Betreff: Re: custom drumstyle-tables with custom noteheads?

Uh, it's me again.
Actually I made it to write a workaround that does the job. Better late than 
never. ^^
I still have to prepare a presentable sample before I post the result here 
though.

 Yes, the .cc files are very hard to understand.  But after you look at a
 bunch of them, it gets better
 
 You can see where the styles are actually used to get glyph names in
 scm/output-lib.scm.

Well, instead of medling further with the installation files I wrote now a 
workaround function that actually ignores the 'style property of the grob 
completely and just checks on the drumnote-name, i.e. bassdrum and overrides 
the 'stencil property with the function from the other thread to create custom 
stencils which produce different results depending on the duration-log.

I think that's actually more or less the same you had in mind below.

 Maybe, but this seems like too much of a hack to me.  But it's possible, I
 suppose.  But if I were going to do it in this fashion, I think I'd add a
 new style to the drumStyleTable and then try to write a new print function
 that checks the style, and if it's parallelogram, use the parallelogram
 print routine, otherwise, use the regular notehead print routine.
 
 Now that I think about it, this approach is a promising way to do this
 without needing to add any font glyphs (which I think would be needed to
 define a new style).  You already have a template for how to do this in
 your
 parallelogram function that Neil wrote.  It checks the grob, and if its
 duration is 2, it writes the parallelogram.  Otherwise, it calls the
 regular
 notehead stuff.

 But I think the output will likely be better if you define new glyphs in
 the
 font and define a new style.

Eventually it'd definitely be easier to use and I think with some more 
tinkering I might even be able to do it but right now it works like I want it 
to and I prefer not to play with the installation files.

Regards,

Tao

-- 
Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


custom drumstyle-tables with custom noteheads?

2009-02-09 Thread Tao Cumplido
Hi All,

some time ago Neil Puttock helped me out to create a function that returns 
different notehead-stencils depending on the duration-log.
http://www.mail-archive.com/lilypond-user@gnu.org/msg42720.html

Now I was wondering if this procedure could be somehow integrated in a custom 
drumstyle-table but just using the functions-name in the style-field won't 
work, e.g. (snare parallelogram #5 0).
Then I tried to figure out more about the standard settings which can be used 
here, i.e. cross, diamond, xcircle, slash, etc. but everything I found out by 
means of \displayMusic and (display)-scheme internally resulted that all those 
definitions are lists if am not mistaken ( 'cross or (quote cross) is list, 
isn't it?).
Well, after this way turned to be a dead end I tried to search all files of the 
installation on more information on these defintions but didn't find any. Not 
even somewhere in the source I could find those.

I don't know what else I can do to find out how this works internally on my own 
and if what I want to do is actually possible, so any help here is greatly 
appreciated.

Regards,

Tao
-- 
Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom drumstyle-tables with custom noteheads?

2009-02-09 Thread Carl D. Sorensen

Tao,

On 2/9/09 2:41 AM, Tao Cumplido tao_lilypondu...@gmx.net wrote:

 Hi All,
 
 some time ago Neil Puttock helped me out to create a function that returns
 different notehead-stencils depending on the duration-log.
 http://www.mail-archive.com/lilypond-user@gnu.org/msg42720.html
 
 Now I was wondering if this procedure could be somehow integrated in a custom
 drumstyle-table but just using the functions-name in the style-field won't
 work, e.g. (snare parallelogram #5 0).

Have you tried using 'parallelogram instead of parallelogram?  When
parallelogram is defined as a music function, every time scheme sees
parallelogram it tries to execute it.  On the other hand, when it sees
'parallelogram is just puts the symbol (function name) rather than
evaluating it.

 Then I tried to figure out more about the standard settings which can be used
 here, i.e. cross, diamond, xcircle, slash, etc. but everything I found out by
 means of \displayMusic and (display)-scheme internally resulted that all those
 definitions are lists if am not mistaken ( 'cross or (quote cross) is list,
 isn't it?).

'cross is a scheme symbol, not a list.  And (quote cross) is just another
way to describe that symbol; 'cross  is the same thing as (quote cross).

I hope you found that the drum style table is in the file
ly/drum-pitch-init.ly.  The definitions is ly/drum-pitch-init.ly are a
little bit confusing, because they're all quoted lists.  That means there's
a '( at the beginning of the list, so by default, nothing in the list is
evaluated and you don't need to put a ' before the symbol names.  That's
also why the (ly:make-pitch ) calls in midiDrumPitches have a , before them;
the , means evaluate the following thing, even though it's in a quoted
list.

The other thing that is going to give you a little bit of grief is that the
drum-style tables are hashes, not alists.  In the init file, they're set up
as alists, then converted to hashes by the map function at the end of the
init file, which calls alist-hash-table (defined in scm/lily-library.scm.

If you want to change a single entry, you'll have to do it with a call to
hashq-set!.  You can see how it's used in scm/lily-library.scm.  k-v means
key-value pair.  So if you have a list you want to store like ('snare
'parallelogram #5 0), you'd do something like:

(hashq-set! name-of-drum-table-goes-here 'snare '(parallelogram 5 0))

with name-of-drum-table-goes-here replaced with the scheme name of the drum
table you're currently using, i.e. the name you used on the right hand side
of drumStyleTable= ###.

You can read more about hashes at
http://www.gnu.org/software/guile/manual/html_node/Hash-Tables.htm

HTH,

Carl




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom drumstyle-tables with custom noteheads?

2009-02-09 Thread Tao Cumplido
 Original-Nachricht 
 Datum: Mon, 9 Feb 2009 07:40:38 -0700
 Von: Carl D. Sorensen c_soren...@byu.edu
 An: Tao Cumplido tao_lilypondu...@gmx.net, lilypond-user@gnu.org 
 lilypond-user@gnu.org
 Betreff: Re: custom drumstyle-tables with custom noteheads?


 Have you tried using 'parallelogram instead of parallelogram?  When
 parallelogram is defined as a music function, every time scheme sees
 parallelogram it tries to execute it.  On the other hand, when it sees
 'parallelogram is just puts the symbol (function name) rather than
 evaluating it.

No. I haven't considered it because the other to-use symbols don't have the 
quote either.
I just tried it though and the result is that I don't get compilation errors 
anymore and instead of no stencil at all the standard NoteHead stencil is 
printed but not the parallelogram.

 'cross is a scheme symbol, not a list.  And (quote cross) is just another
 way to describe that symbol; 'cross  is the same thing as (quote cross).

I knew that 'cross and (quote cross) is the same but not that it's a scheme 
symbol. I must have accidentaly skipped the chapter about symbols.
 
 I hope you found that the drum style table is in the file
 ly/drum-pitch-init.ly.  The definitions is ly/drum-pitch-init.ly are a
 little bit confusing, because they're all quoted lists.  That means
 there's
 a '( at the beginning of the list, so by default, nothing in the list is
 evaluated and you don't need to put a ' before the symbol names.  That's
 also why the (ly:make-pitch ) calls in midiDrumPitches have a , before
 them;
 the , means evaluate the following thing, even though it's in a quoted
 list.

That's interesting. I always wondered what those commas mean.
Does #' actually mean the same as #` or is there also a significant difference?

 The other thing that is going to give you a little bit of grief is that
 the
 drum-style tables are hashes, not alists.  In the init file, they're set
 up
 as alists, then converted to hashes by the map function at the end of the
 init file, which calls alist-hash-table (defined in scm/lily-library.scm.
 
 If you want to change a single entry, you'll have to do it with a call to
 hashq-set!.  You can see how it's used in scm/lily-library.scm.  k-v means
 key-value pair.  So if you have a list you want to store like ('snare
 'parallelogram #5 0), you'd do something like:
 
 (hashq-set! name-of-drum-table-goes-here 'snare '(parallelogram 5 0))
 
 with name-of-drum-table-goes-here replaced with the scheme name of the
 drum
 table you're currently using, i.e. the name you used on the right hand
 side
 of drumStyleTable= ###.
 
 You can read more about hashes at
 http://www.gnu.org/software/guile/manual/html_node/Hash-Tables.htm

Well, I don't understand the significant difference between hash-tables and 
alists yet but I suppose it's not that essential to be able to change values 
inside it.
But since I am creating new drumStyleTables anyway I don't need to change a 
value from some other place anyway, do I?

I still don't know yet what symbols like 'cross or 'diamond represent 
internally to be able to produce my own symbols which do the same.
Logically they should in some way send the information about the stencil to 
use, shouldn't they? Or maybe I haven't totally understood how a scheme symbol 
is supposed to work.

Thanks for the help so far.

Regards,

Tao

p.s.:
I finished my function to make plain text chord symbols transposeable.
Thanks a lot for your earlier help.
I already tred to post it here but I didn't get through because the mail was 
too big, probably because of the font I tried to send along.
I'll have to try again somewhat later.

 HTH,
 
 Carl
 


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom drumstyle-tables with custom noteheads?

2009-02-09 Thread Carl D. Sorensen



On 2/9/09 10:07 AM, Tao Cumplido tao_lilypondu...@gmx.net wrote:

  Original-Nachricht 
 Datum: Mon, 9 Feb 2009 07:40:38 -0700
 Von: Carl D. Sorensen c_soren...@byu.edu
 An: Tao Cumplido tao_lilypondu...@gmx.net, lilypond-user@gnu.org
 lilypond-user@gnu.org
 Betreff: Re: custom drumstyle-tables with custom noteheads?
 
 
 Have you tried using 'parallelogram instead of parallelogram?  When
 parallelogram is defined as a music function, every time scheme sees
 parallelogram it tries to execute it.  On the other hand, when it sees
 'parallelogram is just puts the symbol (function name) rather than
 evaluating it.
 
 No. I haven't considered it because the other to-use symbols don't have the
 quote either.

I'm sorry, I gave bad advice earlier.  What I proposed won't work.

 'cross is a scheme symbol, not a list.  And (quote cross) is just another
 way to describe that symbol; 'cross  is the same thing as (quote cross).
 
 I knew that 'cross and (quote cross) is the same but not that it's a scheme
 symbol. I must have accidentaly skipped the chapter about symbols.
 
 I hope you found that the drum style table is in the file
 ly/drum-pitch-init.ly.  The definitions is ly/drum-pitch-init.ly are a
 little bit confusing, because they're all quoted lists.  That means
 there's
 a '( at the beginning of the list, so by default, nothing in the list is
 evaluated and you don't need to put a ' before the symbol names.  That's
 also why the (ly:make-pitch ) calls in midiDrumPitches have a , before
 them;
 the , means evaluate the following thing, even though it's in a quoted
 list.
 
 That's interesting. I always wondered what those commas mean.
 Does #' actually mean the same as #` or is there also a significant
 difference?

#' is quote, and nothing inside the quoted expression is evaluated.

#` is quasi-quote; things inside the quasi-quoted expression that are
introduced with , are evaluated.

guile '(+ 1 ,(* 2 3) 4)
(+ 1 (unquote (* 2 3)) 4)
guile `(+ 1 ,(* 2 3) 4)
(+ 1 6 4)

# just introduces a scheme construct in lilypond.

 
 The other thing that is going to give you a little bit of grief is that
 the
 drum-style tables are hashes, not alists.  In the init file, they're set
 up
 as alists, then converted to hashes by the map function at the end of the
 init file, which calls alist-hash-table (defined in scm/lily-library.scm.
 
 If you want to change a single entry, you'll have to do it with a call to
 hashq-set!.  You can see how it's used in scm/lily-library.scm.  k-v means
 key-value pair.  So if you have a list you want to store like ('snare
 'parallelogram #5 0), you'd do something like:
 
 (hashq-set! name-of-drum-table-goes-here 'snare '(parallelogram 5 0))
 
 with name-of-drum-table-goes-here replaced with the scheme name of the
 drum
 table you're currently using, i.e. the name you used on the right hand
 side
 of drumStyleTable= ###.
 
 You can read more about hashes at
 http://www.gnu.org/software/guile/manual/html_node/Hash-Tables.htm
 
 Well, I don't understand the significant difference between hash-tables and
 alists yet but I suppose it's not that essential to be able to change values
 inside it.
 But since I am creating new drumStyleTables anyway I don't need to change a
 value from some other place anyway, do I?

As long as you're going to create a whole new drumStyleTable you don't need
to worry about it, as long as you use alist-hash-table on the alist you
define.  You'd only need to do a hashq-set! if you wanted to modify an
existing table.

Again, I gave a bad answer earlier; sorry for the noise.

 
 I still don't know yet what symbols like 'cross or 'diamond represent
 internally to be able to produce my own symbols which do the same.
 Logically they should in some way send the information about the stencil to
 use, shouldn't they? Or maybe I haven't totally understood how a scheme symbol
 is supposed to work.

Let me just address what is going in on with drum style.  'cross, 'diamond,
etc. are 'styles for the note-head-interface of the noteHead object that
will be created by the Drum_notes_engraver.  They are interpreted by the
ly:note-head::print routine.  The ly:note-head::print routine is a C++
routine found in lily/note-head.cc.

Basically, the routine looks for a given note head style, and uses that to
print the notes.  You can see the note head styles in appendix B.7 of the
Notation Reference.

Since the drumStyleTable uses note styles to set the note heads, if you want
to create your own drumStyleTable, I think you'll need to add a new notehead
style.  And I have no idea how to do that.

Again, I'm sorry for my misleading earlier reply.  I thought I knew what was
going on, but I was wrong.  I hope this new answer helps.

Thanks,
Carl

 p.s.:
 I finished my function to make plain text chord symbols transposeable.
 Thanks a lot for your earlier help.

You're welcome!

 I already tred to post it here but I didn't get through because the mail was
 too big, probably

Re: custom drumstyle-tables with custom noteheads?

2009-02-09 Thread Tao Cumplido

 Original-Nachricht 
 Datum: Mon, 9 Feb 2009 11:26:19 -0700
 Von: Carl D. Sorensen c_soren...@byu.edu
 An: Tao Cumplido tao_lilypondu...@gmx.net, lilypond-user@gnu.org 
 lilypond-user@gnu.org
 Betreff: Re: custom drumstyle-tables with custom noteheads?


 Let me just address what is going in on with drum style.  'cross,
 'diamond,
 etc. are 'styles for the note-head-interface of the noteHead object that
 will be created by the Drum_notes_engraver.  They are interpreted by the
 ly:note-head::print routine.  The ly:note-head::print routine is a C++
 routine found in lily/note-head.cc.
 
 Basically, the routine looks for a given note head style, and uses that to
 print the notes.  You can see the note head styles in appendix B.7 of the
 Notation Reference.

The notehead.cc file is very cryptic for me and I don't see how it could help 
me since I don't see anywhere a definition of 'cross or 'diamond.
Note_head::print is too abstract for me. I don't get how 'cross tells 
ly:note-head:print to print the cross-head stencils from the feta font.

 Since the drumStyleTable uses note styles to set the note heads, if you
 want
 to create your own drumStyleTable, I think you'll need to add a new
 notehead
 style.  And I have no idea how to do that.

Yes, I think so too, but if even you don't know what to do I think I should 
rather drop this problem for now.

Hmm... maybe it is possible to write a function that checks on the position of 
each note in the drumStyle hashtable and override the style accordingly?!

 Again, I'm sorry for my misleading earlier reply.  I thought I knew what
 was
 going on, but I was wrong.  I hope this new answer helps.

Don't worry, your input always gives me some new aspects to think about. ;)

 Please try to send the function separately from the font.  I think that
 some
 users will be very interested in it.

Apparently the sample png I sent along was too big :')
I reduced and sent it again. This it should have gone through.

Regards,

Tao

-- 
Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom drumstyle-tables with custom noteheads?

2009-02-09 Thread Carl D. Sorensen



On 2/9/09 1:30 PM, Tao Cumplido tao_lilypondu...@gmx.net wrote:

 
 
  Original-Nachricht 
 Datum: Mon, 9 Feb 2009 11:26:19 -0700
 Von: Carl D. Sorensen c_soren...@byu.edu
 An: Tao Cumplido tao_lilypondu...@gmx.net, lilypond-user@gnu.org
 lilypond-user@gnu.org
 Betreff: Re: custom drumstyle-tables with custom noteheads?
 
 
 The notehead.cc file is very cryptic for me and I don't see how it could help
 me since I don't see anywhere a definition of 'cross or 'diamond.
 Note_head::print is too abstract for me. I don't get how 'cross tells
 ly:note-head:print to print the cross-head stencils from the feta font.

Yes, the .cc files are very hard to understand.  But after you look at a
bunch of them, it gets better

You can see where the styles are actually used to get glyph names in
scm/output-lib.scm.


 Since the drumStyleTable uses note styles to set the note heads, if you
 want
 to create your own drumStyleTable, I think you'll need to add a new
 notehead
 style.  And I have no idea how to do that.
 
 Yes, I think so too, but if even you don't know what to do I think I should
 rather drop this problem for now.

No, don't drop this problem just because *I* don't know what to do!  I'm
only an expert in fret diagrams, because I wrote the code for that.  I'm
only a bit above novice in the other LilyPond areas.  You might choose
instead to start a new thread (probably on lilypond-devel) that asks about
how one would go about defining a new notehead style with a program to
define the notehead, rather than a font glyph.  There *are* people around
who know how to do this.

 
 Hmm... maybe it is possible to write a function that checks on the position of
 each note in the drumStyle hashtable and override the style accordingly?!

Maybe, but this seems like too much of a hack to me.  But it's possible, I
suppose.  But if I were going to do it in this fashion, I think I'd add a
new style to the drumStyleTable and then try to write a new print function
that checks the style, and if it's parallelogram, use the parallelogram
print routine, otherwise, use the regular notehead print routine.

Now that I think about it, this approach is a promising way to do this
without needing to add any font glyphs (which I think would be needed to
define a new style).  You already have a template for how to do this in your
parallelogram function that Neil wrote.  It checks the grob, and if its
duration is 2, it writes the parallelogram.  Otherwise, it calls the regular
notehead stuff.

You can do this with an override to DrumVoice #'stencil

\override DrumVOice #'stencil = #'my-drum-print

And then define a function my-drum-print that will check the style of each
NoteHead to see if it calls parallelogram or calls ly:note-head::print to
handle the rest of the stuff.

But I think the output will likely be better if you define new glyphs in the
font and define a new style.

HTH,

Carl



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom drumstyle-tables with custom noteheads?

2009-02-09 Thread Carl D. Sorensen



On 2/9/09 1:30 PM, Tao Cumplido tao_lilypondu...@gmx.net wrote:

 
 Please try to send the function separately from the font.  I think that
 some
 users will be very interested in it.
 
 Apparently the sample png I sent along was too big :')
 I reduced and sent it again. This it should have gone through.
 

Thanks, it came through!

Carl



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom noteheads

2008-11-29 Thread Tao Cumplido
hi all,

well, so far I tried myself to find a solution for this and came to the point 
where scheme is the only way to do this.
My scheme is very limited, especially the connection to the ly:functions is 
something I don't really get yet. I simply don't know how to apply these 
functions I guess, or maybe when to use which function.

Generally I thought I could define a music-function that overrides the stencil 
of a NoteHead depending on the car of ly:make-duration. So if it's =1 it'll 
place a custom stencil for half and whole notes and if it's =2 for filled 
notes.
I hope that makes sense. I just don't know how to do this in lily.

Hopefully someone can help me here to understand the connection scheme-lily a 
little better.

regards,
Tao

 Original-Nachricht 
 Datum: Fri, 28 Nov 2008 14:00:29 +0100
 Von: Tao Cumplido [EMAIL PROTECTED]
 An: lilypond-user@gnu.org
 Betreff: custom noteheads

 hi list,
 
 I came across ths snippet from the lsr:
 http://lsr.dsi.unimi.it/LSR/Item?id=516
 
 Now I was thinking if it is possible to assign such custom heads to
 different duratiosn, e.g. that half notes look different than quarter and 
 eigths,
 etc.
 
 Also if it is possible to use them in a custom drum table but I think I
 can find this out easily, just if someone already knows.
 
 regards,
 
 Tao
 -- 
 Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen:
 http://www.gmx.net/de/go/multimessenger
 
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 http://lists.gnu.org/mailman/listinfo/lilypond-user

-- 
Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom noteheads

2008-11-29 Thread Neil Puttock
Hi Tao,

2008/11/29 Tao Cumplido [EMAIL PROTECTED]:

 Generally I thought I could define a music-function that overrides the 
 stencil of a NoteHead depending on the car of ly:make-duration. So if it's 
 =1 it'll place a custom stencil for half and whole notes and if it's =2 for 
 filled notes.
 I hope that makes sense. I just don't know how to do this in lily.

If you're overriding the NoteHead stencil, you can access the property
'duration-log, which will tell you the duration of the current note.
Then you can use case to set the stencil conditionally:

parallelogram =
#(lambda (grob)
  ; get duration log of NoteHead object
  (let* ((dur (ly:grob-property grob 'duration-log)))
(case dur
  ; if dur = minim, return parallelogram stencil
  ((2)
(ly:make-stencil (list 'embedded-ps
gsave
currentpoint translate
newpath
0 0.25 moveto
1.3125 0.75 lineto
1.3125 -0.25 lineto
0 -0.75 lineto
closepath
fill
grestore )
  (cons 0 1.3125)
  (cons 0 0)))
  ; otherwise, set to default print function
  (else (ly:note-head::print grob)

Regards,
Neil


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom noteheads

2008-11-29 Thread Neil Puttock
2008/11/29 Neil Puttock [EMAIL PROTECTED]:

 parallelogram =
 #(lambda (grob)
  ; get duration log of NoteHead object
  (let* ((dur (ly:grob-property grob 'duration-log)))
(case dur
  ; if dur = minim, return parallelogram stencil

Of course, this should say `if dur = crotchet/quarter note, since it
the log of the duration. :)


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: custom noteheads

2008-11-29 Thread Tao Cumplido
Yes. Thanks Neil, you're my man. =)

It'd have taken me ages to figure out that I have to use grob-property and 
'duration-log.
But I already thought that ly:make-duration was wrong.

Now I see it it makes sense and it was no problem to insert another custom 
stencil for whole and half notes.

Well, Scheme is still too complex for me.


 Original-Nachricht 
 Datum: Sat, 29 Nov 2008 16:17:30 +
 Von: Neil Puttock [EMAIL PROTECTED]
 An: Tao Cumplido [EMAIL PROTECTED]
 CC: lilypond-user@gnu.org
 Betreff: Re: custom noteheads

 Hi Tao,
 
 2008/11/29 Tao Cumplido [EMAIL PROTECTED]:
 
  Generally I thought I could define a music-function that overrides the
 stencil of a NoteHead depending on the car of ly:make-duration. So if it's
 =1 it'll place a custom stencil for half and whole notes and if it's =2
 for filled notes.
  I hope that makes sense. I just don't know how to do this in lily.
 
 If you're overriding the NoteHead stencil, you can access the property
 'duration-log, which will tell you the duration of the current note.
 Then you can use case to set the stencil conditionally:
 
 parallelogram =
 #(lambda (grob)
   ; get duration log of NoteHead object
   (let* ((dur (ly:grob-property grob 'duration-log)))
 (case dur
   ; if dur = minim, return parallelogram stencil
   ((2)
 (ly:make-stencil (list 'embedded-ps
 gsave
 currentpoint translate
 newpath
 0 0.25 moveto
 1.3125 0.75 lineto
 1.3125 -0.25 lineto
 0 -0.75 lineto
 closepath
 fill
 grestore )
   (cons 0 1.3125)
   (cons 0 0)))
   ; otherwise, set to default print function
   (else (ly:note-head::print grob)
 
 Regards,
 Neil

-- 
Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


custom noteheads

2008-11-28 Thread Tao Cumplido
hi list,

I came across ths snippet from the lsr:
http://lsr.dsi.unimi.it/LSR/Item?id=516

Now I was thinking if it is possible to assign such custom heads to different 
duratiosn, e.g. that half notes look different than quarter and eigths, etc.

Also if it is possible to use them in a custom drum table but I think I can 
find this out easily, just if someone already knows.

regards,

Tao
-- 
Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads and chords

2008-07-10 Thread Trevor Daniels


The example in section 4.6.5 of the Learning Manual might be a good starting 
point.


Trevor

- Original Message - 
From: Eric Knapp [EMAIL PROTECTED]

To: lilypond-user@gnu.org
Sent: Thursday, July 10, 2008 5:19 AM
Subject: Re: Custom noteheads and chords



Music functions? Ah, ha! That may be the answer. I'm embarrassed to
say it but I actually teach computer programming at a college and I
didn't know about music functions. I think I will be using them a lot
now that I have read about them. I can't believe that I haven't
stumbled on them before. I will try a bunch of experiments and post my
progress.

-Eric (the hopeless newbie)

On Wed, Jul 9, 2008 at 11:00 PM, Carl Sorensen [EMAIL PROTECTED] wrote:

Trevor Daniels t.daniels at treda.co.uk writes:



Eric

\tweak may be the command you need.  Have a look at section 4.1.4 
Tweaking
methods in the Learning Manual for release 2.11 to see why this is 
needed
and how to use it.  The explanation there applies just as well to 
release
2.10.  However, I believe it is not possible to use \tweak in a 
variable, so

this might not be quite the answer you want.


You can, however, use \tweak in a music function, can't you?

Carl





___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user





___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Custom noteheads and chords

2008-07-09 Thread Eric Knapp
Hello,

With the help of a recent thread I have custom noteheads working just
the way I want them except for one detail. I would like to have chords
where each note in the chord has a different custom notehead. Here's
an example.

This works and each note has its own custom notehead.
{
  \noteheadOne c
  \noteheadTwo d
}

This is a syntax error:
{
   \noteheadOne c \noteheadTwo d 2
}


This is not a syntax error but each note has noteheadTwo
{
   \noteheadOne c2 \noteheadTwo e2
}

Thanks for the help.

-Eric


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads and chords

2008-07-09 Thread Trevor Daniels

Eric

\tweak may be the command you need.  Have a look at section 4.1.4 Tweaking 
methods in the Learning Manual for release 2.11 to see why this is needed 
and how to use it.  The explanation there applies just as well to release 
2.10.  However, I believe it is not possible to use \tweak in a variable, so 
this might not be quite the answer you want.


Trevor

- Original Message - 
From: Eric Knapp [EMAIL PROTECTED]

To: List lilypond-user lilypond-user@gnu.org
Sent: Wednesday, July 09, 2008 10:27 PM
Subject: Custom noteheads and chords



Hello,

With the help of a recent thread I have custom noteheads working just
the way I want them except for one detail. I would like to have chords
where each note in the chord has a different custom notehead. Here's
an example.

This works and each note has its own custom notehead.
{
 \noteheadOne c
 \noteheadTwo d
}

This is a syntax error:
{
  \noteheadOne c \noteheadTwo d 2
}


This is not a syntax error but each note has noteheadTwo
{
  \noteheadOne c2 \noteheadTwo e2
}

Thanks for the help.

-Eric


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user





___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads and chords

2008-07-09 Thread Carl Sorensen
Trevor Daniels t.daniels at treda.co.uk writes:

 
 Eric
 
 \tweak may be the command you need.  Have a look at section 4.1.4 Tweaking 
 methods in the Learning Manual for release 2.11 to see why this is needed 
 and how to use it.  The explanation there applies just as well to release 
 2.10.  However, I believe it is not possible to use \tweak in a variable, so 
 this might not be quite the answer you want.

You can, however, use \tweak in a music function, can't you?

Carl





___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom noteheads and chords

2008-07-09 Thread Eric Knapp
Music functions? Ah, ha! That may be the answer. I'm embarrassed to
say it but I actually teach computer programming at a college and I
didn't know about music functions. I think I will be using them a lot
now that I have read about them. I can't believe that I haven't
stumbled on them before. I will try a bunch of experiments and post my
progress.

-Eric (the hopeless newbie)

On Wed, Jul 9, 2008 at 11:00 PM, Carl Sorensen [EMAIL PROTECTED] wrote:
 Trevor Daniels t.daniels at treda.co.uk writes:


 Eric

 \tweak may be the command you need.  Have a look at section 4.1.4 Tweaking
 methods in the Learning Manual for release 2.11 to see why this is needed
 and how to use it.  The explanation there applies just as well to release
 2.10.  However, I believe it is not possible to use \tweak in a variable, so
 this might not be quite the answer you want.

 You can, however, use \tweak in a music function, can't you?

 Carl





 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 http://lists.gnu.org/mailman/listinfo/lilypond-user



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Custom Noteheads

2004-07-29 Thread Mats Bengtsson
I'm afraid you have to dig into the source code yourself.
Such a project would involve several steps: designing the
font symbols for the noteheads or finding an existing font
that contains the symbols, writing a replacement or complement
to Note_head::print (in C++ or Scheme) and the corresponding
output functions in scm/output-*.scm, among others.
   /Mats
Aaron Dalton wrote:
I've done a little searching in the archives but I can't seem to find any 
specific information.  I am wanting to use Lilypond in a research project I'm 
doing.  I am doing a timepoint analysis of some pieces and the developer of 
said system uses a series of custom noteheads.  I cannot seem to find any 
place that goes into the specifics of creating one's own notehead engraver 
and how to integrate it into a working Lilypond installation.

Has anybody out there done this sort of thing?  Would you be willing to share 
some wisdom on how it is done?  Thank you so much for your time.

--
=
Mats Bengtsson
Signal Processing
Signals, Sensors and Systems
Royal Institute of Technology
SE-100 44  STOCKHOLM
Sweden
Phone: (+46) 8 790 8463 
Fax:   (+46) 8 790 7260
Email: [EMAIL PROTECTED]
WWW: http://www.s3.kth.se/~mabe
=
___
lilypond-user mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/lilypond-user


Custom Noteheads

2004-07-10 Thread Aaron Dalton
I've done a little searching in the archives but I can't seem to find any 
specific information.  I am wanting to use Lilypond in a research project I'm 
doing.  I am doing a timepoint analysis of some pieces and the developer of 
said system uses a series of custom noteheads.  I cannot seem to find any 
place that goes into the specifics of creating one's own notehead engraver 
and how to integrate it into a working Lilypond installation.

Has anybody out there done this sort of thing?  Would you be willing to share 
some wisdom on how it is done?  Thank you so much for your time.

-- 
Aaron Dalton
http://aaron.daltons.ca


___
lilypond-user mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/lilypond-user