Re: Multimeasure rests over a cadenza

2012-04-09 Thread Thomas Morley
Am 9. April 2012 04:26 schrieb James Harkins jamshar...@gmail.com:
 At Sun, 8 Apr 2012 09:39:13 -0500,
 David Nalesnik wrote:
 Hi James,
 Possibly the following thread will be useful to you:
  http://www.mail-archive.com/lilypond-user@gnu.org/msg68492.html

 Thanks, this is a lot closer. (By the way, it seems that mail-archive is on 
 the wrong side of the Great Firewall of China -- not a big deal, but it did 
 make it less convenient to access the link. Speaking just for myself, I'd 
 prefer links to gmane or nabble archives.)

 It's closer -- I'm now getting bar check failures only at the ends of the 
 two cadenzas, where I think I was getting more of them before. But, it's 
 still failing and the multi-measure rests are drawn in the wrong place.

 So, a more illustrative example, using actual notes from my piece and 
 replicating the context (one bar of cadenza, one metered bar, and another bar 
 of cadenza).

 It looks to me like time advances the correct number of beats, but LP doesn't 
 recognize that it should roll over to the next bar at that point. I'm 
 guessing that for each cadenza + following-bar pair, where there should be 
 two full-bar rests, only one is being drawn (probably the first one, for the 
 cadenza) and the other one is being dropped because of the bar check failure. 
 Then it draws the single full-bar rest in the middle of the span for /both/ 
 bars.

 It doesn't help to include an explicit \bar | after the \cadenzaToMusic 
 calls.

 LP output. For debugging I restored the (format...) call, which shows that 
 the duration of both cadenzas is being calculated correctly.

Hi James,

the cadenzaToMusic-function _replaces_ \cadenzaOn and \cadenzaOff.
If you delete these commands it works and there is no need for manual bars:

\version 2.14.2

cadenzaToMusic =
#(define-music-function (parser location cadenzaMusic music)
 (ly:music? ly:music?)
