Re: square note heads for cluster

2008-10-14 Thread Sebastian Menge
Am Mon, 13 Oct 2008 20:24:37 +0200
schrieb [EMAIL PROTECTED]:

 I need to notate some clusters using squared rhythmic note-heads,
 something along the lines of this figure:

I was recently looking for that kind of clusters too. It is really
standard in some contemporary music.

If someone knows how to do it, you could make two ppl happy :-)

Seb.


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


Re: square note heads for cluster

2008-10-14 Thread Mark Polesky
Anders,

I recently started working on a keyboard-cluster function, but it's
a big project and I haven't gotten very far yet. I've attached a png
generated by the file included below to share some basic ideas about
my initial approach. Perhaps this will help you. I'm finding myself
able to make the clusters look however I want them to look, but I
want one all-encompassing function to apply arbitrary cluster-styles
on the fly. It's not necessarily difficult, but I want to support a
wide variety of cluster-styles, which will take me some time.

In the end, I'd have my function generate embedded-ps paths and fill
in the missing notes dynamically, but for the moment I'm applying my
cluster-styles manually (see below).

Regarding your question:
 ...is there a good list of various 'ly:' info-grabbing functions...?

Try this:
http://lilypond.org/doc/v2.11/Documentation/user/lilypond-internals/Scheme-functions#Scheme-functions

Hope this helps.
- Mark

--

\version 2.11.61-1

squareA =
#(ly:make-stencil (list 'embedded-ps
gsave
currentpoint translate
newpath
0 0.51 moveto
1 0.51 lineto
1 -0.51 lineto
0 -0.51 lineto
closepath
fill
grestore)
  (cons 0 1)
  (cons 0 0))

squareB =
#(ly:make-stencil (list 'embedded-ps
gsave
currentpoint translate
newpath
0.3 0.51 moveto
1.0125 0.51 lineto
1.0125 -0.51 lineto
0.3 -0.51 lineto
closepath
fill
grestore)
  (cons 0 1.3125)
  (cons 0 0))

\relative {
  \once \override Voice.NoteHead #'X-offset = #0
  \once \override Voice.NoteHead #'stencil = \squareA
  c d e f g a b c4

  \once \override Voice.NoteHead #'X-offset = #0
\once \override NoteHead #'stem-attachment = #'(1 . 7)
  c
\tweak #'stencil \squareB d
\tweak #'stencil \squareB e
\tweak #'stencil \squareB f
\tweak #'stencil \squareB g
\tweak #'stencil \squareB a
\tweak #'stencil \squareB b c4
}


  attachment: clusters_1.png___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: square note heads for cluster

2008-10-14 Thread andersvi
Heres a start on a cluster-chord function.

A question someone might help answer:

When using the music-function on a chord - ie \clusterKord e g2 - it
only 'eats' the first note of the chord, and appends the second one as a
separate note if i dont 'kill it' inside the music-function.

The code below just deletes it and handles stem-lengths explicitly,
however this breaks explicit beaming and possibly other things.

Any hints?

If some lilypond-guru would bother to hint on ways to improve this it
would of course help me a lot further on.  Im just starting to work with
lilypond, and everything seems chaotic atm.  Thanks.  Anders.

attachment: cluster-shot.png

\version 2.11.57


