> Subject: Re: Combining \markup and \set
> ----- Original Message ----- From: "David Sumbler" <[email protected]>
> To: <[email protected]>
> Sent: Tuesday, November 08, 2016 3:14 PM
> Subject: Combining \markup and \set
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> \version "2.19.48"
>>
>> pizz = \markup { \larger \italic "pizz." }
>> midiPizz = \set Staff.midiInstrument = "pizzicato strings"
>>
>> arco = \markup { \larger \italic "arco" }
>> midiArco = \set Staff.midiInstrument = "violin"
>>
>> \score {
>> \relative c'' {
>> \new Staff \with { midiInstrument = "violin" } {
>> c2 \midiPizz c4^\pizz c |
>> \midiArco c2^\arco r \bar "|."
>> }
>> }
>> \layout { }
>> \midi { }
>> }
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> The above works as I would wish it to. However, I am wondering whether
>> it can be simplified.
>>
>> 1) Is there a way of combining \pizz and \midiPizz into one variable?
>> Preferably it needs to be attached to the note (as \pizz already is)
>> so that the printed marking can be placed above or below the stave.
>> Similarly, of course, for \arco and \midiArco.
>>
>> 2) '\unset Staff.midiInstrument' would be preferable to 'set
>> Staff.midiInstrument = "violin"', because it would not need to be
>> redefined in each instrumental part. However it does not work in a
>> voice context. Is there a way of reverting the midiInstrument to its
>> previous setting which could still be included in a variable?
>>
>> David
>>
>

Just curious, does changing the Staff.midiInstrument midstream produce more
than one MIDI track?



Below is one way to simplify your expressions.

I wasn't happy with this solution in that I couldn't find a way to apply a
markup to the music expression $note within the music function, and instead
had to apply it to an empty chord preceding the note.



\version "2.19.15"

pizz = \markup { \larger \italic "pizz." }
midiPizz = \set Staff.midiInstrument = "pizzicato strings"
myPizz = #(define-music-function (parser location note) (ly:music?) #{
    { \midiPizz <>^\pizz $note  }
#})

arco = \markup { \larger \italic "arco." }
midiArco = \set Staff.midiInstrument = "violin"
myArco = #(define-music-function (parser location note) (ly:music?) #{
    { \midiArco <>^\arco $note  }
#})

\score {
    \new Staff \with { midiInstrument = "violin" } {
        \relative c'' {

            c2 \midiPizz c4^\pizz c |
            \midiArco c2^\arco r \bar "|." \break

            c2 \myPizz c4 c |
            \myArco c2 r \bar "|."
        }
    }
    \layout { }
    \midi { }
}





David Elaine Alt
415 . 341 .4954                                           "*Confusion is
highly underrated*"
[email protected]
self-immolation.info
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to