lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheme function for ossia


From: Jonathan Wilkes
Subject: Re: Scheme function for ossia
Date: Mon, 24 Aug 2009 10:20:45 -0700 (PDT)


--- On Mon, 8/24/09, Trevor Daniels <address@hidden> wrote:

> From: Trevor Daniels <address@hidden>
> Subject: Re: Scheme function for ossia
> To: "Jonathan Wilkes" <address@hidden>, address@hidden
> Date: Monday, August 24, 2009, 10:42 AM
> 
> Jonathan Wilkes wrote Monday, August 24, 2009 6:24 AM
> 
> 
> > Would probably help if I showed the file :).  I'm
> guessing the problem
> > is it's not allowed to use a variable inside of the
> braces after the \with
> > command, but I don't understand why.
> 
> Correct.  A \with clause may contain only
> 
> a) property operations
> 
> That's changing context or grob properties
> 
> b) context definitions
> 
> That's things like \consists, \accepts etc.
> 
> This was one of my questions as a newbie
> three years ago next week!  The answer came
> from Nicolaus Sceaux, see
> http://lists.gnu.org/archive/html/lilypond-user/2006-08/msg00560.html

Happy Anniversary!  I neglected to use the search term "function" so 
I missed this.

> 
> A music function has to return some music,
> so you need to pass the ossia music to the
> music function too, and include the \new Staff
> as well, like this:
> 
> ossia = #(define-music-function (parser location staffName
> music)
>  (string? ly:music?)
> #{
>  \new Staff \with {
>    alignAboveContext = #$staffName
>    \remove "Time_signature_engraver"
>    fontSize = #-3
>    \override StaffSymbol #'staff-space =
> #(magstep -3)
>    \override StaffSymbol #'thickness =
> #(magstep -3)
>  }
>  $music
> #})
> 
> Trevor
> 

That seems like an even shorter shortcut than what I was aiming for, 
thanks!

One thing I don't understand is why the example in the scheme tutorial 
(tempoPadded under "Tweaking with Scheme") doesn't seem to return 
any music, but uses define-music-function.

-Jonathan

> > -Jonathan
> > 
> > \version "2.12.2"
> > 
> > ossia = #(define-music-function (parser location
> staffName)
> >  (string?)
> > #{
> > alignAboveContext = #$staffName
> > \remove "Time_signature_engraver"
> > fontSize = #-3
> > \override StaffSymbol #'staff-space = #(magstep -3)
> > \override StaffSymbol #'thickness = #(magstep -3)
> > #})
> > 
> > myMelody = \new Staff = main {
> > \relative c' {
> > c8 d e f g a b c |
> > <<
> > {
> > d1
> > }
> > {
> > \new Staff \with { \ossia #'main } {
> > \relative c' {
> > \clef bass
> > c4 d e f
> > }
> > }
> > }
> > >>
> > }
> > }
> > 
> > \score {
> > \myMelody
> > \layout {
> >  }
> > }
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > lilypond-user mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/lilypond-user
> > 
> 
> 







reply via email to

[Prev in Thread] Current Thread [Next in Thread]