[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Harp Pedals?
From: |
Valentin Villenave |
Subject: |
Re: Harp Pedals? |
Date: |
Thu, 14 Aug 2008 19:16:36 +0200 |
2008/8/14 Carl D. Sorensen <address@hidden>:
> Valentin, you made my day. To have somebody asking _me_ questions
> about LilyPond programming is a first. I've been the one asking
> everybody else questions. Thanks!
Well, had I known it would make your day, I'd have spent less time
looking at your code and asked my question sooner :-)
> You really don't want to get in the string business for this case.
> It's much easier to just pass one argument to the function, a
> list of pedal values.
Oh yeah! Stupid, stupid me. I simply forgot about the list type.
> If you really want to do this (why would users want to have values
> greater than 1 or less than -1? I don't know harp music, so I can't say),
You have a point. However, what Reinhold proposes is even sexier (see below).
> This requires you to use lambda expressions, which are kind of confusing.
Are lambda expressions related to http://en.wikipedia.org/wiki/Lambda_calculus?
If so, I have to confess I kinda gave up every time I tried to read
the Wikipedia page... :(
> If you're going to do scheme programming with lilypond, lambda functions
> are your friends, even though they can be confusing.
I'll try harder then...
> At the time I wrote fret-diagrams, constants like 4, 2, and 0.4
> were frowned upon. So I used variables connected to properties
> every time I needed a constant like this, and there was concern about
> polluting the property name space, so I created fret-diagram-details.
Yes indeed.
> Also, LilyPond coding standards call for using full words rather than
> abbreviations for variable names. x, y, a, b and so forth should only
> be used as part of a lambda function definition.
Actually, d c b and so on referred to the note of the pedals.
> With make-pedal-stencil defined you can now add a new variable to your let
> assignment list
[...]
> And before your code to add stencils you can do a for-each:
[...]
> Which should glue all of your pedal stencils together in one big
> stencil pedals-stencil.
Great! This definitely looks good.
> I think it's good for you to figure out how it works, so I've left the
> debugging to you. If you have more questions, feel free to ask.
I guess I will, pretty soon :)
Many thanks anyway.
2008/8/14 Reinhold Kainhofer <address@hidden>:
> 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).
Oh yes, I remember now that you had asked for possible glyphs.
> 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:
The problem is that the pedal boxes are not evenly spaced (there are
three on one side, four on the other).
> 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.
This is just awesome! Can it be handled by pure Scheme though, or does
this need to be dealt with on the C++ side?
> 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.
This looks really, really cool, though way beyond my knowledge. Nice
to have some "real" people on my side, anyway :-)
Cheers,
Valentin
Re: Harp Pedals?, Reinhold Kainhofer, 2008/08/14
Re: Harp Pedals?, Reinhold Kainhofer, 2008/08/14