> >> I'm dealing with several of these MIDI errors during compilation of a
> >> long
> >> piece.
> >> "programming error: Impossible or ambiguous (de)crescendo in MIDI."
> >>
> >> I tried to get rid of these by placing a starting volume, but alas, it's
> >> not
> >> that simple.
> >
> > The approach I use is to define some dynamics that don't print, and use
> > them when necessary.
> Indeed, I'm aware of this solution.  But v2.18 won't state which line or
> measure is triggering the errors.
> Since I'm cleaning up a long piece, finding which notes eliminate the
> errors
> is non-trivial.  Trial/error search is very time-consuming due to compile
> time and the hundreds of hairpins to review.  Since the issue relates to
> starting volume, commenting out sections of the piece hoping to isolate to
> fewer measures injects its own set of issues.

While David demonstrated that 2.19 shows the line numbers, regardless there
is an easier approach where that information should not matter.

1) Create at least one non-printing dynamics definition, like \xppp
2) Do a global search/replace of \< with \xppp\<
3) For each dynamic actually used in the piece, do a global search/replace,
for example
    replace \p\xppp\< with \p\<
    replace \mp\xppp\< with \mp\<
    replace \ff\xppp\< with \ff\<

The first replacement should fix all your MIDI dynamics issues (of this
type), since you will no longer have any crescendi without starting

It will also likely create new errors  ("Two simultaneous absolute-dynamic
and "Previous absolute-dynamic event here") any place already where a
crescendo did start from a specific dynamic.

These new errors can be fixed by the second set of replacements.  (And
maybe this type of error does include line numbers in 2.18, possibly making
it more tractable to fix?)

Of course, this only works to the extent that your input syntax is
consistent in terms of use of spaces, dynamics and crescendi being
adjacent, and not separated by articulations and markup, use of \< rather
than \cresc etc.)

To the degree that your input syntax is inconsistent in terms of use of
spaces, you might be able to  need just need to do more search/replacing to
deal with those cases.

And/or do pre-processing to eliminate spaces, like replace " \<" with
"\<".  Or doing the search/replace with a regexp that can accommodate
spaces, such as these perl one-liners you can run on the command line and
operate on the file in place.

# Remove spaces between dynamics and crescendo
perl -p -i -e 's/\\([mpf]+)\s*\\</\\$1\\</g' your-file.ly

# Insert non-printing starting dynamic before each crescendo
perl -p -i -e 's/\\</\\xppp\\</g' your-file.ly

# Remove the duplicate dynamics
perl -p -i -e 's/\\pp\\xppp/\\pp/g' your-file.ly
perl -p -i -e 's/\\p\\xppp/\\p/g' your-file.ly
perl -p -i -e 's/\\mp\\xppp/\\mp/g' your-file.ly
perl -p -i -e 's/\\mf\\xppp/\\mf/g' your-file.ly
perl -p -i -e 's/\\f\\xppp/\\f/g' your-file.ly
perl -p -i -e 's/\\ff\\xppp/\\ff/g' your-file.ly


David Elaine Alt
415 . 341 .4954                                           "*Confusion is
highly underrated*"
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
lilypond-user mailing list

Reply via email to