lilypond-user
[Top][All Lists]
Advanced

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

Re: Invisible notes, Scheme contexts


From: Karl Hammar
Subject: Re: Invisible notes, Scheme contexts
Date: Fri, 16 Dec 2005 13:26:39 +0100

> Mats Bengtsson <address@hidden> writes:
> 
> >>>I see some cases where this would be clearly a win. Few weeks ago, a
> >>>singer asked me to change all alto clefs to treble clefs in a
> >>>voice+piano reduction score. Just redefining the \clef music function
> >>>would have made that really easy and quick.
> >>>
> >>>    
> >>>
> > A query replace alto -> treble is probably quicker than redefining the
> > function, at least if your name is not Nicolas Sceaux. :-)
> 
> This score was really big.
> 
> $ find ?-* -name "*ly" | wc -l
>      882
> 
> $ find ?-* -name "*ly" | xargs cat | wc -l
>    31446
> 

Why not make a global.ly with:
 %clefae = { \clef "treble_8" }
 clefae = { \clef bass }

And in the score you do something like Score.01.ly:
...
\include "global.ly"
\include "Music.01.ly"
...
       \new Lyrics \lyricsto vspAA \lspAA
       \new Staff \context Voice = vaeAA {
         \set Staff.instrument = \markup { "Aeneas"       }
         \set Staff.instr = \markup { "Ae"       }
         { \keyAA \clefae \aeAA }
       }
...
(example from http://aspodata.se/noter/dido_et_aeneas/)

It was a quick change to make the tenor part with the bass clef at a 
request of the singer.

This might help you:

  $ find . -name \*.ly | xargs fgrep -C3 '\clef alto' | less

and if all seem straitforward, do this:

------------------------------------------------------
#!/bin/sh

from='\\clef alto'
to='\\clef treble'

qs () {
    a="$1"
    shift
    echo = $a =======================================
    grep -C3 "$from" "$a"
    (
    exec < /dev/tty
    echo -n "substitute (y), edit (e), test (t) or leave as is (n): "
    read b
    case "$b" in
        [tT]* )
          sed -e s/"$from"/"$to"/ < "$a" | less;;
        [yY]* )
          mv "$a" "$a.old"
          sed -e s/"$from"/"$to"/ < "$a.old" > "$a";;
        [eE]* )
          emacs "$a";;
    esac
    )
}

find . -name \*.ly |
xargs grep "$from" |
cut -f1 -d: |
while read a
do
  qs "$a"
done
------------------------------------------------------

Regards,
/Karl

-----------------------------------------------------------------------
Karl Hammar                    Aspö Data               address@hidden
Lilla Aspö 2340                                                Networks
S-742 94 Östhammar          +46  173 140 57                   Computers
Sweden                     +46  70 511 97 84                 Consulting
-----------------------------------------------------------------------






reply via email to

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