lilypond-devel
[Top][All Lists]
Advanced

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

Re: \times vs. \tuplet


From: Mats Bengtsson
Subject: Re: \times vs. \tuplet
Date: Wed, 12 Dec 2007 14:04:48 +0100
User-agent: Thunderbird 2.0.0.5 (X11/20070716)

A few comments on your patch.

I hope you realize that the first attempt to introduce music functions in the manual
are not in this chapter, but in "Advanced tweaks with Scheme" in the LM.

========================================
@@ -47,38 +47,56 @@ code is easy.  The general form of these functions is

@example
function =
-#(define-music-function (parser location @var{var1} @var{var2}... )
-                        (@var{var1-type?} @var{var2-type?}...)
+#(define-music-function (parser location @var{variable}  )
+                        (@var{variable-type?})
==========================================
In general, a music function can take more than one argument, so if you first want to start with the single argument case, then you should replace "general
form" by something else. From a pedagogical point of view, I would rather
propose to start with a concrete example and use that as a starting point for
the more general description (on the other hand, this is not the learning
manual).

=============================================
address@hidden @var{...music...}  @tab is a normal LilyPond expression,
+                                    in which variables can be included
+                                   using @code{#$variable1}.
address@hidden multitable
+
address@hidden: is the "#" character really still needed here? -vv
==============================================
If you refer to the "#" character in "#$variable1", then you can easily
verify, for example in the triplet example, that it does not even work
to have a "#" character in that particular example. However, the answer
is not that simple. If you look at the padText example that's currently
included in the manual, it uses #$pad. Why? Since you normally
would have said something like
\once \override TextScript #'padding = #2.3
So, in both the \triplet and \padText functions and all other music functions
where the actual job is done within #{...#}, the correct explanation is
that you access the variable using an expression of the form $variable1
and that any preceeding # has nothing to do with the fact that you have
a variable.
To complicate things, though, what we said so far is not true if you
instead write the implementation of the music functions directly in Scheme,
as for example can be seen in "Doubling a note with slurs (example)".
From within Scheme, you access the variable just like any other Scheme
variable without the "$".

Conclusion: You should definitely remove the "#", but if you are outside
a #{...#} block, then you should also remove the "$" (however such music
functions are currently only described in the next subsection).

  /Mats


Valentin Villenave wrote:
2007/12/12, Mats Bengtsson <address@hidden>:

Out of curiosity, which of the two functions do you
use the most, the one with one or with three arguments?

As a matter of fact, you posted the one with one argument before
adding your snippet:
http://lists.gnu.org/archive/html/lilypond-user/2007-01/msg00503.html

So I began with this function, and never really tried the other (had I
known that the other one was also possible, I probably would have used
this instead).

I type \t for "\times 2/3", \tt for "4/5" and \ttt for "4/6" and I use
all of them a *lot*.

But the main thing is that this very function made me fully understand
how to write basic notemode music-functions using Scheme (I had tried
to read the Manual, but had felt immediately quite discouraged).

So, thank you very much!

Graham: By the way, Mats' question made me think about possible
corrections in the NR.
I know GDP isn't close to deal with Scheme section yet, but here's a
patch against /master if you're interested in it. It's a bit large but
as you'll see, it's just about adding more progressive explanations
about the examples, and begin with Mats' magical example that once
made me understand everything :)

For the record: although my laptop is broken and I'm running Windows
on an old 600MHz box, I managed to make this patch thanks to the whole
new msysGit!

Valentin

--
=============================================
        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: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

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