Hi.
On Sat, 11 Apr 2015 22:07:43 -0700 (MST), Paul Morris wrote:
Gilles Sadowski wrote
It happens when you use bar checks!
The sound is continuous without them but it would be quite annoying
to
encode without their help for spotting mistakes... [I use version
2.18.2.]
In addition, the midi volume and instrument used for the drone must
be
different from that of the main melody (in order not to overwhelm
the
melody lines).
Well, here's where the climb gets steep in trying to make this more
robust.
See below where I added a "music-filter" step that filters out the
bar
checks. This solves the bar check problem, but there will surely be
similar
things that will also need to be filtered out.
It works almost fine: no more stops between bars.
However I sometimes stumbled upon another problem: "dronified" full
measure
rests ("R") generate a bar check warning. It seems wrong because when
I
changed "R" into "r" (and touched nothing else), the warning
disappeared
(but so did the printed rests, of course).
I couldn't yet define a small example as the error comes and goes as I
add
bars to the score! :-{
These can be added just like for bar checks, but it's a tall order to
figure
out which ones to filter out and which to leave in, given the large
number
of "music types" to consider. All the different types are found in
the
LilyPond source code under scm/define-music-types.scm (I glanced
through
them, and even briefly tried it the other way around where you only
leave in
note events, rest events, and... all other seemingly relevant events,
but
this didn't work, as apparently more are relevant than I was leaving
in.)
So that's what it will take to make this robust. Alternatively you
could
just add more types to filter out as new problems come up.
You can uncomment \displayMusic (below) in order to see what's
causing
trouble and needs filtering out.
On setting the midi volume and instrument per voice... something like
what
you originally had should do the trick. Maybe something as shown
below with
separate scores for midi and layout?
Yes, this solution is quite fine.
Thanks,
Gilles
Cheers,
-Paul
%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
dronify =
#(define-music-function (parser location drone melody)
(ly:pitch? ly:music?)
(let* ((melody-filtered
(music-filter
(lambda (m)
(not (or
(music-is-of-type? m 'bar-check)
;; add other types to filter out here, as
needed...
)))
melody))
(prev #{ #})
(current #{ #})
(art '())
(drone-part
(music-map
(lambda (m)
(set! prev current)
(if (and (music-is-of-type? m 'note-event)
(ly:pitch? (ly:music-property m 'pitch)))
;; change the pitch
(begin
(ly:music-set-property! m 'pitch drone)
(if (and (music-is-of-type? prev 'note-event)
(ly:pitch? (ly:music-property prev
'pitch)))
;; add tie to previous note
;; avoid overwriting existing articulations
(begin
(set! art (ly:music-property prev
'articulations
'()))
(ly:music-set-property! prev 'articulations
(append art (list (make-music (quote
TieEvent)))))))))
(set! current m)
prev)
melody-filtered)))
#{ #drone-part #current #}))
melody = \relative f' {
c4 d r e |
f r g a |
b c r e |
f r g a |
b
}
\score {
\new Voice {
\clef G
\melody
}
\layout {}
}
\score {
<<
\new Voice {
\set midiInstrument = "oboe"
\set midiMinimumVolume = #0.6
\set midiMaximumVolume = #0.7
\clef G
% \displayMusic
\melody
}
\new Voice {
\set midiInstrument = "accordion"
\set midiMinimumVolume = #0.2
\set midiMaximumVolume = #0.3
% \displayMusic
\dronify g \melody
}
>>
\midi {}
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user