%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \version "2.19.83"
%{ From http://lilypond.org/doc/v2.19/Documentation/notation/controlling-midi-dynamics.fr.html midiMinimumVolume + (midiMaximumVolume - midiMinimumVolume) * fraction These are the volume coefficients ('fraction' above) applied to each dynamic. %} #(define (my-dynamic-absolute-volume-function dynamic-name) (assoc-get dynamic-name '( ; Adjust these values to get what you would like. ; You can add other dynamics. ; If an dynamic name is not found, the default dynamic values are used. ("ff" . 0.95) ("pp" . 0.3) ) (default-dynamic-absolute-volume dynamic-name))) %{ These are the default equalizations applied to each MIDI instrument. An equalization consists in (min . max) where min is the value to apply for midiMinimumVolume and max for midiMaximumVolume. Keep refering to the formula above! %} #(define (my-instrument-equalizer instrument-name) (assoc-get instrument-name '( ; Adjust these values to get what you would like. ; You can add other instrument names. ; If an instrument name is not found, the default equalizer is used. ("violin" . (0.1 . 0.4)) ("cello" . (0.5 1.0)) ) (default-instrument-equalizer instrument-name))) \midi { \context { \Score instrumentEqualizer = #my-instrument-equalizer dynamicAbsoluteVolumeFunction = #my-dynamic-absolute-volume-function } } violin = \new Voice \relative { c'4\pp d e f g\ff a b c } cello = \new Voice \relative { a,4\pp b c d e\ff f gis a } \score { << \new Staff \with { midiInstrument = "violin" } { \violin } \new Staff \with { midiInstrument = "cello" } { \cello } >> \midi { } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% You can use an instrument equalizer and custom dynamic absolute volume values at the same time. Of course, instrument equalization can be achieved using \set Staff.midiMinimumVolume = min \set Staff.maximumVolume = max … but the power of an instrument equalizer is that you can put it in a separate file and \include it, as you say that you generally want to hear the cello louder and the violin less loud. By the way, I find that the example given on http://lilypond.org/doc/v2.19/Documentation/notation/controlling-midi-dynamics.html#setting-midi-volume <http://lilypond.org/doc/v2.19/Documentation/notation/controlling-midi-dynamics.html#setting-midi-volume> in selected snippets at "Replacing default MIDI instrument equalization" is overly complicated. Why define the alist empty to append to it later? And why not just use assoc-get? It could be easily improved. Best regards, Jean Abou Samra > Le 15 juil. 2019 à 18:26, David Sumbler <da...@aeolia.co.uk> a écrit : > > Hi Jean > > That's great - I certainly now can get a greater range of dynamic than > before. Thank you very much. > > But I find that altering values in 'my-instrument-equalizer-alist' has no > effect at all. How can I adjust the relative volumes of 2 different > instruments - say, 'violin' and 'cello'. (I find that in the fluidr3_gm sound > font, the cello is far quieter than the other stringed instruments.) > > David > > > On Mon, 2019-07-15 at 17:41 +0200, Jean ABOU SAMRA wrote: >> 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 >>> <mailto: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 <mailto: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
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user