Dear Harm,

I made many test, and... it works really well! Thanks a lot for your kind
help!

g.

On Wed, Apr 27, 2016 at 1:12 PM, Thomas Morley <[email protected]>
wrote:

> 2016-04-27 10:56 GMT+02:00 Gianmaria Lari <[email protected]>:
> > I don't know if the following code is well written (suggestions are
> pretty
> > welcome!!) but it works as I like (:)) and let me generate two different
> > output according the tag midiOut or screenOut.
> >
> > \version "2.19.40"
> >
> > mynote = c
> >
> > mynoteExp = {\mynote}
> > mynoteDouble = {<\mynote' \mynote>}
> >
> > cC = {\tag #'midiOut \mynoteDouble
> >       \tag #'screenOut \mynoteExp }
> >
> > music =
> > {
> >   \time 3/4 \clef bass
> >   \cC
> > }
> >
> > \score
> > {
> >   \keepWithTag #'screenOut \music
> >   \layout {}
> > }
> >
> > \score
> > {
> >   \keepWithTag #'midiOut \music
> >   \layout {}
> >   \midi {}
> > }
> >
> >
> > In the attached capture.png you can see the two different output, the
> first
> > when using screenOut and the second using midiOut.
> >
> > * * *
> >
> > Now I would like to be able to increase the lenght of the musical
> expression
> > contained in the cC variable.
> >
> > In the previous example the cC variable contains a quarter note (and a
> > quarter bichord) and I would like to change it to an half note. I tried
> with
> > the "changePitch.ly" snippet
> > (
> http://gillesth.free.fr/Lilypond/changePitch/changePitchDoc-sources/changePitch-doc.pdf
> )
> > writing
> >
> > \changePitch {a2} \cC
> >
> > but this does not work.
> >
> > Here it is the whole code (I highlighted the differences compared to the
> > previous example)
> >
> > \version "2.19.40"
> > \include "changePitch.ly"
> >
> > mynote = c
> >
> > mynoteExp = {\mynote}
> > mynoteDouble = {<\mynote' \mynote>}
> >
> > cC = {\tag #'midiOut \mynoteDouble
> >       \tag #'screenOut \mynoteExp }
> >
> > music =
> > {
> >   \time 3/4 \clef bass
> >   \changePitch {a2} \cC
> > }
> >
> > \score
> > {
> >   \keepWithTag #'screenOut \music
> >   \layout {}
> > }
> >
> > \score
> > {
> >   \keepWithTag #'midiOut \music
> >   \layout {}
> >   \midi {}
> > }
> >
> >
> > and in the attached file capture2 you can find the output for this second
> > scenario.
> >
> > Consider that:
> > - the variable cC will always contain a single note or a single chord
> > - I tried using changepitch but any other (possibly simpler) way is
> welcome
> >
> > Any suggestion?
> > Thank you, g.
>
>
>
> Probably:
>
> \version "2.19.40"
>
> %% nb: this is a pitch:
> mynote = c
>
> %% this is sequential music, with a NoteEvent in 'elements:
> mynoteExp = { \mynote }
>
> %% this is sequential music, with an EventChord in 'elements:
> mynoteDouble = { <\mynote' \mynote> }
>
> setNotesDur =
> #(define-music-function (mus dur)(ly:music? ly:duration?)
> "Set the duration of all 'NoteEvents in `mus' to `dur'"
>   (for-each
>     (lambda (m)
>       (ly:music-set-property! m 'duration dur))
>     (extract-named-music mus 'NoteEvent))
>   mus)
>
> cC = {\tag #'midiOut { \setNotesDur \mynoteDouble 32 }
>       \tag #'screenOut \mynoteExp }
>
> music =
> {
>   \time 3/4 \clef bass
>   \cC
> }
>
> \score
> {
>   \keepWithTag #'screenOut \music
>   \layout {}
> }
>
> \score
> {
>   \keepWithTag #'midiOut \music
>   \layout {}
>   \midi {}
> }
>
> Cheers,
>   Harm
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to