[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Function to add a drone staff?
From: |
Paul Morris |
Subject: |
Re: Function to add a drone staff? |
Date: |
Sun, 12 Apr 2015 07:29:35 -0700 (MST) |
Paul Morris wrote
> 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.
On second thought, forget the music-filter version and the ones before that.
The one below has the better approach, more robust.
Cheers,
-Paul
%%%%%%%%%%%%%%%%
\version "2.18.2"
dronify =
#(define-music-function (parser location drone-pitch melody)
(ly:pitch? ly:music?)
(let ((art '())
(prev-note-or-rest #{ #}))
(music-map
(lambda (m)
(if (and (music-is-of-type? m 'note-event)
(ly:pitch? (ly:music-property m 'pitch)))
;; ...but do note events ever not have a pitch?
;; ...but are there any other kinds of events to dronify?
(begin
(ly:music-set-property! m 'pitch drone-pitch)
(if (music-is-of-type? prev-note-or-rest 'note-event)
;; add tie to previous note, don't overwrite existing
articulations
(begin
(set! art (ly:music-property prev-note-or-rest
'articulations '()))
(ly:music-set-property! prev-note-or-rest 'articulations
(append art (list (make-music 'TieEvent))))))))
(if (or (music-is-of-type? m 'note-event)
(music-is-of-type? m 'rest-event))
;; ...but should there be more types of events here?
(set! prev-note-or-rest m))
m)
melody)))
melody = \relative f' {
c4 d r e |
\grace c
f r g a |
b c r e |
f r g a |
b
}
\score {
<<
\melody
\dronify g \melody
>>
\layout {}
\midi {}
}
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Function-to-add-a-drone-staff-tp174261p174420.html
Sent from the User mailing list archive at Nabble.com.
- Re: Function to add a drone staff?, (continued)
- Re: Function to add a drone staff?, Sven Axelsson, 2015/04/09
- Re: Function to add a drone staff?, Paul Morris, 2015/04/09
- Re: Function to add a drone staff?, Gilles, 2015/04/09
- Re: Function to add a drone staff?, Paul Morris, 2015/04/09
- Re: Function to add a drone staff?, Gilles, 2015/04/10
- Re: Function to add a drone staff?, Paul Morris, 2015/04/11
- Re: Function to add a drone staff?, Gilles, 2015/04/11
- Re: Function to add a drone staff?, Simon Albrecht, 2015/04/11
- Re: Function to add a drone staff?, Paul Morris, 2015/04/12
- Re: Function to add a drone staff?, Paul Morris, 2015/04/12
- Re: Function to add a drone staff?,
Paul Morris <=
- Re: Function to add a drone staff?, Gilles, 2015/04/13
- Re: Function to add a drone staff?, Paul Morris, 2015/04/14
- Re: Function to add a drone staff?, Gilles, 2015/04/14
- Re: Function to add a drone staff?, Paul Morris, 2015/04/27
- Message not available
- Fwd: Function to add a drone staff?, Sven Axelsson, 2015/04/10
- Re: Function to add a drone staff?, Gilles, 2015/04/10