lilypond-user
[Top][All Lists]

Re: invisible rest that takes no horizontal space

 From: Arle Lommel Subject: Re: invisible rest that takes no horizontal space Date: Fri, 18 Jun 2010 10:08:51 -0400

> On 6/18/10 12:32 PM, Dmytro O. Redchuk wrote:
>> Why not:
>>  % [...]
>>  d4. e8 fis4 e |
>>  \partial 2
>>  d2 \bar ":|:"
>>  fis2 g |
>>  % [...]
>>
>
> Yes. That would be the solution if I could start from scratch. The
> problem is that I have more than 1000 melodies in which the
> invisible rest is used instead of \partial. We do not have the
> resources to change them all.

Dmytro, how well defined are the contexts where these occur? If the patterns
are well enough defined, you could probably automate all the replacements with
\partial by using a regular expression across all the files that is centered on
looking for the s2 sorts of things. Whether it would work would really depend
on how predictable these things would be. It would be much simpler if you were
using bar checks as then there would be something in the pattern to anchor the

d2 s2 \bar ":|:"

could be accounted for with something like

Search string:
([a-g](?:is|es)?2) s2 \\bar ":\|:"

Replacement string:
\\partial 2\r\1 \\bar ":|:"

Depending on your environment, you might have to modify the strings to match
your flavor of regex. I've tested this pattern and it accounts for your test
case. Where it would break down is if these partial measures are variable in
length or if you have variable numbers of notes before the spacer, in which
case it might not work. If there is anything that indicates the measure bar
line location that starts the partial measure, it should be possible (even if
that something is just a new line).

If you aren't comfortable with regex and would like me to look at some examples
to see if you could automate the replacements, let me know off list and I may
be able to help if you want to see if it's possible to fix these that way.

-Arle