lilypond-devel
[Top][All Lists]
Advanced

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

Re: Feature request: Extremely short repeat syntax.


From: Heikki Johannes Junes
Subject: Re: Feature request: Extremely short repeat syntax.
Date: Sun, 21 Sep 2003 02:44:50 +0300 (EEST)

On Sat, 20 Sep 2003, Han-Wen Nienhuys wrote:
> address@hidden writes:
> >
> > I would like to make a suggestion that all notes, rests, drums, etc. are
> > typeset in lower case. In contrast, all reserved words would have at least
> > one Capitalized letter. Unfortunately, only multi-measure rests do not
> > follow the convention.
>
> I think this is the wrong path to follow: I prefer it if both rests,
> skips and mmrests are user-settable, like the note names.

Ok, I'll admit that it would be easier to make editing modes if upcase
(reserved word, ugh) and downcase (note or similar) have different
meaning.  Well, this is again about conventions.

Anyway, renaming 'R' to 'rr' would be enough (to apply this convention).

> > To solve this discrepancy, the following improvement would be needed to the
> > LilyPond syntax: The use of an integer, and a fraction would mean different
> > things:
> >
> > '*2'        would mean that the syntax before is produced twice, and
> > '*2/1'      would mean that the associated duration would be corrected by
> >         multiplying with with the fraction 2/1.
>
> I think this will be confusing, and doubt whether it will work, but
> why don't you go ahead and try to write a YACC grammar for it?

Actually, I even expected that doing a lexical analysis for it would be
rather tricky. It makes life easier that '2' means the same than '2/1'.
I'll forget this.

After throwing away some ideas, however, there may be something new, the
repeat syntax, which could be introduced:

  2*c1          -> \repeat unfold 2 c1
  5*{BALLOON}   -> \repeat unfold 2 {BALLOON}

Looks like the lexical rule here is extremely simple:

INTEGER + '*'   becomes just    '\repeat unfold ' + INTEGER + ' ',
                             or '\repeat fold' + INTEGER + ' ',
                             or '\repeat tremolo' + INTEGER + ' ',

Then one could first introduce directive '\unfold' (default), '\fold', or
'\tremolos' before using the syntax:

  \unfold 2*{\tremolos 4*c16 4*b 4*d 4*c 4*e 4*f 4*b c4}

This is much shorter than writing

  \repeat unfold 2 {
     \repeat "tremolo" 4 c16 \repeat "tremolo" 4 b
     \repeat "tremolo" 4 d \repeat "tremolo" 4 c
     \repeat "tremolo" 4 e \repeat "tremolo" 4 f
     \repeat "tremolo" 4 b c4
  }

Somehow I like the shorter version. And prefixed INTEGER + '*'.

Unfortunately, I do not know YACC, even if I can sometimes make some
lexical analysis and invent an own syntax, YACC neads some learning. Maybe
learning curve for YACC is high (fast learning). This repeat syntax change
is simple, but I cannot exactly figure out what files should be changed.
I'd gladly delegate :)

...

I almost sent this mail, but one consideration more. What would happen
to these mm-rests after the new repeat syntax?

 R1*2   looks similar to        \repeat unfold 2 { r1 }, or \unfold 2*r1

One could have one repeat directive more, and write

\multimeasure 15*r1 32*r1

Oops, looking at it makes it appealing to throw 'R' away. Sorry.

Greetings,

  Heikki Junes




reply via email to

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