Walt North <[email protected]> writes:

> I have a case where at times I want the notes to go up one octave and
> other times not.  I was thinking I could use tags to accomplish this. 
> But the tag seems to be ignored. The result always jumps an octave.
>
> I have tried the following combinations but I haven't hit on the right
> way to do this.
>
> sample:
>
> \version "2.26.0"
>
> testNotes =  \relative c' {
>   \tag #'testTag1 {
>   c1
>   \tag #'testTag2 \resetRelativeOctave c''
>   c1
>   }
> }
>
> testNotesB =  \relative c' {
>   c1
>   \tag #'testTag2 \resetRelativeOctave c''
>   c1
> }
>
> \score {
>   \testNotes
> }
>
> \score {
>   \keepWithTag  #'(testTag1) \testNotes
> }
>
> \score {
>   \keepWithTag  #'(testTag1 testTag2) \testNotes
> }
>
> \score {
>   \removeWithTag #'testTag2 \testNotes
> }
>
> \score {
>   \keepWithTag  #'(testTag2) \testNotesB
> }

You are confused about the order of operations it would seem.  \relative
converts the contained music to absolute music, taking note of things
like \resetRelativeOctave and other stuff inside.

\keepWithTag removes some of the contained music.

Obviously you want to _first_ remove the tags you are not using, _then_
convert the resulting relative music to absolute music.

Try this:

\version "2.26.0"

testNotes =  {
  \tag #'testTag1 {
  c1
  \tag #'testTag2 \resetRelativeOctave c''
  c1
  }
}

testNotesB = {
  c1
  \tag #'testTag2 \resetRelativeOctave c''
  c1
}

\score {
  \testNotes
}

\score {
  \relative c' \keepWithTag  #'(testTag1) \testNotes
}

\score {
  \relative c' \keepWithTag  #'(testTag1 testTag2) \testNotes
}

\score {
  \relative c' \removeWithTag #'testTag2 \testNotes
}

\score {
  \relative c' \keepWithTag  #'(testTag2) \testNotesB
}

-- 
David Kastrup

Reply via email to