Re: strip dynamics for Piano music

2014-01-02 Thread Valentin Villenave
On Fri, Dec 6, 2013 at 2:40 PM, Noeck noeck.marb...@gmx.de wrote:
 is it possible somehow, to split contents of a music expression into
 two? I am asking for a piano staff which I would enter as follows:
 upper = { a4\f g f e\p }
 lower = { a,1 }

Greetings,
sorry for answering so late but this message had been caught in my spam filter!

What you’re describing is actually exactly what I do in my own scores:
http://git.savannah.gnu.org/cgit/opus-libre.git/tree/lib/libdynamics.scm#n22

#(define (dynamic? x)
  (let ((name (ly:music-property x 'name)))
(or
 (eq? name 'DynamicEvent)
 (eq? name 'AbsoluteDynamicEvent)
 (eq? name 'CrescendoEvent)
 (eq? name 'DecrescendoEvent)
 (eq? name 'SpanDynamicEvent

#(define removeDynamics
;; Remove untagged dynamics.
  (define-music-function (parser location music) (ly:music?)
(if (ly:get-option 'no-auto-piano-dynamics)
music
(music-filter
 (lambda (x)
   (let ((tags (ly:music-property x 'tags))
 (dir (ly:music-property x 'direction)))
 (not (and
   (dynamic? x)
   (not (memq 'staff-dynamics tags))
   (null? dir)
 music

#(define filterDynamics
;; Like \removeWithTag, but will not affect other contexts
;; (i.e. no \change, no \bar or \time etc.)
  (define-music-function (parser location music) (ly:music?)
(if (ly:get-option 'no-auto-piano-dynamics)
(make-music 'Music 'void #t)
(music-filter
  (lambda (x)
(let ((name (ly:music-property x 'name))
  (tags (ly:music-property x 'tags))
  (dir (ly:music-property x 'direction)))
  (not (or
(eq? name 'ContextChange)
(eq? name 'VoiceSeparator)
;(eq? name 'ContextSpeccedMusic)
(memq 'staff-dynamics tags)
(ly:dir? dir)
  music


The advantage of the code I use is that it takes the dynamics from
either the upper or the lower staff:
\new PianoStaff 
  \new Staff \removeDynamics \upper
  \new Dynamics \filterDynamics  \upper \lower 
  \new Staff \removeDynamics \lower

However, all dynamics that have an explicit direction will be ignored
(c^\f, c-\f or c_\f), which allows you to keep the ability of
attaching some dynamics to one of the staves whenever you need to.

Hope this helps!

Cheers,
V. Villenave.

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


Re: strip dynamics for Piano music

2014-01-02 Thread Kieren MacMillan
Hi Valentin,

 What you’re describing is actually exactly what I do in my own scores:
 http://git.savannah.gnu.org/cgit/opus-libre.git/tree/lib/libdynamics.scm#n22

 The advantage of the code I use is that it takes the dynamics from
 either the upper or the lower staff:
 \new PianoStaff 
  \new Staff \removeDynamics \upper
  \new Dynamics \filterDynamics  \upper \lower 
  \new Staff \removeDynamics \lower
 
 However, all dynamics that have an explicit direction will be ignored
 (c^\f, c-\f or c_\f), which allows you to keep the ability of
 attaching some dynamics to one of the staves whenever you need to.

This is a wonderful function/extension, which — in my opinion — should be in 
the regular distro.

Thanks!
Kieren.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: strip dynamics for Piano music

2014-01-02 Thread Valentin Villenave
On Thu, Jan 2, 2014 at 1:40 PM, Kieren MacMillan
kieren_macmil...@sympatico.ca wrote:
 http://git.savannah.gnu.org/cgit/opus-libre.git/tree/lib/libdynamics.scm#n22
 This is a wonderful function/extension, which — in my opinion — should be in 
 the regular distro.

It *is* quite useful (at least to me), with a few caveats:

- Like all of my code, it is written in a ugly-hackish-sort-of way,
making use of tags etc. By the way, I should have mentioned that I
also use the following modified context:

\layout {
  \context {
\Dynamics
\alias Voice
\alias Staff
\remove Script_engraver
\remove Text_engraver
\consists Tweak_engraver
  }
}

- It also encourages the *user* to write in a ugly-hackish-sort-of way
(for instance you can begin a crescendo in the lower Staff and close
it later on in the upper Staff).

- It does *not*, as one would expect (I know I did), produce
vertically-centered dynamics in the Piano Staff. As soon as there’s
some complex enough music involved (i.e. ledger lines, let alone
cross-staff stuff!), results will be somewhat disappointing.

With that in mind, perhaps Janek could be interested in adding such a
snippet to his library. (Github makes me sick :-)

Cheers,
Valentin.

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


Re: strip dynamics for Piano music

2014-01-02 Thread Kieren MacMillan
Hi Valentin,

 - Like all of my code, it is written in a ugly-hackish-sort-of way,
 making use of tags etc.

Yes… What would be the non-ugly-hackish-sort-of-way?

 - It also encourages the *user* to write in a ugly-hackish-sort-of way
 (for instance you can begin a crescendo in the lower Staff and close
 it later on in the upper Staff).

Ew… =)

Yes, we probably shouldn’t be encouraging ugly-hackish-sort-of code. That being 
said, there’s no beautiful-elegant-sort-of way of doing this kind of thing, so 
here we are.

 - It does *not*, as one would expect (I know I did), produce
 vertically-centered dynamics in the Piano Staff. As soon as there’s
 some complex enough music involved (i.e. ledger lines, let alone
 cross-staff stuff!), results will be somewhat disappointing.

=(

Well, maybe if we collectively build the non-ugly-hackish-sort-of solution, 
that behaviour will change [for the better] as a side effect.

Cheers,
Kieren.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: strip dynamics for Piano music

2014-01-02 Thread Noeck

Am 02.01.2014 11:39, schrieb Valentin Villenave:
 On Fri, Dec 6, 2013 at 2:40 PM, Noeck noeck.marb...@gmx.de wrote:
 is it possible somehow, to split contents of a music expression into
 two? I am asking for a piano staff which I would enter as follows:
 upper = { a4\f g f e\p }
 lower = { a,1 }
 
 Greetings,
 sorry for answering so late but this message had been caught in my spam 
 filter!
 
 What you’re describing is actually exactly what I do in my own scores:
 http://git.savannah.gnu.org/cgit/opus-libre.git/tree/lib/libdynamics.scm#n22
 …
 However, all dynamics that have an explicit direction will be ignored
 (c^\f, c-\f or c_\f), which allows you to keep the ability of
 attaching some dynamics to one of the staves whenever you need to.

Hi Valentin,

That is exactly the thing I wanted to achieve with this functionality.
Thanks for your answer! I will check it out and test it (with all the
caveats in mind that you mention).

When I asked, I thought that this could be a very clever and helpful
functionality - on the other hand it could have some pitfalls and it
could be less robust than explicit input. You seem to confirm both. I
will know more after using it.

Thanks again,
Joram

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


strip dynamics for Piano music

2013-12-06 Thread Noeck
Hi,

is it possible somehow, to split contents of a music expression into
two? I am asking for a piano staff which I would enter as follows:
upper = { a4\f g f e\p }
lower = { a,1 }

Then use it with a Dynamics context between the staffs and put the
dynamics there and the rest in the upper staff (with the
self-explaining, non-existant functions \removeDynamics and \dynamicsOnly):
  \new PianoStaff 
\new Staff \removeDynamics \upper
\new Dynamics \dynamicsOnly \upper
\new Staff \lower
  

Is that possible? Would it be a good idea? Or should I approach this
differently?

Cheers,
Joram

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


Re: strip dynamics for Piano music

2013-12-06 Thread David Kastrup
Noeck noeck.marb...@gmx.de writes:

 Hi,

 is it possible somehow, to split contents of a music expression into
 two? I am asking for a piano staff which I would enter as follows:
 upper = { a4\f g f e\p }
 lower = { a,1 }

 Then use it with a Dynamics context between the staffs and put the
 dynamics there and the rest in the upper staff (with the
 self-explaining, non-existant functions \removeDynamics and \dynamicsOnly):
   \new PianoStaff 
 \new Staff \removeDynamics \upper
 \new Dynamics \dynamicsOnly \upper
 \new Staff \lower
   

 Is that possible? Would it be a good idea? Or should I approach this
 differently?

How about:

\version 2.17.29
upper = { a4\f g f e\p }
lower = { a,1 }

\new PianoStaff 
  \new Staff
  \new Voice \with { \remove Dynamic_engraver } \upper
  \new Dynamics \upper
  \new Staff \lower



-- 
David Kastrup
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: strip dynamics for Piano music

2013-12-06 Thread Noeck

Am 06.12.2013 14:48, schrieb David Kastrup:
 \version 2.17.29
 upper = { a4\f g f e\p }
 lower = { a,1 }
 
 \new PianoStaff 
   \new Staff
   \new Voice \with { \remove Dynamic_engraver } \upper
   \new Dynamics \upper
   \new Staff \lower
 

Hi David,

it looks good, but it does not work for me (2.17.26). The dynamics are
printed twice as if the \remove was not there.

Joram

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


Re: strip dynamics for Piano music

2013-12-06 Thread David Kastrup
Noeck noeck.marb...@gmx.de writes:

 Am 06.12.2013 14:48, schrieb David Kastrup:
 \version 2.17.29
 upper = { a4\f g f e\p }
 lower = { a,1 }
 
 \new PianoStaff 
   \new Staff
   \new Voice \with { \remove Dynamic_engraver } \upper
   \new Dynamics \upper
   \new Staff \lower
 

 Hi David,

 it looks good, but it does not work for me (2.17.26). The dynamics are
 printed twice as if the \remove was not there.

Well, what do you expect if you don't specify the version you are using
(by the way: what point is there in using an outdated development
version?)?

In 2.17.26 the engraver is called New_dynamic_engraver instead.

-- 
David Kastrup

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


Re: strip dynamics for Piano music

2013-12-06 Thread Noeck
Thanks David

 Well, what do you expect if you don't specify the version you are using
 (by the way: what point is there in using an outdated development
 version?)?

laziness and lack of regular use.

Cheers,
Joram

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