[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mass skip
From: |
Han-Wen Nienhuys |
Subject: |
mass skip |
Date: |
Fri, 29 Nov 2002 00:15:56 +0100 |
address@hidden writes:
> Hi,
>
> Is there a way of mass converting all the notes of a voice (or staff) to
> skips? I.e. a way to make
>
> fis4_\p g8 g8_\f e16\_mf
> work like
> s4_\p s8 s8_\f s16\_mf
> (I want to copy the scripts of one staff into all the other staves, so I just
> want to extract those scripts from the staff, which this would achieve).
>
> One solution could of course be sed, but I was thinking that there might be
> some easy solution by removing engravers or something.
I added the following to CVS (1.7).
\header {
texidoc =
"With @code{music-map}, you can apply functions operating on a single
piece of music to an entire music expression. In this example, the
scripts and dynamics of the first measure of music are applied to the
2nd measure. "
}
\version "1.7.8"
#(define (notes-to-skip m)
"Convert all stuff with duration (notes, lyrics, bass figures, etc.) to skips.
Scripts and dynamics are maintained.
"
(if (memq 'rhythmic-event (ly:get-mus-property m 'types))
(let* ((newmus (make-music-by-name 'SkipEvent)))
(map
(lambda (x) (ly:set-mus-property! newmus (car x) (cdr x)))
(ly:get-mutable-properties m))
newmus
)
m)
)
foobar = \notes \transpose c c' { c4-\>-^ c4-^ c4-\!-^ c4-^ }
\score {
\notes \relative c'' \context Voice {
\foobar
< \apply #(lambda (x) (music-map x notes-to-skip))
\foobar
{ d2 d2 } >
}}
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen