Change pitch in part of a music fragment

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Change pitch in part of a music fragment

Jean-Julien Fleck
Hello,

I have a music fragment stored in a variable:

myfragment = \relative c' {c d e f g a b c d e f g}

The fragment was initially written for another instrument than the one I'm targeting so that the range is not big enough to play the whole fragment without octaviation. Here, for example, the target instrument would need use 

\relative c' {c d e f g a b c, d e f g} % note the comma after the middle c

Is it possible to use the variable \myfragment and manually tell lilypond (without editing the code of the fragment) that, for example here from the third time of the second measure until the end of the third measure, I would like to octaviate ?

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.

Thanks for any hint.

--
JJ Fleck
Physique et Informatique
PCSI1 Lycée Kléber

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Change pitch in part of a music fragment

Mark Knoop-4
At 20:29 on 01 Dec 2018, Jean-Julien Fleck wrote:

>Hello,
>
>I have a music fragment stored in a variable:
>
>myfragment = \relative c' {c d e f g a b c d e f g}
>
>The fragment was initially written for another instrument than the one
>I'm targeting so that the range is not big enough to play the whole
>fragment without octaviation. Here, for example, the target instrument
>would need use
>
>\relative c' {c d e f g a b c, d e f g} % note the comma after the
>middle c
>
>Is it possible to use the variable \myfragment and manually tell
>lilypond (without editing the code of the fragment) that, for example
>here from the third time of the second measure until the end of the
>third measure, I would like to octaviate ?
>
>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.

--
Mark Knoop

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Change pitch in part of a music fragment

Jean-Julien Fleck
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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user