lilypond-user
[Top][All Lists]
Advanced

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

Re: custom dynamics with midi output


From: Thomas Morley
Subject: Re: custom dynamics with midi output
Date: Sat, 8 Jun 2019 18:53:05 +0200

Am Sa., 8. Juni 2019 um 18:03 Uhr schrieb Karim Haddad <address@hidden>:
>
> Dear All,
>
> In the following documentation's snippet :
>
>   doctitle = "Creating custom dynamics in MIDI output"
> } % begin verbatim
>
> #(define (myDynamics dynamic)
>     (if (equal? dynamic "rfz")
>       0.9
>       (default-dynamic-absolute-volume dynamic)))
>
> \score {
>   \new Staff {
>     \set Staff.midiInstrument = #"cello"
>     \set Score.dynamicAbsoluteVolumeFunction = #myDynamics
>     \new Voice {
>       \relative {
>         a'4\pp b c-\rfz
>       }
>     }
>   }
>   \layout {}
>   \midi {}
> }
>
> all works well. But if we need some more dynamic customization like :
>
> psub = \markup {\center-column { \dynamic p } \lower #0.5 \normal-text { 
> \tiny \italic sub.}}
> dpsub=#(make-dynamic-script psub)
>
> #(define (myDynamics dynamic)
>     (if (equal? dynamic "dpsub")

It does not work, because this check will never be true. You compare a
simple string, "dpsub", with some `dynamic┬┤
You need to compare `dynamic┬┤ with the content of dpsub, i.e. psub.
Below works here:


psub =
\markup {\center-column { \dynamic p } \lower #0.5 \normal-text {
\tiny \italic sub.}}
dpsub= #(make-dynamic-script psub)

#(define (myDynamics dynamic)
;; some debugging output
  (display-scheme-music
    ;dynamic
    (equal? dynamic psub)
    )
    (if (equal? dynamic psub)
      0.2
      (default-dynamic-absolute-volume dynamic)))

\score {
  \new Staff {
    \set Staff.midiInstrument = #"cello"
    \set Score.dynamicAbsoluteVolumeFunction = #myDynamics
    \new Voice {
      \relative { a'4\pp b c-\dpsub
      }
    }
  }
  \layout {}
  \midi {}
}

Cheers,
  Harm

>       0.2
>       (default-dynamic-absolute-volume dynamic)))
>
>
> this doesn't work. Maybe should we use another scheme function in this case.
> Any ideas ?
>
>
> thank you and best to you all.
>
> --
> Karim Haddad
>
>
> webpage : http://karim.haddad.free.fr
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user



reply via email to

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