lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

\time; staccato MIDI output


From: Iain Nicol
Subject: \time; staccato MIDI output
Date: Sat, 23 Feb 2008 18:54:49 +0000

Hi,

I'm new to LilyPond, and I'm trying to engrave a piece I composed a
while back. I've run into a couple of difficulties. Help would be
greatly appreciated. N.B.: This is a bit long; sorry.

1. Time signatures
==================
Consecutive "\time"s show up, even if they are both the same time
signature. e.g. the following shows 3/4 in both bars:
        \version "2.11.40"

        \score
        {
                { \time 3/4 c1 | \time 3/4 c1 | }
        }

I would like to disable the second one from showing up, because I would
like to be able to do something like:
        \version "2.11.40"

        sectionOne = \relative c' { \time 4/4 c1 | }
        sectionTwoA = \relative c' { \time 3/4 c4 e4 f4 | }
        sectionTwoB = \relative c' { a4 a4 d4 | }

        instrumentOne = \new Voice { \sectionOne \sectionTwoA \sectionTwoB}
        instrumentTwo = \new Voice { \sectionOne R4*3 {\transpose c f
\sectionTwoA} }

        \score
        {
                \new StaffGroup
                <<
                        \instrumentOne
                        \instrumentTwo
                >>
                \layout {}
                \midi {}
        }
That is, have imitative voices, a bit like a fugue. The problem above is
that the 3/4 time change shows up twice.
    I could move the "\time" outside of sectionTwoA's definition. The
disadvantage to this is that I can't use bar checking, and I would have
to insert "\time 3/4" manually in front of every  use of sectionTwoA.
However, I'm beginning to think it's the best solution...

I did try to create a function which would only insert a time signature
if it was different than the current one.
    I'm able to query the current "measure length":
        \applyContext #(lambda (c)
                (format #t "\nMeasure length: ~a.\n" (ly:context-property c
'measureLength)))

And I know the new time signature can by set in Lilypond using \time, or
Scheme using (set-time-signature). The trouble I'm running into is that
set-time-signature only works outside of an \applyContext.
    So I need to query the measure length inside of an \applyContext,
and save it to a variable I can access to compare to outside of the
\applyContext. I don't know how to do that though, with the scoping of
variables.
    Is that possible? Or is this completely the wrong approach? Also: it
is possible to create music functions that take fractions as input (e.g.
3/4, instead of having to input #3 #4 as two separate integers).

2. staccato MIDI output
=======================
The following two lines produce the identical MIDI output, although the
first has a staccato:
        \version "2.11.40" \score { { g4-. } \layout{} \midi{} }
and
        \version "2.11.40" \score { { g4 } \layout{} \midi{} }

I'd like the staccato note to sound shorter: say, half the length. I was
hoping LilyPond would do this for me, but it doesn't ;).

As a workaround, I was thinking about creating a music (scheme) function
possibly called unwindStaccato. This would be applied to expressions,
and replace staccato notes (or chords) by notes of half the length,
followed by a rest. Then I could output the MIDI using:
         \score { \unwindStaccato \tune  \midi {} }
and *not* apply unwindStaccato when using layout{}.
    I'm certain this approach is possible, as there's something similar
in the manual (7.3.4 Adding articulation to notes (example)).
    Still, it doesn't seem particularly easy, so I was wondering if
anybody knows of a better solution.


Thanks for your input,
-- 
Iain Nicol





reply via email to

[Prev in Thread] Current Thread [Next in Thread]