[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Harp Pedals?
From: |
Reinhold Kainhofer |
Subject: |
Re: Harp Pedals? |
Date: |
Thu, 14 Aug 2008 18:56:27 +0200 |
User-agent: |
KMail/1.9.9 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Donnerstag, 14. August 2008 schrieb Valentin Villenave:
> 2007/7/8 Dewdman42 <address@hidden>:
> > I can't seem to find anything in the Lilypond manual about creating harp
> > pedal symbols. I would think this issue has been covered a lot by users
> > of Lilypond. how do I do it, or something like it:
> >
> > http://www.nabble.com/file/p11492013/ScreenHunter_03%2BJul.%2B08%2B12.40.
> >jpg
>
> I've been trying to implement this harp diagrams feature for a while,
> but my implementation is quite dirty and not fully working.
Nice to see that I'm not the only one interested in implementing harp pedal
diagrams
(http://www.mail-archive.com/lilypond-devel%40gnu.org/msg15542.html).
> Basically,
> I tried to write a markup command that would take seven arguments, one
> for each pedal. However, for some reason I cannot pass more than three
> arguments to the markup command (see below).
>
> 1 - What I'd really like to achieve is to have one single argument
> containing the whole set of pedals, like you do with your diagrams,
> such as
> \harp #"0;-1;0;1;0;0;1;"
> instead of
> \harp #0 #-1 #0 #1 #0 #0 #1
>
> However, I cannot parse the string to extract the values (I've tried
> to figure it out from your code, but it's way over my skills).
I'll try to come up with a proper parser.
> 2 - The implementation I provide is very dirty, as I said. [...]
> and inside the function I don't know how I can increment the values for
> the horizontal placement of the boxes in an elegant way.
I think the easiest and most Scheme-like way would be to loop through the
seven entries of the pedal list using recursive calls of a named let
clause... In particular:
(let process-pedal ((remaining-pedals initial-pedals)
(xpos 0))
; print the box for the (car remaining-pedals)
;
; now call the process-pedal loop with the cdr (unless we are finished)
;
(if (not (empty? (cdr remaining-pedals)))
(process-pedal (cdr remaining-pedals) (+ xpos width-of-this-pedal))
)
)
> 3 - Ideally, we should add something like
> (if (> a 0) set! a 1
> (if (< a 0) set! a 1))
> so to allow users to use any values bigger values than 1 or lower than
> -1 without breaking their result.
Actually, each entry in a harp diagram can only have three values, so I don't
like numeric representations too much (internally, lilypond uses integers for
directions, but that is hidden from the user as much as possible by #UP etc.
I don't think the users should be exposed to numbers as directions in harp
diagrams). What I was thinking of was a rough textual representation of the
states:
\harpPedals #"^--|v-^-" such a string with one letter per pedal is much easier
to parse. Of course, we can have two versions, a terse one with #"^--|v-^-"
and a "normal" one with "1;0;0;-1;0;1;0". That's just a matter of two
different string parsers before the same function is called, similar to the
fret-parse-definition-string function and the subsequent call to the function
that really generates the fret diagram.
Cheers,
Reinhold
- --
- ------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
* Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
* K Desktop Environment, http://www.kde.org, KOrganizer maintainer
* Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iD8DBQFIpGO7TqjEwhXvPN0RAoivAKCReMSX7BloLs9HYyIchHGhC+qlawCcCBX6
XqI7A0C/G2yjePZqXD4OI4E=
=PGyG
-----END PGP SIGNATURE-----
Re: Harp Pedals?,
Reinhold Kainhofer <=
Re: Harp Pedals?, Reinhold Kainhofer, 2008/08/14