Adjust the length of `music and the measureLength, to fit the length of
`cadenzaMusic
(let* ((clen (ly:music-length cadenzaMusic))
  (mlen (ly:music-length music))
  (factor (ly:moment-div clen mlen))
  (compressed (ly:music-compress music factor)))
 ;; (format #t factor : ~a\n factor)
 #{
   \set Timing.measureLength = $clen
   $compressed
   \unset Timing.measureLength
 #}))

\include english.ly

cadenzaC = \relative c''' {
 b2 ^\markup { \italic cadenza } ~
 \oneVoice b8 \fermata [a8] ) e'16 ( [a, fs a] \voiceOne b4 \fermata ~
}

cadenzaD = \relative c''' {
 b4 ~ ^\markup { \italic cadenza } b8 \fermata [a8] ) g16 ( [fs e d
e fs ] e4 ) \fermata ~
}

\score {
 
   \new Staff {
 \override Score.BarNumber #'break-visibility = #'#(#t #t #t)
 \key d \major \numericTimeSignature
 R1
 \cadenzaToMusic \cadenzaC R1
 R1
 \cadenzaToMusic \cadenzaD R1
 R1
   }
   \new Staff \relative c''' {
 \key d \major \numericTimeSignature
 r2 r4 a4 (
 \cadenzaC
 b1 ~
 \cadenzaD
 e,4. r8 r2
   }
 
}

HTH,
  Harm

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


Re: Multimeasure rests over a cadenza

2012-04-09 Thread James
Hello,

On 9 April 2012 11:03, Thomas Morley thomasmorle...@googlemail.com wrote:
 Am 9. April 2012 04:26 schrieb James Harkins jamshar...@gmail.com:
 At Sun, 8 Apr 2012 09:39:13 -0500,
 David Nalesnik wrote:
 Hi James,
 Possibly the following thread will be useful to you:
  http://www.mail-archive.com/lilypond-user@gnu.org/msg68492.html

 Thanks, this is a lot closer. (By the way, it seems that mail-archive is on 
 the wrong side of the Great Firewall of China -- not a big deal, but it did 
 make it less convenient to access the link. Speaking just for myself, I'd 
 prefer links to gmane or nabble archives.)

 It's closer -- I'm now getting bar check failures only at the ends of the 
 two cadenzas, where I think I was getting more of them before. But, it's 
 still failing and the multi-measure rests are drawn in the wrong place.

 So, a more illustrative example, using actual notes from my piece and 
 replicating the context (one bar of cadenza, one metered bar, and another 
 bar of cadenza).

 It looks to me like time advances the correct number of beats, but LP 
 doesn't recognize that it should roll over to the next bar at that point. 
 I'm guessing that for each cadenza + following-bar pair, where there should 
 be two full-bar rests, only one is being drawn (probably the first one, for 
 the cadenza) and the other one is being dropped because of the bar check 
 failure. Then it draws the single full-bar rest in the middle of the span 
 for /both/ bars.

 It doesn't help to include an explicit \bar | after the \cadenzaToMusic 
 calls.

 LP output. For debugging I restored the (format...) call, which shows that 
 the duration of both cadenzas is being calculated correctly.

 Hi James,

 the cadenzaToMusic-function _replaces_ \cadenzaOn and \cadenzaOff.
 If you delete these commands it works and there is no need for manual bars:

Thanks Thomas, I have added this snippet to the LilyPond Snippet
Repository - awaiting approval.

James

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


Re: lyrics vertical spacing and dynamics with extra-offset

2012-04-09 Thread Frank Steinmetzger
On Sat, Apr 07, 2012 at 10:54:24PM +0200, Janek Warchoł wrote:

  Is that a bug?  Or am I making a mistake here?
 
  It's not a bug, and not really a mistake either.  But extra-offset should
  be used only as a last resort, as the extra displacement is made only
  _after_ _all_ typesetting is finished.  So extra space is ignored.
 
 In other words zou should override X-offset and Y-offset here, not 
 extra-offset.

aha.  I tried X-offset at other places and hoped that the dynamic would
automatically move closer to the staff once it’s clear of its note, but
neither happened.
I guess I have to re-read that part of the manual and try again.
-- 
Gruß | Greetings | Qapla'
Please do not use my email addresses within any Facebook service.

:Beauty is in the eye of the beerholder.

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


Re: tie to note inside double backslashing voicing

2012-04-09 Thread Janek Warchoł
On Sat, Apr 7, 2012 at 11:27 PM, trandrusiii tr.and...@gmail.com wrote:

 Hi. The problem I am having now is different. When I attempt to add a hairpin
 decres the spacing of my entire piece gets corrupted. I've attached a
 screencap to illustrate. I would like the spacing to remain at 31 or 32
 pages.
 http://old.nabble.com/file/p33649921/spacingproblem.jpg spacingproblem.jpg

The diffference is so big after only adding a hairpin?  That's
definitely a bug.  Please create a tiny example (i.e. keep deleting
things from your source file while checking if adding hairpin changes
spacing.  The remaining code should be less than 30 lines long, maybe
even shorter) and submit a bug report
(http://lilypond.org/bug-reports.html)

thanks,
Janek

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


Re: Multimeasure rests over a cadenza

2012-04-09 Thread James Harkins
At Mon, 9 Apr 2012 12:03:05 +0200,
Thomas Morley wrote:
 
 Am 9. April 2012 04:26 schrieb James Harkins jamshar...@gmail.com:
  It's closer -- I'm now getting bar check failures only at the ends of the 
  two cadenzas, where I think I was getting more of them before. But, it's 
  still failing and the multi-measure rests are drawn in the wrong place.
 
 Hi James,
 
 the cadenzaToMusic-function _replaces_ \cadenzaOn and \cadenzaOff.
 If you delete these commands it works and there is no need for manual bars:

Ah, OK, I didn't get the replacing part. Thanks for clarifying.

I have a deadline for tomorrow so I can't try it right now, but will do it as 
soon as I can.

Thanks!
James


--
James Harkins /// dewdrop world
jamshar...@dewdrop-world.net
http://www.dewdrop-world.net

Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal.  -- Whitman

blog: http://www.dewdrop-world.net/words
audio clips: http://www.dewdrop-world.net/audio
more audio: http://soundcloud.com/dewdrop_world/tracks

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


Re: musicxml2ly

2012-04-09 Thread pls
Hi Martin,

yes, we are currently working on the musicxml2ly scripts and we have solved 
e.g. the issue concerning the chord symbols you mentioned. I haven't had time 
to work on the patch James pointed to but it works as it is. We use it on 
www.philomelos.net. Philomelos is a new community site for free and editable 
sheet music. The private beta version includes the ability to read and share 
MusicXML files that are displayed online using LilyPond technology. If someone 
wants to be invited: drop me a line offlist.

We will share all improvements on musicxml2ly but we could also need some help! 
We are planning to add a blog/wiki to our website so that philomelos can be 
used to test MusicXML files and to share music sheets and knowledge concerning 
MusicXML, conversions between musical notation codes...

Cheers,
patrick
Am 08.04.2012 um 19:13 schrieb James:

 Hello,
 
 On 8 April 2012 17:47, Martin Tarenskeen m.tarensk...@zonnet.nl wrote:
 ...
 Or are many
 problems already known?
 
 http://code.google.com/p/lilypond/issues/list?can=2q=musicxmlsort=prioritycolspec=IDx=typey=prioritymode=gridcells=tiles
 
 There is also this recent - seemingly unfinished patch
 
 http://codereview.appspot.com/5697059/
 
 And see
 
 http://lists.gnu.org/archive/html/lilypond-devel/2011-12/msg00025.html
 
 http://lists.gnu.org/archive/html/lilypond-user/2011-11/msg00280.html
 
 This will give you an idea of the current issues and the effort still 
 required.
 
 James
 
 ___
 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


Moving notes in a chord to the opposite side of the stem?

2012-04-09 Thread Paul Morris
Hello,  Is there a way to manually move some of the notes in a chord to 
the opposite side of the stem, overriding the default placement?


I have looked through the docs and did not find a simple way to do this 
(the |NoteColumn #'force-hshift| property only works with notes in 
different voices, and trying to \override NoteHead #'X-offset  within a 
chord just returned an error).  The best thing I came up with was this 
snippet:

http://lsr.dsi.unimi.it/LSR/Item?id=505

Following its example I was able to get the results I needed by doing this:


shiftR = {
  \once \override Stem #'X-offset = #.6
  \once \override NoteHead #'X-offset = #.6
}

c' e' g' 4
 { c' e' } \\ { \voiceThree \shiftR g' } 

d' f' a'
 { d' } \\ { \voiceThree  \shiftR  f' a' } 


See attached screenshot.  But it seems like there should be a way to do 
this without having to introduce another voice? Or maybe not... I 
realize this is a relatively obscure usage.


(Ultimately, I would like for the notes in harmonic intervals of 3 
semitones or smaller to always appear on opposite sides of the stem.  
But I would not know how to do that automatically, if it is even possible.)


Thanks!
-Paul

http://twinnote.org

attachment: Screen Shot 2012-04-08 at 9.17.38 PM.png___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: tie to note inside double backslashing voicing

2012-04-09 Thread Stan Sanderson
On Apr 9, 2012, at 8:13 AM, Janek Warchoł janek.lilyp...@gmail.com wrote:

 On Sat, Apr 7, 2012 at 11:27 PM, trandrusiii tr.and...@gmail.com wrote:
 
 Hi. The problem I am having now is different. When I attempt to add a hairpin
 decres the spacing of my entire piece gets corrupted. I've attached a
 screencap to illustrate. I would like the spacing to remain at 31 or 32
 pages.
 http://old.nabble.com/file/p33649921/spacingproblem.jpg spacingproblem.jpg
 
 The diffference is so big after only adding a hairpin?  That's
 definitely a bug.  Please create a tiny example (i.e. keep deleting
 things from your source file while checking if adding hairpin changes
 spacing.  The remaining code should be less than 30 lines long, maybe
 even shorter) and submit a bug report
 (http://lilypond.org/bug-

But isn't there a timing problem in the { s4\ s4\!} measure? 2 vs. 3 beats?

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


Two voice notes with one voice rests

2012-04-09 Thread Helge Kruse

Hello,

how can I write accords with stems like as used in two voices?

In the following example I would like to us the notes and stems from the 
first measure and the rests from the second measure.


\relative c'' {
   { d8 r d r d r d r } \\ { b8 r b r b r b r }  
  b d r b d r b d r b d r
}


Regards,
Helge

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


Re: Moving notes in a chord to the opposite side of the stem?

2012-04-09 Thread Thomas Morley
Am 9. April 2012 03:25 schrieb Paul Morris p...@paulwmorris.com:
 Hello,  Is there a way to manually move some of the notes in a chord to the
 opposite side of the stem, overriding the default placement?

 I have looked through the docs and did not find a simple way to do this (the
 NoteColumn #'force-hshift property only works with notes in different
 voices, and trying to \override NoteHead #'X-offset  within a chord just
 returned an error).  The best thing I came up with was this snippet:
 http://lsr.dsi.unimi.it/LSR/Item?id=505

 Following its example I was able to get the results I needed by doing this:


 shiftR = {
   \once \override Stem #'X-offset = #.6
   \once \override NoteHead #'X-offset = #.6
 }

 c' e' g' 4
  { c' e' } \\ { \voiceThree \shiftR g' } 

 d' f' a'
  { d' } \\ { \voiceThree  \shiftR  f' a' } 


 See attached screenshot.  But it seems like there should be a way to do this
 without having to introduce another voice?

Use a tweak.

Perhaps:

\version 2.14.2

horOff =
#(define-music-function (parser location x-off music) (number? ly:music?)
 (set! (ly:music-property music 'tweaks)
(acons 'extra-offset (cons x-off 0)
 (ly:music-property music 'tweaks)))
   music)

%shiftR = {
%  \once \override Stem #'X-offset = #.6
%  \once \override NoteHead #'X-offset = #.6
%}

{
c' e' \horOff #1.2 g' 4
% { c' e' } \\ { \voiceThree \shiftR g' } 

d' \horOff #1.2 f' \horOff #1.2 a'
% { d' } \\ { \voiceThree  \shiftR  f' a' } 
}

HTH,
  Harm

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


Re: Two voice notes with one voice rests

2012-04-09 Thread Phil Holmes
- Original Message - 
From: Helge Kruse helge.kruse-nos...@gmx.net

To: lilypond-user@gnu.org
Sent: Monday, April 09, 2012 6:17 PM
Subject: Two voice notes with one voice rests



Hello,

how can I write accords with stems like as used in two voices?

In the following example I would like to us the notes and stems from the 
first measure and the rests from the second measure.


\relative c'' {
   { d8 r d r d r d r } \\ { b8 r b r b r b r }  
  b d r b d r b d r b d r
}


Regards,
Helge


Here's one way:

\relative c'' {
   { \override Rest #'staff-position = #0 d8 r d r d r d r } \\ { b8 s b 
s b s b s }  

  b d r b d r b d r b d r
}



--
Phil Holmes



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


Avoiding tie/prall collision

2012-04-09 Thread Helge Kruse

Hello,

I have some measures with similar rhythmic pattern but different pitch. 
But all look similar like this:


\context PianoStaff 
  \context Staff=right \relative c'' {
\key g \major \time 3/4 s2. \stemUp
d4~ d16 a' g\prall fis e\prall d cis\prall b | % 33
  }

  \context Staff=left \relative c' {
\key g \major \time 3/4 \clef bass s2. \stemDown
\change Staff=right r16 a' g\prall fis g4 \change Staff=left r | % 33
  }




Every time I get a collision between the tie and the prall ornament. I 
already changed the tie to d4^~ d16 but the \prall is still above the 
system. What is the best way to move the prall ornament below the tie?



Regards,
Helge


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


Re: Avoiding tie/prall collision

2012-04-09 Thread Thomas Morley
Am 9. April 2012 20:53 schrieb Helge Kruse helge.kruse-nos...@gmx.net:
 Hello,

 I have some measures with similar rhythmic pattern but different pitch. But
 all look similar like this:

 \context PianoStaff 
  \context Staff=right \relative c'' {
    \key g \major \time 3/4 s2. \stemUp
    d4~ d16 a' g\prall fis e\prall d cis\prall b | % 33
  }

  \context Staff=left \relative c' {
    \key g \major \time 3/4 \clef bass s2. \stemDown
    \change Staff=right r16 a' g\prall fis g4 \change Staff=left r | % 33
  }




 Every time I get a collision between the tie and the prall ornament. I
 already changed the tie to d4^~ d16 but the \prall is still above the
 system. What is the best way to move the prall ornament below the tie?


 Regards,
 Helge

I'd use \override Script #'staff-padding = #'() and \voiceOne,
\voiceTwo and \oneVoice:

\version 2.14.2

\context PianoStaff 
 \context Staff=right \relative c'' {
   \key g \major \time 3/4 s2. \voiceOne
   d4~ d16 a' g\prall fis e\prall d cis\prall b | % 33
 }

 \context Staff=left \relative c' {
 \override Script #'staff-padding = #'()
   \key g \major \time 3/4 \clef bass s2. \voiceTwo
   \change Staff=right r16 a' g^\prall fis g4  \change Staff=left
\oneVoice r | % 33
 }



HTH,
  Harm

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


Re: Moving notes in a chord to the opposite side of the stem?

2012-04-09 Thread Paul Morris

Thomas Morley wrote:

Am 9. April 2012 03:25 schrieb Paul Morrisp...@paulwmorris.com:

Hello,  Is there a way to manually move some of the notes in a chord to the
opposite side of the stem, overriding the default placement?

I have looked through the docs and did not find a simple way to do this (the
NoteColumn #'force-hshift property only works with notes in different
voices, and trying to \override NoteHead #'X-offset  within a chord just
returned an error).  The best thing I came up with was this snippet:
http://lsr.dsi.unimi.it/LSR/Item?id=505

Following its example I was able to get the results I needed by doing this:


shiftR = {
   \once \override Stem #'X-offset = #.6
   \once \override NoteHead #'X-offset = #.6
}

c' e' g'4
  {c' e'  } \\ { \voiceThree \shiftR g' }

d' f' a'
  { d' } \\ { \voiceThree  \shiftR  f' a'  }


See attached screenshot.  But it seems like there should be a way to do this
without having to introduce another voice?


Use a tweak.

Perhaps:

\version 2.14.2

horOff =
#(define-music-function (parser location x-off music) (number? ly:music?)
  (set! (ly:music-property music 'tweaks)
(acons 'extra-offset (cons x-off 0)
  (ly:music-property music 'tweaks)))
music)

%shiftR = {
%  \once \override Stem #'X-offset = #.6
%  \once \override NoteHead #'X-offset = #.6
%}

{
c' e' \horOff #1.2 g'4
%  {c' e'  } \\ { \voiceThree \shiftR g' }

d' \horOff #1.2 f' \horOff #1.2 a'
%  { d' } \\ { \voiceThree  \shiftR  f' a'  }
}

HTH,
   Harm


Thank you!  This works, but unfortunately (like the Hydra's heads) it 
introduces two other problems, one with horizontal spacing collisions 
and one with ledger lines.


1. Because the spacing engine does not take into account this low-level 
tweak, the tweaked notes sometimes collide with bar/measure lines and 
sometimes with other adjacent notes.  Is there a way to use Scheme to 
also increase the horizontal space given to the chord?  (I am still a 
beginner at Scheme.)


Maybe by tweaking |horizontal-skylines| for the NoteColumn?
http://lilypond.org/doc/v2.14/Documentation/internals/notecolumn

2. If a note is on a ledger line, the ledger line is not offset with its 
note, but is left behind in its original position.  Is there a way to 
offset the ledger line as well as the note?


It seems like the ideal solution would be if there was a way to create a 
second NoteColumn for the chord and move some notes over into it?  Like 
what (I assume) happens automatically when a chord has notes that are an 
interval of a second apart?


Thanks again,
-Paul


PS. I tried this, but it doesn't seem to have any effect, although it 
doesn't return any errors.  I imagine I'm not accessing the NoteColumn 
correctly.


\version 2.14.2

chordTweak =
#(define-music-function (parser location l-sky r-sky music) (number? 
number? ly:music?)

 (set! (ly:music-property music 'tweaks)
(acons 'horizontal-skylines (cons l-sky r-sky)
 (ly:music-property music 'tweaks)))
   music)

{
\chordTweak #30 #60   c'' e'' g''
}

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


Re: Moving notes in a chord to the opposite side of the stem?

2012-04-09 Thread Nick Payne

On 10/04/12 06:56, Paul Morris wrote:

Thomas Morley wrote:

Am 9. April 2012 03:25 schrieb Paul Morrisp...@paulwmorris.com:

Hello,  Is there a way to manually move some of the notes in a chord to the
opposite side of the stem, overriding the default placement?

I have looked through the docs and did not find a simple way to do this (the
NoteColumn #'force-hshift property only works with notes in different
voices, and trying to \override NoteHead #'X-offset  within a chord just
returned an error).  The best thing I came up with was this snippet:
http://lsr.dsi.unimi.it/LSR/Item?id=505

Following its example I was able to get the results I needed by doing this:


shiftR = {
   \once \override Stem #'X-offset = #.6
   \once \override NoteHead #'X-offset = #.6
}

c' e' g'4
  {c' e'  } \\ { \voiceThree \shiftR g' }

d' f' a'
  { d' } \\ { \voiceThree  \shiftR  f' a'  }


See attached screenshot.  But it seems like there should be a way to do this
without having to introduce another voice?


Use a tweak.

Perhaps:

\version 2.14.2

horOff =
#(define-music-function (parser location x-off music) (number? ly:music?)
  (set! (ly:music-property music 'tweaks)
(acons 'extra-offset (cons x-off 0)
  (ly:music-property music 'tweaks)))
music)

%shiftR = {
%  \once \override Stem #'X-offset = #.6
%  \once \override NoteHead #'X-offset = #.6
%}

{
c' e' \horOff #1.2 g'4
%  {c' e'  } \\ { \voiceThree \shiftR g' }

d' \horOff #1.2 f' \horOff #1.2 a'
%  { d' } \\ { \voiceThree  \shiftR  f' a'  }
}

HTH,
   Harm


Thank you!  This works, but unfortunately (like the Hydra's heads) it 
introduces two other problems, one with horizontal spacing collisions 
and one with ledger lines.


1. Because the spacing engine does not take into account this 
low-level tweak, the tweaked notes sometimes collide with bar/measure 
lines and sometimes with other adjacent notes.  Is there a way to use 
Scheme to also increase the horizontal space given to the chord?  (I 
am still a beginner at Scheme.)


Can't help with the second problem, but for the first you could add 
additional horizontal space to either the barline or stem to increase 
their separation:


\version 2.15.36

barspace = #(define-music-function (parser location extent) (pair?) #{
\once \override Staff.BarLine #'extra-spacing-width = #extent
#})

stemspace = #(define-music-function (parser location extent) (pair?) #{
\once \override Staff.Stem #'X-extent = #extent
#})

\relative c'' {
c2 c c c \barspace #'(0 . 2)
c c
\stemspace #'(-2 . 0) c c
}
attachment: test.png___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Moving notes in a chord to the opposite side of the stem?

2012-04-09 Thread David Nalesnik
Hi Paul,

On Mon, Apr 9, 2012 at 4:47 PM, Nick Payne nick.pa...@internode.on.netwrote:

  On 10/04/12 06:56, Paul Morris wrote:

 Thomas Morley wrote:

 Am 9. April 2012 03:25 schrieb Paul Morris p...@paulwmorris.com 
 p...@paulwmorris.com:

  Hello,  Is there a way to manually move some of the notes in a chord to the
 opposite side of the stem, overriding the default placement?

 I have looked through the docs and did not find a simple way to do this (the
 NoteColumn #'force-hshift property only works with notes in different
 voices, and trying to \override NoteHead #'X-offset  within a chord just
 returned an error).  The best thing I came up with was this 
 snippet:http://lsr.dsi.unimi.it/LSR/Item?id=505

 Following its example I was able to get the results I needed by doing this:


 shiftR = {
   \once \override Stem #'X-offset = #.6
   \once \override NoteHead #'X-offset = #.6
 }

 c' e' g' 4
  { c' e' } \\ { \voiceThree \shiftR g' } 

 d' f' a'
  { d' } \\ { \voiceThree  \shiftR  f' a' } 


 See attached screenshot.  But it seems like there should be a way to do this
 without having to introduce another voice?

  Use a tweak.

 Perhaps:

 \version 2.14.2

 horOff =
 #(define-music-function (parser location x-off music) (number? ly:music?)
  (set! (ly:music-property music 'tweaks)
   (acons 'extra-offset (cons x-off 0)
  (ly:music-property music 'tweaks)))
music)

 %shiftR = {
 %  \once \override Stem #'X-offset = #.6
 %  \once \override NoteHead #'X-offset = #.6
 %}

 {
 c' e' \horOff #1.2 g' 4
 % { c' e' } \\ { \voiceThree \shiftR g' } 

 d' \horOff #1.2 f' \horOff #1.2 a'
 % { d' } \\ { \voiceThree  \shiftR  f' a' } 
 }

 HTH,
   Harm


 Thank you!  This works, but unfortunately (like the Hydra's heads) it
 introduces two other problems, one with horizontal spacing collisions and
 one with ledger lines.

 1. Because the spacing engine does not take into account this low-level
 tweak, the tweaked notes sometimes collide with bar/measure lines and
 sometimes with other adjacent notes.  Is there a way to use Scheme toalso 
 increase the horizontal space given to the chord?  (I am still a
 beginner at Scheme.)


 Can't help with the second problem, but for the first you could add
 additional horizontal space to either the barline or stem to increase their
 separation:

 \version 2.15.36

 barspace = #(define-music-function (parser location extent) (pair?) #{
 \once \override Staff.BarLine #'extra-spacing-width = #extent
 #})

 stemspace = #(define-music-function (parser location extent) (pair?) #{
 \once \override Staff.Stem #'X-extent = #extent
 #})

 \relative c'' {
 c2 c c c \barspace #'(0 . 2)
 c c
 \stemspace #'(-2 . 0) c c
 }

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


This seems to do the trick as far as horizontal spacing is concerned:

\version 2.15.36

#(define ((shift offsets) grob)
  (let ((note-heads (ly:grob-array-list (ly:grob-object grob
'note-heads
(map
  (lambda (p q) (set! (ly:grob-property p 'X-offset) q))
  note-heads offsets)))

displaceHeads =
#(define-music-function (parser location offsets) (list?)
  #{
\once \override NoteColumn #'before-line-breaking = #(shift offsets)
  #}
)

{
  \displaceHeads #'(0 1.2 0)
  c' e' g'4
  \displaceHeads #'(0 1.2 1.2)
  d' f' a'
}

Hope this helps!

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


Re: Moving notes in a chord to the opposite side of the stem?

2012-04-09 Thread Paul Morris

Thanks David and Nick!  More below...

David Nalesnik wrote:

Hi Paul,

On Mon, Apr 9, 2012 at 4:47 PM, Nick Payne 
nick.pa...@internode.on.net mailto:nick.pa...@internode.on.net wrote:


On 10/04/12 06:56, Paul Morris wrote:

Thank you!  This works, but unfortunately (like the Hydra's
heads) it introduces two other problems, one with horizontal
spacing collisions and one with ledger lines.

1. Because the spacing engine does not take into account this
low-level tweak, the tweaked notes sometimes collide with
bar/measure lines and sometimes with other adjacent notes.  Is
there a way to use Scheme to also increase the horizontal space
given to the chord?  (I am still a beginner at Scheme.)


Can't help with the second problem, but for the first you could
add additional horizontal space to either the barline or stem to
increase their separation:

\version 2.15.36

barspace = #(define-music-function (parser location extent) (pair?) #{
\once \override Staff.BarLine #'extra-spacing-width = #extent
#})

stemspace = #(define-music-function (parser location extent)
(pair?) #{
\once \override Staff.Stem #'X-extent = #extent
#})

\relative c'' {
c2 c c c \barspace #'(0 . 2)
c c
\stemspace #'(-2 . 0) c c
}

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


This seems to do the trick as far as horizontal spacing is concerned:

\version 2.15.36

#(define ((shift offsets) grob)
  (let ((note-heads (ly:grob-array-list (ly:grob-object grob 
'note-heads

(map
  (lambda (p q) (set! (ly:grob-property p 'X-offset) q))
  note-heads offsets)))

displaceHeads =
#(define-music-function (parser location offsets) (list?)
  #{
\once \override NoteColumn #'before-line-breaking = #(shift offsets)
  #}
)

{
  \displaceHeads #'(0 1.2 0)
c' e' g'4
  \displaceHeads #'(0 1.2 1.2)
d' f' a'
}

Hope this helps!
-David


Actually, David's approach appears to fix both problems!  Ledger lines 
are extended and appear twice as wide, just like with other chords that 
have notes on both sides of the stem.  The horizontal spacing seems to 
be working with standard noteheads.  (Looks like a good candidate for 
the LSR.)


Unfortunately a function I'm using to substitute custom stencils for 
NoteHead grobs seems to disrupt the horizontal spacing in some instances 
(particularly noticeable with bar lines).  I haven't figured out the 
pattern yet.  But worst case, that's something I can fix manually using 
the tweaks Nick suggested.  Or maybe there is a way to expand David's 
function to access the Stem from the NoteColumn and automatically give 
it an X-offset too?


A stripped down version of my code is below, if anyone is curious.  It 
is still a bit long.


Again, thanks so much!  I really appreciate it, as it would take me 
forever to try and figure this stuff out on my own.


-Paul


\version 2.15.32

%Begin TwinNote scripts
%Customizing note head stencils based on pitch
%Defining stencils

upTriangle =
#(ly:make-stencil
(list 'embedded-ps
gsave
  currentpoint translate
  newpath
  -.1875 -.5 moveto
  .65625 .5 lineto
  1.5 -.5 lineto
  closepath
  fill
  grestore )
(cons -.1875 1.5)
(cons -.5 .5)
)

downTriangle =
#(ly:make-stencil
(list 'embedded-ps
gsave
  currentpoint translate

  newpath
  .08 .34 moveto
  .65625 -.4 lineto
  1.2325 .34 lineto
  closepath
  0.12 setlinewidth
  stroke

  newpath
  -.0775 .43 moveto
  .65625 -.43 lineto
  1.39 .43 lineto
  closepath
  0.1 setlinewidth
  stroke

  newpath
  -.1675 .48 moveto
  .65625 -.48 lineto
  1.48 .48 lineto
  closepath
  0.04 setlinewidth
  stroke

  grestore )
(cons -.1875 1.5)
(cons -.5 .5)
)

%Based on the pitch's semitone, which note head
#(define (semitone-to-stencil semitone)
(if (= (remainder semitone 2) 0) downTriangle upTriangle)
)

%Get the pitch from the grob, convert to semitone
#(define (stencil-notehead grob)
   (semitone-to-stencil
 (ly:pitch-semitones (ly:event-property (event-cause grob) 'pitch

%End TwinNote scripts


#(define ((shift offsets) grob)
  (let ((note-heads (ly:grob-array-list (ly:grob-object grob 
'note-heads

(map
  (lambda (p q) (set! (ly:grob-property p 'X-offset) q))
  note-heads offsets)))

displaceHeads =
#(define-music-function (parser location offsets) (list?)
  #{
\once \override NoteColumn #'before-line-breaking = #(shift offsets)
  #}
)

theMusic = {
\displaceHeads #'(0 0 1.45)
c' e' g' 4

\displaceHeads #'(0 1.45 1.45)
d' f' a'

\displaceHeads #'(0 1.45 1.45)
d' f' a'

\displaceHeads #'(0 0 1.45)
 c' e' g'

\displaceHeads #'(-1.45 -1.45 0)
 c'' e'' g''

\displaceHeads 

Re: Moving notes in a chord to the opposite side of the stem?

2012-04-09 Thread David Nalesnik
Hi Paul,

On Mon, Apr 9, 2012 at 9:50 PM, Paul Morris p...@paulwmorris.com wrote:

 Thanks David and Nick!  More below...

 David Nalesnik wrote:

 Hi Paul,

 On Mon, Apr 9, 2012 at 4:47 PM, Nick Payne nick.pa...@internode.on.netwrote:

 On 10/04/12 06:56, Paul Morris wrote:

 Thank you!  This works, but unfortunately (like the Hydra's heads) it
 introduces two other problems, one with horizontal spacing collisions and
 one with ledger lines.

 1. Because the spacing engine does not take into account this low-level
 tweak, the tweaked notes sometimes collide with bar/measure lines and
 sometimes with other adjacent notes.  Is there a way to use Scheme toalso 
 increase the horizontal space given to the chord?  (I am still a
 beginner at Scheme.)


 Can't help with the second problem, but for the first you could add
 additional horizontal space to either the barline or stem to increase their
 separation:

 \version 2.15.36

 barspace = #(define-music-function (parser location extent) (pair?) #{
 \once \override Staff.BarLine #'extra-spacing-width = #extent
 #})

 stemspace = #(define-music-function (parser location extent) (pair?) #{
 \once \override Staff.Stem #'X-extent = #extent
 #})

 \relative c'' {
 c2 c c c \barspace #'(0 . 2)
 c c
 \stemspace #'(-2 . 0) c c
 }

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


 This seems to do the trick as far as horizontal spacing is concerned:

 \version 2.15.36

 #(define ((shift offsets) grob)
   (let ((note-heads (ly:grob-array-list (ly:grob-object grob
 'note-heads
 (map
   (lambda (p q) (set! (ly:grob-property p 'X-offset) q))
   note-heads offsets)))

 displaceHeads =
 #(define-music-function (parser location offsets) (list?)
   #{
 \once \override NoteColumn #'before-line-breaking = #(shift offsets)
   #}
 )

 {
   \displaceHeads #'(0 1.2 0)
   c' e' g'4
   \displaceHeads #'(0 1.2 1.2)
   d' f' a'
 }

 Hope this helps!
 -David


 Actually, David's approach appears to fix both problems!  Ledger lines are
 extended and appear twice as wide, just like with other chords that have
 notes on both sides of the stem.  The horizontal spacing seems to be
 working with standard noteheads.  (Looks like a good candidate for the LSR.)


 Unfortunately a function I'm using to substitute custom stencils for
 NoteHead grobs seems to disrupt the horizontal spacing in some instances
 (particularly noticeable with bar lines).  I haven't figured out the
 pattern yet.  But worst case, that's something I can fix manually using the
 tweaks Nick suggested.  Or maybe there is a way to expand David's function
 to access the Stem from the NoteColumn and automatically give it an
 X-offset too?

 A stripped down version of my code is below, if anyone is curious.  It is
 still a bit long.

 Again, thanks so much!  I really appreciate it, as it would take me
 forever to try and figure this stuff out on my own.

 -Paul


 \version 2.15.32

 %Begin TwinNote scripts
 %Customizing note head stencils based on pitch
 %Defining stencils

 upTriangle =
 #(ly:make-stencil
 (list 'embedded-ps
 gsave
   currentpoint translate
   newpath
   -.1875 -.5 moveto
   .65625 .5 lineto
   1.5 -.5 lineto
   closepath
   fill
   grestore )
 (cons -.1875 1.5)
 (cons -.5 .5)
 )

 downTriangle =
 #(ly:make-stencil
 (list 'embedded-ps
 gsave
   currentpoint translate

   newpath
   .08 .34 moveto
   .65625 -.4 lineto
   1.2325 .34 lineto
   closepath
   0.12 setlinewidth
   stroke

   newpath
   -.0775 .43 moveto
   .65625 -.43 lineto
   1.39 .43 lineto
   closepath
   0.1 setlinewidth
   stroke

   newpath
   -.1675 .48 moveto
   .65625 -.48 lineto
   1.48 .48 lineto
   closepath
   0.04 setlinewidth
   stroke

   grestore )
 (cons -.1875 1.5)
 (cons -.5 .5)
 )

 %Based on the pitch's semitone, which note head
 #(define (semitone-to-stencil semitone)
 (if (= (remainder semitone 2) 0) downTriangle upTriangle)
 )

 %Get the pitch from the grob, convert to semitone
 #(define (stencil-notehead grob)
(semitone-to-stencil
  (ly:pitch-semitones (ly:event-property (event-cause grob) 'pitch

 %End TwinNote scripts


 #(define ((shift offsets) grob)
   (let ((note-heads (ly:grob-array-list (ly:grob-object grob
 'note-heads
 (map
   (lambda (p q) (set! (ly:grob-property p 'X-offset) q))
   note-heads offsets)))

 displaceHeads =
 #(define-music-function (parser location offsets) (list?)
   #{
 \once \override NoteColumn #'before-line-breaking = #(shift offsets)
   #}
 )

 theMusic = {
 \displaceHeads #'(0 0 1.45)
 c' e' g' 4

 \displaceHeads #'(0 1.45 1.45)
 d' f' a'

 \displaceHeads #'(0 1.45 1.45)
 d' f' a'

 \displaceHeads #'(0 0 1.45)
  c' e' g'

 \displaceHeads #'(-1.45 -1.45 0)
  

Fwd: Re: Automatic beams

2012-04-09 Thread Helge Kruse

... forget CC to the list.

Am 09.04.2012 01:09, schrieb Nick Payne:

\version 2.14.2

changeBeaming = \set beamExceptions =
#'((end . (((1 . 8) . (2 2 2 2))
((1 . 16) . (2 2 2 2 2 2 2 2))
((1 . 24) . (3 3 3 3 3 3 3 3)

revertBeaming = \set beamExceptions = #'()

\new PianoStaff 
\new Staff {
\time 4/4 \key g \major
\relative c'' {
\changeBeaming
\set tupletSpannerDuration = #(ly:make-moment 1 8)
\times 4/6{c'16 a b c b a } \times 4/6{r e fis g fis e }
fis16 d fis a r fis a c | % 24
}
}

\new Staff {
\time 4/4 \key g \major \clef bass
\relative c {
\changeBeaming
fis8 d' g, d' a d b d | % 24
}
}
 


Nick,
many thanks for this help. It's exactly what I need. There are some
irregular measures that I have to fix with manual beams. But most beams
don't need any tweak anymore.

Thanks also to Hans and Eluze!

Happy Easter!
Helge

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


Re: Avoiding tie/prall collision

2012-04-09 Thread Helge Kruse

Am 09.04.2012 21:12, schrieb Thomas Morley:

I'd use \override Script #'staff-padding = #'() and \voiceOne,
\voiceTwo and \oneVoice:


This looks great. I also played around with an approach that doesn't use 
the two voices since it's just the left hand that plays some part of the 
voice.


\version 2.14.2

\context PianoStaff
  \context Staff=right \relative c'' {
\key g \major \time 3/4 s2. \stemUp
d4^~ d16 a' g\prall fis e\prall d cis\prall b | % 33
  }
  \context Staff=left \relative c' {
\override Script #'staff-padding = #'()
\key g \major \time 3/4 \clef bass s2. \stemDown
\change Staff=right r16 a' g\prall fis g4  \change Staff=left r | % 33
  }




What is the benefit of the two voices approach and when should I avoid 
the stem up/down?


Thanks,
Helge

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