8

I've written a lovely[citation needed] piece of piano music using Denemo (a graphical front-end to Lilypond), consisting of a piano staff with a staff for dynamics inserted in between them.

The dynamics appear in the PDF output, but do not appear in the MIDI output. If I apply the dynamics separately to each piano staff, the dynamics appear in the MIDI output but are doubled in the PDF output.

I would like to keep the dynamics appearing once in the PDF output (using the staff for dynamics) but still get a reasonably representative MIDI output. How can I accomplish this?

1 Answer 1

7

I make separate score-blocks for the PDF and the MIDI. Something like the following. Note that, for the PDF, the dynamics in \pianoCentredDynamics are separate from the Staffs containing the notes in \rhMusic and \lhMusic. By contrast, for the MIDI for the RH, the dynamics and \rhMusic are put in parallel and all assigned to the Staff -- and similarly for the LH.

\version "2.18.2"
\include "english.ly"

\header {
} % header

\paper
{
    #(set-paper-size "a4")
}

global =
{
    \key bf \major
    \tempo 4=96
    \time 3/4
}

rhMusic =
{
    d'2. ef'4 f'g'a'bf'c''d''2.
}

pianoCentredDynamics =
{
    s2.\pp s\< s s\ff
}

lhMusic =
{
    \clef bass
    bf,2. c4 d ef f g a bf2.
}

pedalling =
{
}

% Score-block for the layout
\score
{
    \new GrandStaff 
    <<
        \new Staff = "rh" << \global \rhMusic >>
        \new Dynamics = "dynamics" \pianoCentredDynamics
        \new Staff = "lh" << \global \lhMusic >>
        \new Dynamics = "pedal" \pedalling
    >>
    \layout
    {
    }
}

% Score-block for the MIDI
\score
{
    \unfoldRepeats %\articulate
        \new PianoStaff
        <<
            % See http://lilypond.1069038.n5.nabble.com/Sustain-in-midi-output-of-Piano-Centered-Dynamics-Template-td31012.html
            \new Dynamics = "dynamics" \pianoCentredDynamics
            \new Dynamics = "pedal" \pedalling
            \new Staff = "rh" << \global \rhMusic \pianoCentredDynamics \pedalling >>
            \new Staff = "lh" << \global \lhMusic \pianoCentredDynamics \pedalling >>
        >>

    \midi
    {
        % See http://lilypond.1069038.n5.nabble.com/Sustain-in-midi-output-of-Piano-Centered-Dynamics-Template-td31012.html
        \context { 
            \type "Performer_group" 
            \name Dynamics 
            \consists "Piano_pedal_performer" 
        } 
        \context { 
            \PianoStaff 
            \accepts Dynamics 
        } 

        \context
        {
            \Staff
            \consists "Dynamic_performer"
        }
    }
} % score for MIDI

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.