[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: different pitches with the same rhythm
From: |
Stefan Thomas |
Subject: |
Re: different pitches with the same rhythm |
Date: |
Mon, 10 Dec 2007 23:36:31 +0100 |
Dear Rune,
thanks very much for Your efforts, trying to explain me the function
of the program.
I tried it with a short example, but it did'nt work.
I wanted an outpout like:
\relative c {c4 c8 d e4 d d d8 e f4 e } and so on.
Can You help me finding the mistake in the below quoted file?
defineTransform =
#(define-music-function (parser location name pattern)
(symbol? ly:music?)
(letrec ((trans-rec
(lambda (pitches)
(lambda (music)
(let* ((es (ly:music-property music 'elements))
(e (ly:music-property music 'element))
(p (ly:music-property music 'pitch)))
(if (pair? es)
(ly:music-set-property!
music 'elements
(map (trans-rec pitches) es)))
(if (ly:music? e)
(ly:music-set-property!
music 'element
((trans-rec pitches) e)))
(if (ly:pitch? p)
(let* ((o (ly:pitch-octave p))
(n (ly:pitch-notename p))
(i (+ (* 7 o) n))
(pes (ly:music-property (list-ref pitches i) 'elements))
(pnew (ly:music-property (car pes) 'pitch))
)
(ly:music-set-property! music 'pitch pnew)
))
music)))))
(primitive-eval
`(define ,name
(define-music-function (parserb locationb pitchseq)
(ly:music?)
(let* ((pitches (ly:music-property pitchseq 'elements))
(n (ly:music-property pitchseq 'name)))
(if (not (equal? n 'SequentialMusic))
(ly:warning "2nd arg of transform must be SequentialMusic, got ~a"
n)
((,trans-rec pitches) (ly:music-deep-copy ,pattern)))))))
(make-music 'SequentialMusic 'void #t)))
\define transform #'myTransformation { c'4 c'8 d'8 e'4 d'4 }
\score {
\myTransformation { c' d' e' } \myTransformation { d' e' f' }
}
Rune Zedeler schrieb am 10.12.2007:
----------<snip>-----------
defineTransform =
#(define-music-function (parser location name pattern)
(symbol? ly:music?)
(letrec ((trans-rec
(lambda (pitches)
(lambda (music)
(let* ((es (ly:music-property music 'elements))
(e (ly:music-property music 'element))
(p (ly:music-property music 'pitch)))
(if (pair? es)
(ly:music-set-property!
music 'elements
(map (trans-rec pitches) es)))
(if (ly:music? e)
(ly:music-set-property!
music 'element
((trans-rec pitches) e)))
(if (ly:pitch? p)
(let* ((o (ly:pitch-octave p))
(n (ly:pitch-notename p))
(i (+ (* 7 o) n))
(pes (ly:music-property (list-ref pitches i) 'elements))
(pnew (ly:music-property (car pes) 'pitch))
)
(ly:music-set-property! music 'pitch pnew)
))
music)))))
(primitive-eval
`(define ,name
(define-music-function (parserb locationb pitchseq)
(ly:music?)
(let* ((pitches (ly:music-property pitchseq 'elements))
(n (ly:music-property pitchseq 'name)))
(if (not (equal? n 'SequentialMusic))
(ly:warning "2nd arg of transform must be SequentialMusic, got ~a"
n)
((,trans-rec pitches) (ly:music-deep-copy ,pattern)))))))
(make-music 'SequentialMusic 'void #t)))
----------<snip>-----------
Stefan Thomas
Siebengebirgsallee 9
50939 Koeln
Tel.Fax:0049(0)221/412529
mail: address@hidden
Re: different pitches with the same rhythm, Stefan Thomas, 2007/12/09
- Re: different pitches with the same rhythm, Rune Zedeler, 2007/12/10
- Re: different pitches with the same rhythm,
Stefan Thomas <=
- Re: different pitches with the same rhythm, Rune Zedeler, 2007/12/10
- Re: different pitches with the same rhythm, Stefan Thomas, 2007/12/11
- Re: different pitches with the same rhythm, Rune Zedeler, 2007/12/11
- Re: different pitches with the same rhythm, Stefan Thomas, 2007/12/11
- Re: different pitches with the same rhythm, Valentin Villenave, 2007/12/11
- Re: different pitches with the same rhythm, Stefan Thomas, 2007/12/11