#(define (sort-chord chord pred)
   (define (note-y music)
 (let* ((n (ly:music-property music 'element))
(p (ly:music-property music 'pitch)))
   (cond ((ly:music? n) (note-y n))
 ((ly:pitch? p) (let* ((o (ly:pitch-octave p))
   (n (ly:pitch-notename p)))
  (+ (* 7 o) n))
   (sort chord (lambda (n1 n2) (pred (note-y n1) (note-y n2)


#(define (chord-y-extent music)
   (define (note-y music)
 (let* ((n (ly:music-property music 'element))
(p (ly:music-property music 'pitch)))
   (cond ((ly:music? n) (note-y n))
 ((ly:pitch? p) (let* ((o (ly:pitch-octave p))
   (n (ly:pitch-notename p)))
  (+ (* 7 o) n))
   (let ((alle-ys  (map note-y (ly:music-property music 'elements
 ;;(display alle-ys)
 (cons (apply min alle-ys) (apply max alle-ys

#(define (leggtilbokshue akkord)
   (let* ((bunn-topp (chord-y-extent akkord))
  (bunn (car bunn-topp))
  (topp (cdr bunn-topp))
  (filled? (let ((dur (ly:music-property
   (car (ly:music-property akkord 'elements))
   'duration)))
 (and (ly:duration? dur)
  ( (ly:duration-log dur) 1)

 (make-music
  'SequentialMusic
  'elements (cons
 (make-music
  'ContextSpeccedMusic 'context-type 'Bottom
  'element (make-music
'OverrideProperty 'pop-first #t
'grob-property-path (list (quote stencil))
'grob-value ly:text-interface::print
'once #t
'symbol 'NoteHead))

 (cons
  (make-music
   'ContextSpeccedMusic 'context-type 'Bottom
   'element (make-music
 'OverrideProperty 'pop-first #t
 'grob-property-path (list (quote length))
 ;; whats the default stem-length?
 ;; how to find whether a stem is up or down?
 'grob-value (+ (- topp bunn) 7) 
 'once #t
 'symbol 'Stem))
  (cons (make-music
 'ContextSpeccedMusic 'context-type 'Bottom
 'element (make-music
   'OverrideProperty
   'pop-first #t
   'grob-property-path (list (quote text))
   ;; adjust to non-filled with 'unfilled durs:
   'grob-value
   (let ((xs (cons 0 1))
 (ys (cons -0.5 (+ (/ (- topp bunn) 2) 
0.5) )))
 (if filled?
 ;; cludge, replace with graphics-code
 (markup #:line (#:line (#:filled-box 
xs ys 0)))
 (markup #:line (#:box (#:pad-to-box xs 
ys (#:null))
   'once #t
   'symbol 'NoteHead))
;; this breaks explicit beamings
(list (car (sort-chord (ly:music-property akkord 
'elements) )


clusterKord = #(define-music-function (parser location music) (ly:music?)
(leggtilbokshue  music))

% TODO: handle stem-direction, nice drawing-func ('stencil'), get rid of 
grid-lines?, user-choices, 

%{
 headFirkant = {
 \once \override NoteHead #'stencil = #ly:text-interface::print
 \once \override NoteHead #'text =  #(markup #:line (#:filled-box '(0.0 . 1.0) 
'(-0.5 . 2.0) 0))
 }
%}

\layout { ragged-right = ##t }
{
  \clusterKord d' g'1
  \clusterKord a, g''2
  \clusterKord a' g'8
  \clusterKord a' d'8
   a' g'8[
   a' d'8]
}

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


Re: square note heads for cluster

2008-10-14 Thread andersvi
 M == Mark Polesky [EMAIL PROTECTED] writes:

M I'm finding myself able to make the clusters look however I want
M them to look, but I want one all-encompassing function to apply
M arbitrary cluster-styles on the fly.

M It's not necessarily difficult, but I want to support a wide
M variety of cluster-styles, which will take me some time.

M In the end, I'd have my function generate embedded-ps paths and
M fill in the missing notes dynamically, but for the moment I'm
M applying my cluster-styles manually (see below).

Thanks.

I guess an approach could be to set up a music-function which takes as
input a chord and adds a markup to it:

 - finds the positions of the top and lower notehead

 - draws or fills (depending on duration) a box with some note-head-size
   width (or thinner if note-heads are to be included) and y0 and y1 =
   extent of chord.  Preferably doing some graphical tweaks such as
   thicker lines on top/bottom than sides etc.

 - optionally gets rid of default noteheads, or replacing with some
   manually prescribed heads (pr. note/pr. chord)

Ill send something which could be a start in the next post.

-anders


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


square note heads for cluster

2008-10-13 Thread andersvi
Hello.

I need to notate some clusters using squared rhythmic note-heads,
something along the lines of this figure:

attachment: aaa.png
Its possible to set up a music-function to generate a square markup
based on the pitches of a chord, but i think this way of notation
clusters is pretty standard so maybe someone already have something
lying around?

If not, is there a good list of various 'ly:' -prepended info-grabbing
functions returning ambitus, notes, pithces, note-lines, y-positiions
and the like?

Thanks.

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