IanHacker
IanHacker

Reputation: 581

How to display chord names above staff

I'm a newbie in Lilypond and am trying to write a sheet music with chord names and a bass line. I'd like to show the chord names above the staff; however, they are actually shown below the staff. I'm writing baseChords before baseMelody, but it doesn't help at all. Here's my entire code:

baseChords = \chords {
    \set chordChanges = ##t
    c1:m7 f:7 bes:maj7 ees:maj7 
    a:m7.5- d:7.13- g:m6 g:m6 
}

baseMelody = \fixed c {
  \language "english"
c4 c ef g, 
f, f, a, c 
bf, bf, d f, 
ef ef g, bf, 
a, a, c ef 
d d fs, a, 
g, g, bf, d 
g, g, bf, d 
g,1
}

melody = {
  \key g \minor
  \clef bass
  \tempo 4 = 108
  <<
  \baseChords
  \baseMelody
  >>
}

\score {
  \new Staff <<
    \new Voice \melody
  >>
  \layout { }
}

\score {
  \new Staff <<
    \new Voice {
      r\mf
      \set Staff.midiInstrument = #"electric bass (finger)" \melody
    }
  >>
  \midi { }
}

... I referred to Demo MidiInstruments to write this code. This is too complicated for me, but I'd also like to play the MIDI, so I can't avoid using that. This is the best I can do for now. Please help me. Thank you in advance.

Upvotes: 4

Views: 959

Answers (1)

gilbertohasnofb
gilbertohasnofb

Reputation: 2054

I think the best approach is to keep the chords and the melody separated, and then you can simply create a ChordNames in the score block above the Staff.

\language "english"

chord_sequence = \chords {
  \set chordChanges = ##t
  c1:m7 f:7 bf:maj7 ef:maj7 
  a:m7.5- d:7.13- g:m6 g:m6 
}

melody = \fixed c {
  \key g \minor
  \clef bass
  \tempo 4 = 108
  c4 c ef g, 
  f, f, a, c 
  bf, bf, d f, 
  ef ef g, bf, 
  a, a, c ef 
  d d fs, a, 
  g, g, bf, d 
  g, g, bf, d 
  g,1
}

\score {
  <<
    \new ChordNames {
      \chord_sequence
    }
    \new Staff {
      \melody
    }
  >>
  \layout {}
}

Upvotes: 6

Related Questions