lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating arbitrary lines (or other postscript things)


From: Nick Payne
Subject: Re: Creating arbitrary lines (or other postscript things)
Date: Tue, 16 Nov 2010 15:44:39 +1100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

On 16/11/10 01:08, Andrew C. Smith wrote:
Dear users,

I'm working on a piece of music where certain notes need to be connected by 
dotted lines. I've tried a few different things: using \glissando and 
overriding the stencil to get a different position, or just creating \markup 
with a stencil object. I've also tried writing it in postscript (which seems to 
be the ideal solution) but I can't figure out how to return certain values of 
the notehead object. I'd like to avoid drawing the lines in by hand later, 
because I want to generate scores algorithmically.

What would be ideal (as far as I can tell) is to have a global variable that's a list of 
pairs of ly:music, then at the end of the program run a function to cycle through this 
list and draw dotted lines between all the pairs. My problem is that I can't figure out 
how to get the x/y position of the NoteHead object from a string of text like 
"d4", because as far as I've seen (and this may be way wrong, so forgive me) 
the interfaces generally are built for modifying values, not returning values for use in 
other functions. Any ideas? Or, at least places I should have already looked?

Have to admit I don't know Lilypond super well, but I've googled this problem 
pretty hard and read the manual looking specifically for it. I know mostly 
C-related languages, so Scheme is kind of bending my brain a little. Any help 
from more experienced users would be excellent.

This does something similar with a music function and a hidden voice:

\version "2.13.38"

guide = #(define-music-function (parser location padleft padright shift style) (number? number? pair? symbol?) #{
    \once \override Glissando #'style = #$style
    \once \override Glissando #'bound-details #'left #'padding = #$padleft
\once \override Glissando #'bound-details #'right #'padding = #$padright
    \once \override Glissando #'extra-offset = #$shift
#})

\relative c'' {
<<
        { c8 g e g }
    \\
{ \hideNotes \guide #-0.5 #1 #'(0 . 0) #'solid-line c4.\glissando g8 }
>>
<<
        { c8 g e g }
    \\
{ \hideNotes \guide #-0.5 #1 #'(0 . 0) #'dashed-line c4.\glissando g8 }
>>
<<
        { c8 g e g }
    \\
{ \hideNotes \guide #-0.5 #1 #'(0 . 0) #'dotted-line c4.\glissando g8 }
>>
}

Nick

Attachment: preview.png
Description: PNG image


reply via email to

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