Hi David,

Your problem is not with the instrument, it's with the dynamics themselves.
The algorithm that affects a volume to a note does a scale between 
midiMinimumVolume and midiMaximumVolume that includes all dynamics. 
Mathematically, you can think:
volume = midiMinimumVolume + (midiMaximumVolume - midiMinimumVolume)*dynamic

Let me try a diagram:

0                       |        pppp   ppp   pp  p  mp  mf f ff fff   ffff  
fffff sf  |                         1
no sound                midiMinimumVolume                                       
       midiMaximumVolume         maximum volume possible


Here you set midiMinimumVolume to 0 or almost and midiMaximumVolume to 1, so if 
there is not enough difference for you, you need to influence the scale between 
the two in addition to minimum and maximum volume.

Taking a look at 
http://lilypond.org/doc/v2.19/Documentation/internals/dynamic_005fperformer 
<http://lilypond.org/doc/v2.19/Documentation/internals/dynamic_005fperformer>
suggests to set the dynamicAbsoluteVolumeFunction property. You will find its 
default in scm/midi.scm:

;; define factor of total volume per dynamic marking
(define-session-public absolute-volume-alist '())
(set! absolute-volume-alist
      (append
       '(
         ("sf" . 1.00)
         ("fffff" . 0.95)
         ("ffff" . 0.92)
         ("fff" . 0.85)
         ("ff" . 0.80)
         ("f" . 0.75)
         ("mf" . 0.68)
         ("mp" . 0.61)
         ("p" . 0.55)
         ("pp" . 0.49)
         ("ppp" . 0.42)
         ("pppp" . 0.34)
         ("ppppp" . 0.25)
         )
       absolute-volume-alist))

(define-public (default-dynamic-absolute-volume s)
  (assoc-get s absolute-volume-alist))

so now you can modify it, for example:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.83"

#(define (my-dynamic-absolute-volume-function dynamic-name)
 (assoc-get dynamic-name
  '(
     ("sf" . 1.00)
     ("fffff" . 0.95)
     ("ffff" . 0.92)
     ("fff" . 0.85)
     ("ff" . 0.95) ;; was 0.80
     ("f" . 0.75)
     ("mf" . 0.68)
     ("mp" . 0.61)
     ("p" . 0.55)
     ("pp" . 0.10) ;; was 0.49
     ("ppp" . 0.42)
     ("pppp" . 0.34)
     ("ppppp" . 0.25)
   )))

\score {
 \new Staff \with { midiInstrument = "trumpet" } {
   \set Score.midiMinimumVolume = 0.0
   \set Score.midiMaximumVolume = 1.0
   \set Score.dynamicAbsoluteVolumeFunction = 
#my-dynamic-absolute-volume-function
   a'8\pp b' cis'' d'' e''-.\ff d''-. cis''-. b'-. a'
 }
 \midi { }
\layout { }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

You understand that default 'piano' is not so piano because we have to go to 
ppppp.

By adjusting the values in that associative list, you can play with dynamics 
and get the exact contrast you would like.

Hope that helps.
Kind regards,
Jean Abou Samra.

> Le 15 juil. 2019 à 16:16, David Sumbler <da...@aeolia.co.uk> a écrit :
> 
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \version "2.19.82"
> 
> #(define my-instrument-equalizer-alist '())
> 
> #(set! my-instrument-equalizer-alist
>  (append
>   '(
>     ("trumpet" . (0.01 . 0.99)))
>   my-instrument-equalizer-alist))
> 
> #(define (my-instrument-equalizer s)
>  (let ((entry (assoc s my-instrument-equalizer-alist)))
>    (if entry
>      (cdr entry))))
> 
> \score {
>  \new Staff \with { midiInstrument = "trumpet" } {
> %    \set Score.midiMaximumVolume = #1
> %    \set Score.midiMinimumVolume = #0
>    \set Score.instrumentEqualizer = #my-instrument-equalizer
>    a'8\pp b' cis'' d'' e''-.\ff d''-. cis''-. b'-. a'
>  }
>  \midi { }
> }
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> 
> Can somebody explain how I can control the absolute minimum and maximum
> values of individual instruments in midi?
> 
> In the above snippet, I expect to find the first bar almost inaudible
> and the second bar extremely loud.  However, I find that the difference
> between the pp section and the ff is quite limited.  If I reduce the
> supposed maximum volume of the trumpet to, say, 0.5, then the pp will
> indeed be very quiet, but when I restore the second parameter to 0.99
> as here, then the pp passage is much louder than previously.
> 
> If I uncomment the Score.midiMaximumVolume line and the following one,
> it makes little difference.  The Internals Reference states that valid
> values for these 2 parameters are numbers between 0 and 1.  However, if
> I set midiMaximumVolume to 2, I find that the pp and the ff sections
> have the same volume as each other.  Further increases in
> midiMaximumVolume do not seem to make any difference.
> 
> In every case, the total dynamic range is considerably less than I
> would like.  How can I extend the dynamic range beyond the limited
> range I can currently get?
> 
> David
> 
> 
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to