Re: Is there a property that would set all of the "above staff" text to "above chordnames"

2024-01-01 Thread Valentin Petzel
Hello Kevin,

Am Montag, 1. Jänner 2024, 21:24:16 CET schrieb Kevin Cole:
> Or vice versa?
> 
> What I mean is, I often have a situation where there's only a wee bit
> o' text occasionally, above the staff. But I frequently have
> ChordNames. It seems to me that the ChordNames would be better placed
> below the occasional text, and I was hoping that, rather than manually
> adjusting and specifying how far to adjust the occasional text, there
> would be some other property that would set the order, keeping
> ChordNames more intimately tied to the Staff that appears below it.

A TextScript is engraved at voice level. It does not really know that there 
are ChordNames above. Rather use the right tool: Use Marks:

melody = \relative c'' {
  \global
  \clef treble
  \sectionLabel \markup \bold "CHORUS"
  a2 f2 | %  9
  g4 g4 g8[ f8] e4 | % 10
  d4. e8 f4 e4 | % 11
  d4 b4 g2 | % 12
}

If you want a behaviour more like a TextScript use

\override Score.SectionLabel.non-musical = ##f

Also check out the other types of marks there are for different things like 
text marks, metronome marks. rehearsal marks.

> Another solution that would suit me would be for \chordmode to allow
> associating text with a chord name -- e.g. something like
> 
> d2:m^\markup "put me above the chordname"

This is in fact possible. The problem is that \chordmode does its own thing, 
so syntax like ^\markup won’t work:

\new ChordNames \with {
  \consists Text_engraver
} << \chordmode { d2:m } <>^\markup "put me above the chordname" >>

But you can use music functions for this:

putAbove =
#(define-music-function (what where) (scheme? ly:music?)
   #{ << #where <>^#what >> #})

putBelow =
#(define-music-function (what where) (scheme? ly:music?)
   #{ << #where <>_#what >> #})

putNeutral =
#(define-music-function (what where) (scheme? ly:music?)
   #{ << #where <>-#what >> #})

\new ChordNames \with {
  \consists Text_engraver
} \chordmode {
  \putAbove "put me above the chordname" d2:m
  \putBelow "put me below the chordname" d2:m
}


Cheers,
Valentin

signature.asc
Description: This is a digitally signed message part.


Re: Is there a property that would set all of the "above staff" text to "above chordnames"

2024-01-01 Thread Thomas Morley
Am Mo., 1. Jan. 2024 um 21:59 Uhr schrieb :
>
> On Mon, 1 Jan 2024, Kevin Cole wrote:
>
> > What I mean is, I often have a situation where there's only a wee bit
> > o' text occasionally, above the staff. But I frequently have
> > ChordNames. It seems to me that the ChordNames would be better placed
> > below the occasional text, and I was hoping that, rather than manually
>
> You can't really put the text in a Staff and have ChordNames appear
> between the text and the staff, because ChordNames is a context kind of
> like a staff in itself.  Trying to position it in the middle of a Staff
> context is a recipe for annoyance.  But if you're willing to define the
> text separately, you could create a Dynamics context and put your text
> there to get a similar visual effect.  The nonstaff-nonstaff padding
> override can be varied to taste; without it, the text collides with the
> top of the ChordNames in an unsightly way.
>
> global = {
>   \time 4/4
>   \key c \major
> }
>
> textMarkups = {
>   s1^\markup \bold "CHORUS" |
>   s1 |
>   s1 |
>   s1 |
> }
>
> chordNames = \chordmode {
>   \global
>   f2 d2:m | c4 s4 c8 g8:7 c4 | g4 c4 f4 c4 | g4 s4 g2:7|
> }
>
> melody = \relative c'' {
>   \global
>   \clef treble
>   a2 f2 |
>   g4 g4 g8[ f8] e4 |
>   d4. e8 f4 e4 |
>   d4 b4 g2 |
> }
>
> \score {
>   <<
> \new Dynamics \with {
>   \override VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = #1
> } { \textMarkups }
> \new ChordNames \chordNames
> \new Voice = "mel" { \melody }
>   >>
> }
>
> --
> Matthew Skala
> msk...@ansuz.sooke.bc.ca People before tribes.
> https://ansuz.sooke.bc.ca/
>

