[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: midi volume single note
From: |
David Kastrup |
Subject: |
Re: midi volume single note |
Date: |
Tue, 14 Nov 2017 11:30:08 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Gianmaria Lari <address@hidden> writes:
> On 13 November 2017 at 13:31, Caagr98 <address@hidden> wrote:
>
>> I was thinking of something like this:
>>
>> <<
>> { c'1 }
>> { s8 \set Voice.midiExpression=#0.5 s2.. Voice.midiExpression=#1 }
>> >> c'1
>>
>> That is, simultaneously: a) play a note, b) wait a short while, reduce
>> volume, wait until rest of the note is finished (2.. is 7/8 of a measure),
>> then reset to normal.
>>
>
> Thank you, perfect!!!!
>
> In case other people need it, here it is a complete example where c1 note
> is played reducing volume from maximum to minimum in step of 1/32.
>
> \version "2.19.80"
> right = \fixed c'' { c1 }
>
> dynamics = {
> s32 \set Voice.midiExpression=#1
> s32 \set Voice.midiExpression=#0.96774
> s32 \set Voice.midiExpression=#0.93548
> s32 \set Voice.midiExpression=#0.90323
[...]
> }
>
> \score {
> \new Staff \with { midiInstrument = "accordion"}
> \new Voice <<\right \dynamics>>
> \midi {}
> \layout {}
> }
Well, that calls for something programmatic I think.
\version "2.19.80"
right = \fixed c'' { c1 }
withExpr =
#(define-music-function (steps start end music)
(index? number? number? ly:music?)
(let ((len (ly:make-duration 0 0
(/ (ly:moment-main (ly:music-length music))
(1+ steps)))))
#{ \context Bottom
<< #music
{ #@(append
(map
(lambda (v)
#{ \set midiExpression = #v \skip #len #})
(iota steps start (/ (- end start) (1+ steps))))
(list #{ \set midiExpression = #end #})) }
>>
#}))
\score {
\new Staff \with { midiInstrument = "accordion"}
\displayLilyMusic \new Voice { \withExpr 32 1 0 \right }
\midi {}
\layout {}
}
--
David Kastrup
- Re: midi volume single note, (continued)
- Re: midi volume single note, bb, 2017/11/13
- Re: midi volume single note, Gianmaria Lari, 2017/11/13
- Re: midi volume single note, Caagr98, 2017/11/13
- Re: midi volume single note, Gianmaria Lari, 2017/11/13
- Re: midi volume single note, Caagr98, 2017/11/13
- Fw: midi volume single note, address@hidden, 2017/11/13
- Re: Fw: midi volume single note, David Kastrup, 2017/11/13
- Re: Fw: midi volume single note, Richard Shann, 2017/11/13
- Re: Fw: midi volume single note, Martin Tarenskeen, 2017/11/13
- Re: midi volume single note, Gianmaria Lari, 2017/11/14
- Re: midi volume single note,
David Kastrup <=
- Re: midi volume single note, Gianmaria Lari, 2017/11/14
- Re: midi volume single note, Caagr98, 2017/11/14