lilypond-user
[Top][All Lists]
Advanced

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

Re: Separate dynamics from notes


From: Leo Correia de Verdier
Subject: Re: Separate dynamics from notes
Date: Tue, 2 May 2023 13:42:24 +0200

If not too late, here is an example, based on Jeans code in 
https://lists.gnu.org/archive/html/lilypond-user/2021-09/msg00209.html

%%%%%%%%%%%%%%%%%%
convertToSkips =
#(define-music-function (music) (ly:music?)
   (music-map
     (lambda (m)
       (if (or (music-is-of-type? m 'rest-event) 
               (music-is-of-type? m 'note-event))
           (make-music 'SkipEvent m)
           m))
     music))

\convertToSkips { r2\p <e' d'> c'4( d)\ff s4 r4 }

%%%%%%%%%%%%%%%%%%

Take care with things that ar still interpreted, like Scripts.

> 26 apr. 2023 kl. 22:55 skrev Leo Correia de Verdier 
> <leo.correia.de.verdier@gmail.com>:
> 
> You can do like this if it’s useful to you, removing the engravers that read 
> what you don’t want at a specific place.
> %%%%%%%%%%%%%%%%%%
> \version "2.25.1"
> 
> rh = \fixed c' {c4\pp d\p e\f f\ff}
> 
> \score {
>  << 
>    \new Voice \with {
>    \remove Dynamic_engraver }
>  \rh
>  \new Dynamics %Dynamics context doesn’t have the Note_Heads_Engraver anyway
>  \rh
>>> 
> }
> %%%%%%%%%%%%%%%%%%
> 
> Otherwise it is possible to create music functions that replace notes and 
> rests with spacers or remove dynamics, but I can’t do that for you at the 
> moment. While they’re not difficult functions they’re not ”built-in”.
> 
> The second question is also probably not too hard to write a function for, 
> but you’ll probably need to be a little more specific about the use case, 
> perhaps also supply example code.
> 
> Best wishes
> /Leo
>> 26 apr. 2023 kl. 22:23 skrev Gianmaria Lari <gianmarialari@gmail.com>:
>> 
>> First question
>> Suppose I wrote this score:
>> 
>> \version "2.25.2"
>> rh = \fixed c' {c4\pp d\p e\f f\ff}
>> 
>> \score {
>>  \new Staff \rh
>> }
>> 
>> Is there any "automatic" way to extract the dynamics in the score (maybe 
>> assigning it to a variable)? 
>> At the end I would like to easily transform the previous code in the 
>> following one:
>> 
>> \version "2.25.2"
>> rh = \fixed c' {c4 d e f}
>> dy = {s4\pp s4\p s4\f s4\ff}
>> \score {
>>  <<
>>    \new Staff \rh
>>    \new Dynamics \dy
>>>> 
>> }
>> 
>> Second question
>> Sometimes I copy a long score without the dynamic and add them separately 
>> later. For this operation I need to establish the dynamic location in the 
>> score counting and adding the notes length. This is tedious and error prone. 
>> Is there any way to make it?
>> 
>> Thanks,
>> Gianmaria
> 




reply via email to

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