lilypond-user
[Top][All Lists]
Advanced

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

Re: drawing a range reguardless of transposition


From: Aaron Hill
Subject: Re: drawing a range reguardless of transposition
Date: Thu, 28 Nov 2019 10:40:17 -0800
User-agent: Roundcube Webmail/1.3.8

On 2019-11-28 9:27 am, Sandro Santilli wrote:
On Mon, Nov 25, 2019 at 04:40:12AM -0800, Aaron Hill wrote:
On 2019-11-25 2:26 am, Sandro Santilli wrote:
> I'm trying, for backward compatibility, to keep that
> highlightOutOfRange function, is that possible ?

What compatibility are you needing?

As I've used the old function in existing scores, I'd like
to avoid changing them all to use the new function. That's
the kind of compatibility I'd be needing.

Forgive me, but did I not invent that function only two weeks ago? How busy have you been to have used it in so many scores?! (:

But, really, it should involve little more than a find-and-replace to convert the older usage to the newer. Here's a bash script to do the work:

####
#!/usr/bin/env bash
sed 's/\\override\s\+NoteHead\.color\s*=\s*\\highlightOutOfRange\s\+\('\
'#\(([^)]\+)\|\S*\)\s*\)\?\([a-z,'"'"']\+\s\+[a-z,'"'"']\+\)/\\highlig'\
'htPitches \1outside { \3 }/g' $1
####

Given an example input fragment...

%%%%
\override NoteHead.color = \highlightOutOfRange #(x11-color 'tomato) c' c'' \new Voice \with { \override NoteHead.color = \highlightOutOfRange #red c' c'' } \relative c' { c d \once \override NoteHead.color = \highlightOutOfRange c' c'' e f }
%%%%

...the script outputs the following:

%%%%
\highlightPitches #(x11-color 'tomato) outside { c' c'' }
\new Voice \with { \highlightPitches #red outside { c' c'' } }
\relative c' { c d \once \highlightPitches outside { c' c'' } e f }
%%%%

But since sed works on a line-by-line basis, it will not be able to detect cases when you have spread the \override across multiple lines.


-- Aaron Hill



reply via email to

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