A Dynamics may be a solution.
For things like "CHORUS" I'd always use \textMark. It will
automatically be placed on top.
In a ChordNames context TextScript is not supported by default,
additionally the usual direction-modifiers "-" and "^" are already
taken for different purpose. But you could do:

\new ChordNames
  \with { \consists Text_engraver }
  \chordmode {
d2:m _\tweak direction #UP _\markup "put me above the chordname"
  }

Cheers,
  Harm



Re: Is there a property that would set all of the "above staff" text to "above chordnames"

2024-01-01 Thread mskala
On Mon, 1 Jan 2024, Kevin Cole wrote:

> What I mean is, I often have a situation where there's only a wee bit
> o' text occasionally, above the staff. But I frequently have
> ChordNames. It seems to me that the ChordNames would be better placed
> below the occasional text, and I was hoping that, rather than manually

You can't really put the text in a Staff and have ChordNames appear
between the text and the staff, because ChordNames is a context kind of
like a staff in itself.  Trying to position it in the middle of a Staff
context is a recipe for annoyance.  But if you're willing to define the
text separately, you could create a Dynamics context and put your text
there to get a similar visual effect.  The nonstaff-nonstaff padding
override can be varied to taste; without it, the text collides with the
top of the ChordNames in an unsightly way.

global = {
  \time 4/4
  \key c \major
}

textMarkups = {
  s1^\markup \bold "CHORUS" |
  s1 |
  s1 |
  s1 |
}

chordNames = \chordmode {
  \global
  f2 d2:m | c4 s4 c8 g8:7 c4 | g4 c4 f4 c4 | g4 s4 g2:7|
}

melody = \relative c'' {
  \global
  \clef treble
  a2 f2 |
  g4 g4 g8[ f8] e4 |
  d4. e8 f4 e4 |
  d4 b4 g2 |
}

\score {
  <<
\new Dynamics \with {
  \override VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = #1
} { \textMarkups }
\new ChordNames \chordNames
\new Voice = "mel" { \melody }
  >>
}

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before tribes.
https://ansuz.sooke.bc.ca/



Is there a property that would set all of the "above staff" text to "above chordnames"

2024-01-01 Thread Kevin Cole
Or vice versa?

What I mean is, I often have a situation where there's only a wee bit
o' text occasionally, above the staff. But I frequently have
ChordNames. It seems to me that the ChordNames would be better placed
below the occasional text, and I was hoping that, rather than manually
adjusting and specifying how far to adjust the occasional text, there
would be some other property that would set the order, keeping
ChordNames more intimately tied to the Staff that appears below it.

Another solution that would suit me would be for \chordmode to allow
associating text with a chord name -- e.g. something like

d2:m^\markup "put me above the chordname"

The following illustrates the problem.

%%%
\version "2.24.2"
\language "english"

global = {
  \time 4/4
  \key c \major
}

chordNames = \chordmode {
  \global
  f2 d2:m | c4 s4 c8 g8:7 c4 | g4 c4 f4 c4 | g4 s4 g2:7| %  9 - 12
}

melody = \relative c'' {
  \global
  \clef treble
  a2^\markup \bold "CHORUS" f2 | %  9
  g4 g4 g8[ f8] e4 | % 10
  d4. e8 f4 e4 | % 11
  d4 b4 g2 | % 12
}

\score {
  <<
\new ChordNames \chordNames
\new Voice = "mel" { \melody }
  >>

  \layout {
\autoBeamOff
indent = 0\mm
  }
}
%%%