Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > ffe16b32b9f5eec0add70c0a6bc8cec8 > files > 11738

lilypond-doc-2.12.2-3mdv2009.1.i586.rpm

%% Generated by lilypond-book.py
%% Options: [alt=[image of music],printfilename,indent=0\mm,texidoc,line-width=160\mm]
\include "lilypond-book-preamble.ly"


% ****************************************************************
% Start cut-&-pastable-section
% ****************************************************************



\paper {
  #(define dump-extents #t)
  
  indent = 0\mm
  line-width = 160\mm
  force-assignment = #""
  line-width = #(- line-width (* mm  3.000000))
}

\layout {
  
}



% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "/home/lilydev/vc/gub/target/linux-x86/src/lilypond-localhost--home-lilydev-vc-lilypond-master/input/regression/music-map.ly"
\sourcefileline 0
\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 the function @code{notes-to-skip} changes a note to a skip. When
applied to an entire music expression in the 1st measure, the scripts
and dynamics are left over. These are put onto the 2nd measure."

}

\version "2.12.0"

#(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:music-property m 'types))
   (let* ((newmus (make-music 'SkipEvent)))
    (map
     (lambda (x) (ly:music-set-property! newmus (car x) (cdr x)))
     (ly:music-mutable-properties m))
    newmus
  )
   m)
)


\layout { ragged-right= ##t }

foobar =  \transpose c c' { c4\>-^ c4-^ c4\!-^ c4-^  } 


\relative c''  \context Voice {
  \foobar

  << \applyMusic #(lambda (x) (music-map notes-to-skip x))
     \foobar
     { d8 d d d d d d d  } >> 
}



% ****************************************************************
% end ly snippet
% ****************************************************************