[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: \time; staccato MIDI output
From: |
Iain Nicol |
Subject: |
RE: \time; staccato MIDI output |
Date: |
Sun, 24 Feb 2008 14:55:01 +0000 |
Hi Trevor,
> Taking the \time's out of the definitions is the best
> approach. As timing is done by default at the score level
> it is not necessary to include \time commands in both parts.
> So I would write it this way (I prefer to explicitly declare
> the Staves):
> [snip]
Thanks. I think I'll use this approach.
> It should be possible to replace a staccato note with one of
> half the value followed by a spacer with the same duration
> using Scheme, but you'd need to fully digest section 6 of
> the Notation Reference first. You would have to unpick the
> input stream, look for staccatos, expand them, and rebuild
> the input stream.
As for staccatos, I twigged that I can use a simpler approach to start
off with. I can change the staccato notes as they're inserted, instead
of doing it afterwards. The key is to define the musical expressions in
functions, so that a different definition of addStaccato is used for
print output versus MIDI output.
Defining addStaccato for print output is easy, as it's almost the
addMarcato example in the docs. I haven't quite got it working for MIDI
output yet, but I almost know what I'm doing :-). It's just modifying
(make-music) expressions of a particular form into a different form...
Then when that works, I can extend it to change staccatos after
they've been inserted.
So just FYI I'm using something like this:
addStaccato = #(define-music-function (parser location event-chord)
(ly:music?)
(
; function which adds a staccato ArticulationEvent, for layout
; output
)
instrumentOne =
#(define-music-function (parser location)
()
#{
\relative
{
{ c'4 c4 c4 } \addStaccato <c d> |
}
#}
)
\score
{
\instrumentOne
\layout {}
}
addStaccato = #(define-music-function (parser location event-chord)
(ly:music?)
(
; function which replaces EventChords with a SequentialMusic of a
; shorter chord followed by a RestEvent. For MIDI output.
)
\score
{
\instrumentOne
\midi {}
}
Regards,
--
Iain Nicol