Just to close the loop on this, the snippet below seems to work and doesn't
directly modify the midi limits 9which might be hard to set back). I suspect
this can still be simplified by someone more knowledgable than me. Along the
way I discovered two things:
Changing the midiMaximumVolume / midiMinimumVolume only takes effect when the
next dynamic is hit (maybe answers the question in Lukas's suggested snippet?).
The documentation for controlling midi dynamics suggests the mapping of
dynamics to midi volumes is in midi.scm, but that file doesn't really mention
dynamics. Unless I've missed something it is actually defined in midi-init.ly
<http://midi-init.ly/> (lines 21-35). If the documentation really is wrong I'd
be happy to try and contribute a fix for that link, but I would need someone to
hold my hand through the process.
Thanks for all the help.
Ben
---
\version "2.23.10"
music = \fixed c' {
f1
\repeat volta 2 {
% Implement the ff - pp dynamic
<>_\markup{\dynamic ff - \dynamic pp}
\once \hide DynamicText
\tag MIDI \volta 1 <>-\ff
\tag MIDI \volta 2 <>-\pp
g1
a1
}
}
\score {
\removeWithTag MIDI \music
}
\score {
\unfoldRepeats \music
\midi {}
}
---
> On 3 Aug 2022, at 07:03, Benjamin Tordoff <[email protected]> wrote:
>
> I’ll give that a go - thanks for both suggestions.
>
> Ben
>
>>
>> On 2 Aug 2022, at 19:25, Lukas-Fabian Moser <[email protected]> wrote:
>>
>> Hi Benjamin,
>>
>>> Am 02.08.22 um 18:10 schrieb Benjamin Tordoff:
>>> Hi all, I’m wondering if there’s a smart way to make the midi output for a
>>> particular part do the following two things (both common in Sousa marches):
>>>
>>> 1. Have a part play only on 2nd time through the repeat.
>>> 2. Have different dynamic for 1st and 2nd times through repeat.
>>>
>>> A minimal example of how I would typically typeset this is below but
>>> produces midi output that plays all repeats with uniform volume. I've had a
>>> good hunt around the internet for examples of doing this but either I'm
>>> searching for the wrong things or this is a somewhat obscure request!
>>>
>>> Thanks in advance.
>>
>> Some of this can be achieved using the \volta command:
>>
>> \version "2.23.7"
>>
>> myScore =
>> \relative {
>> <>^"2nd time left, 3rd time right!"
>> \repeat volta 3
>> {
>> \tag MIDI \volta 2 \set midiPanPosition = -1
>> % \tag MIDI \volta 2 \set midiMaximumVolume = 0 % does not do anything;
>> why?
>> \tag MIDI \volta 3 \set midiPanPosition = 1
>> c'4 d \tag MIDI \volta 3 <>\pp e f
>> }
>> }
>>
>> \score {
>> \removeWithTag MIDI \myScore
>> }
>>
>> \score {
>> \unfoldRepeats \myScore
>> \midi {}
>> \layout {} % for debugging only
>> }
>>
>> Here I used a tag to keep the print version of the score clean from all the
>> MIDI stuff.
>>
>> I just do not know why the setting of midiMaximumVolume does not do anything
>> if put inside a \volta construction. For the pan position, it works like a
>> charm...
>>
>> Lukas
>>
>