Hello Mark,
>The goal is obviously to be able to switch instruments without
>copy/pasting global music fragment but just locally tell lilypond to
>octaviate when needed for a given instrument.
Take a look at <http://lsr.di.unimi.it/LSR/Item?id=773>. The \correctOctaveOutOfRange function should do what you want.
Thanks, that's already a first step, but I would like to be able to fine-tune it a bit more for musical coherence: some part of the music that is off-limit would be octaviate but together with a part that could have been played at the correct pitch.
--
JJ Fleck
Physique et Informatique
PCSI1 Lycée Kléber