Re: Polychord

2020-11-27 Thread Robin Bannister




My advice:  Don't try.  Write markup for overriding the 'text property.



And if you don't feel up to doing that sort of markup,
you could get most of the way with an additional context:



\version "2.20.0"

coharmonies = \chordmode { d1:m s d:dim s fis}
harmonies = \chordmode { c1 c:m c:7 cis c:m7 }

\score {
  <<
\new ChordNames { \coharmonies }
\new ChordNames { \harmonies   }
  >>
  \layout{ }
  \midi { }
}



Cheers,
Robin


Re: Polychord

2020-11-27 Thread Robin Bannister

 achard wrote:


This is what a user wrote to get polychords.

But I would like the bottom chord to appear as C7 or Cm7 or C maj7.




"If I were you, I wouldn't start from here."


The approach of the Scheme snippet you have selected is extremely 
blinkered, catering only for combinations of root pitches.

It bypasses the Lilypond code for mode and modifiers.
And a warning: polychordExceptionMusic will explode combinatorially.

So to go the Lilypond/Scheme way, you should keep the two chords 
separate for as long as possible, and 'just' combine the resulting 
stencils.



My advice:  Don't try.  Write markup for overriding the 'text property.


Cheers,
Robin








Polychord

2020-11-27 Thread achard

Hello.

This is what a user wrote to get polychords.

But I would like the bottom chord to appear as C7 or Cm7 or C maj7.

I am not enough Scheme expert. If anyone can help me, thanks in advance. 
Have a good day.


Jean-Pierre


\version "2.14.0"

#(define-markup-command (transposed-chord-root-name layout props a b) 
(number? number?)

  #:properties ((cause #f))
  "Print the root of the chord transposed."
  (interpret-markup layout props
    (markup (note-name->markup
 (ly:pitch-transpose (ly:event-property cause 'pitch) 
(ly:make-pitch 0 a b))

    #f

#(define-markup-command (chord-root-name layout props) ()
  #:properties ((cause #f))
  "Print the root of the chord transposed."
  (interpret-markup layout props
    (markup (note-name->markup (ly:event-property cause 'pitch) #f)
    )))

#(define-public (silent-chord-root-namer pitch lowercase?)
   (markup "")
)

#(define-markup-command (polychord-column layout props args)
 (markup-list?)
  ;#:properties ((direction)
  ;(baseline-skip))

 (let* ((args-length-ls (sort (map (lambda (x)
           (interval-length
              (ly:stencil-extent
             (interpret-markup layout props x)
               X)))
           args)
         >))
   ; baseline-skip is hard-coded!
   ; if you change this don't forget to change 0.65
   ; in: #:translate (cons 0 (* 0.65 baseline-skip))
   (baseline-skip 1.4)
   (ln-mrkp (markup #:translate (cons 0 (* 0.65 baseline-skip))
        #:draw-line (cons (car args-length-ls) 0)))
   (new-args (list (car args) ln-mrkp (cadr args
   ; direction is hard-coded!
 (stack-lines 1 ;(if (number? direction) direction -1)
  0.0
  baseline-skip
  (interpret-markup-list layout props new-args

polychordExceptionMusic = {
  1-\markup { \polychord-column
   { \chord-root-name \transposed-chord-root-name 
#1 #-1/2 } }

  1-\markup { \polychord-column
   { \chord-root-name \transposed-chord-root-name 
#1 #0 } }

}

%#(top-repl)

polychordExceptions = #( append
  ( sequential-music-to-chord-exceptions polychordExceptionMusic #t)
 ignatzekExceptions)

cmJazz = {
  \set chordNameExceptions = #ignatzekExceptions
  \set chordRootNamer = #note-name->markup
}

cmPoly = {
  \set chordNameExceptions = #polychordExceptions
  \set chordRootNamer = #silent-chord-root-namer
}

theMusic = \chordmode {
    \cmPoly
   c1:5.9-.11.13-
   c1:5.9.11+.13
   des1:5.9.11+.13
   fis1:5.9.11+.13
   \cmJazz
   c1:5.9-.11.13-
}

\layout {
  ragged-right = ##t
}

<< \context ChordNames \theMusic
   \context Voice \theMusic








Polychord

2020-11-27 Thread achard

Bonjour.

Voilà ce qu'un utilisateur a écrit pour avoir des polychords.

Mais j'aimerais que l'accord du bas puisse apparaître sous la forme C7 
ou Cm7 ou C maj7.


Je ne suis pas assez expert en Scheme. Si quelqu'un peut m'aider, merci 
d'avance. Bonne journée.


Jean-Pierre Achard


\version "2.14.0"

#(define-markup-command (transposed-chord-root-name layout props a b) 
(number? number?)

  #:properties ((cause #f))
  "Print the root of the chord transposed."
  (interpret-markup layout props
    (markup (note-name->markup
 (ly:pitch-transpose (ly:event-property cause 'pitch) 
(ly:make-pitch 0 a b))

    #f

#(define-markup-command (chord-root-name layout props) ()
  #:properties ((cause #f))
  "Print the root of the chord transposed."
  (interpret-markup layout props
    (markup (note-name->markup (ly:event-property cause 'pitch) #f)
    )))

#(define-public (silent-chord-root-namer pitch lowercase?)
   (markup "")
)

#(define-markup-command (polychord-column layout props args)
 (markup-list?)
  ;#:properties ((direction)
  ;(baseline-skip))

 (let* ((args-length-ls (sort (map (lambda (x)
           (interval-length
              (ly:stencil-extent
             (interpret-markup layout props x)
               X)))
           args)
         >))
   ; baseline-skip is hard-coded!
   ; if you change this don't forget to change 0.65
   ; in: #:translate (cons 0 (* 0.65 baseline-skip))
   (baseline-skip 1.4)
   (ln-mrkp (markup #:translate (cons 0 (* 0.65 baseline-skip))
        #:draw-line (cons (car args-length-ls) 0)))
   (new-args (list (car args) ln-mrkp (cadr args
   ; direction is hard-coded!
 (stack-lines 1 ;(if (number? direction) direction -1)
  0.0
  baseline-skip
  (interpret-markup-list layout props new-args

polychordExceptionMusic = {
  1-\markup { \polychord-column
   { \chord-root-name \transposed-chord-root-name 
#1 #-1/2 } }

  1-\markup { \polychord-column
   { \chord-root-name \transposed-chord-root-name 
#1 #0 } }

}

%#(top-repl)

polychordExceptions = #( append
  ( sequential-music-to-chord-exceptions polychordExceptionMusic #t)
 ignatzekExceptions)

cmJazz = {
  \set chordNameExceptions = #ignatzekExceptions
  \set chordRootNamer = #note-name->markup
}

cmPoly = {
  \set chordNameExceptions = #polychordExceptions
  \set chordRootNamer = #silent-chord-root-namer
}

theMusic = \chordmode {
    \cmPoly
   c1:5.9-.11.13-
   c1:5.9.11+.13
   des1:5.9.11+.13
   fis1:5.9.11+.13
   \cmJazz
   c1:5.9-.11.13-
}

\layout {
  ragged-right = ##t
}

<< \context ChordNames \theMusic
   \context Voice \theMusic







Re: horizontal line separator in column markup (as in fraction or polychord)

2012-02-05 Thread Thomas Morley
Hi,

2012/2/3 Thomas Morley thomasmorle...@googlemail.com:
 Hi,

 2012/2/2 Xavier Scheuer x.sche...@gmail.com:
 On 2 February 2012 22:23, Jean-Alexis Montignies j...@montignies.info 
 wrote:
 Hi,

 I'm trying to write a polychord markup that looks like a mathematical 
 fraction.

 May be I've overlooked something, but I didn't found a way to draw a
 horizontal line between to text lines of a column.
 I'm using:

 \markup {\override #`(direction . ,UP) \dir-column
      { C
        \draw-line #'(3 . 0)
        Db }
 }

 But then I have too many vertical space between Db and the separator
 and I have to hardcode the length of the line.

 Any suggestion?

 Why not simply

  \chords {
    c1:/des
  }

 ?

 Cheers,
 Xavier

 --
 Xavier Scheuer x.sche...@gmail.com

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

 an idea:

 \version 2.14.2

 #(define-markup-command (custom-column layout props args)
  (markup-list?)
   ;#:properties ((direction)
   ;(baseline-skip))

  (let* ((args-length-ls (sort (map (lambda (x)
                        (interval-length
                           (ly:stencil-extent
                              (interpret-markup layout props x)
                            X)))
                        args)
                          ))
        ; baseline-skip is hard-coded!
        ; if you change this don't forget to change 0.65
        ; in: #:translate (cons 0 (* 0.65 baseline-skip))
        (baseline-skip 1.2)
        (ln-mrkp (markup #:translate (cons 0 (* 0.65 baseline-skip))
                         #:draw-line (cons (car args-length-ls) 0)))
        (new-args (list (car args) ln-mrkp (cadr args
        ; direction is hard-coded!
  (stack-lines -1 ;(if (number? direction) direction -1)
               0.0
               baseline-skip
               (interpret-markup-list layout props new-args

 \markup {
        \custom-column { C Db }
        \custom-column { Ees Disis }
        \custom-column { a Whatsever }
 }

 HTH,
  Harm

further testing showed some problems, while changing fontsize and it
was limited to two elements of a markup-list.

I now come up with:

\version 2.14.2

#(define (insert-elt l1 l2 elt)
 Inserts a new element between every element of list l1
  and outputs this as new list l2.
  While starting, l2 is supposed to be '() 
  (set! l2 (reverse (append (list elt (car l1)) l2)))
  (if (= 1 (length (cdr l1)))
(append l2 (last-pair l1))
(insert-elt (cdr l1) (reverse l2) elt)))

#(define-markup-command (dir-column-line layout props direction args)
  (number? markup-list?)
  (let* ((args-length-ls (sort (map (lambda (x)
(interval-length
   (ly:stencil-extent
  (interpret-markup layout props x)
X)))
args)
  ))
 ; baseline-skip is hard-coded!
 (baseline-skip 0.4)
 (ln-mrkp (markup #:draw-line (cons (car args-length-ls) 0)
  #:vcenter
  #:vspace 0.2))
 (new-args (insert-elt args '() ln-mrkp)))
  (stack-lines (if (number? direction) direction -1)
   0.0
   baseline-skip
   (interpret-markup-list layout props new-args

%--- test

text¹ = \markup {
\dir-column-line #-1 {
\bold /dir-column-line #-1:
stacking down
elements
with
\fontsize #2 arbitrary
number
of
entities.
}
}

text² = \markup \fontsize #-4 {
\dir-column-line #1 {
\line { 1 reverse order! }
\line { 2 in }
\line { 3 stacked up }
\line { 4 are }
\line { 5 elements }
\line { 6 \italic various }
\line { \bold /dir-column-line #1 }
}
}

text³ = \markup \fontsize #4 {
\dir-column-line #-1 {
\fontsize #3 \bold Example:
This
is a
clef
\concat { \musicglyph #clefs.G , }
a
\with-color #red treble-clef.
}
}

%{
\markup {
\fill-line {
\null
\text¹
\text²
\text³
\null
}
}

\markup \vspace #4
%}

\relative c' {
\textLengthOn
c1^\text¹
d^\text²
e^\text³
%c1_\text¹
%d_\text²
%e_\text³
}



It's now possible to use an arbitrary number of elements.
The direction isn't hard-coded, so you

horizontal line separator in column markup (as in fraction or polychord)

2012-02-02 Thread Jean-Alexis Montignies
Hi,

I'm trying to write a polychord markup that looks like a mathematical fraction.

May be I've overlooked something, but I didn't found a way to draw a horizontal 
line between to text lines of a column.
I'm using:

\markup {\override #`(direction . ,UP) \dir-column 
  { C
\draw-line #'(3 . 0)
Db }
}

But then I have too many vertical space between Db and the separator and I have 
to hardcode the length of the line.

Any suggestion?

Thanks


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


Re: horizontal line separator in column markup (as in fraction or polychord)

2012-02-02 Thread Xavier Scheuer
On 2 February 2012 22:23, Jean-Alexis Montignies j...@montignies.info wrote:
 Hi,

 I'm trying to write a polychord markup that looks like a mathematical 
 fraction.

 May be I've overlooked something, but I didn't found a way to draw a
 horizontal line between to text lines of a column.
 I'm using:

 \markup {\override #`(direction . ,UP) \dir-column
  { C
\draw-line #'(3 . 0)
Db }
 }

 But then I have too many vertical space between Db and the separator
 and I have to hardcode the length of the line.

 Any suggestion?

Why not simply

  \chords {
c1:/des
  }

?

Cheers,
Xavier

-- 
Xavier Scheuer x.sche...@gmail.com

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


Re: horizontal line separator in column markup (as in fraction or polychord)

2012-02-02 Thread Thomas Morley
Hi,

2012/2/2 Xavier Scheuer x.sche...@gmail.com:
 On 2 February 2012 22:23, Jean-Alexis Montignies j...@montignies.info wrote:
 Hi,

 I'm trying to write a polychord markup that looks like a mathematical 
 fraction.

 May be I've overlooked something, but I didn't found a way to draw a
 horizontal line between to text lines of a column.
 I'm using:

 \markup {\override #`(direction . ,UP) \dir-column
      { C
        \draw-line #'(3 . 0)
        Db }
 }

 But then I have too many vertical space between Db and the separator
 and I have to hardcode the length of the line.

 Any suggestion?

 Why not simply

  \chords {
    c1:/des
  }

 ?

 Cheers,
 Xavier

 --
 Xavier Scheuer x.sche...@gmail.com

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

an idea:

\version 2.14.2

#(define-markup-command (custom-column layout props args)
  (markup-list?)
   ;#:properties ((direction)
   ;(baseline-skip))

  (let* ((args-length-ls (sort (map (lambda (x)
(interval-length
   (ly:stencil-extent
  (interpret-markup layout props x)
X)))
args)
  ))
; baseline-skip is hard-coded!
; if you change this don't forget to change 0.65
; in: #:translate (cons 0 (* 0.65 baseline-skip))
(baseline-skip 1.2)
(ln-mrkp (markup #:translate (cons 0 (* 0.65 baseline-skip))
 #:draw-line (cons (car args-length-ls) 0)))
(new-args (list (car args) ln-mrkp (cadr args
; direction is hard-coded!
  (stack-lines -1 ;(if (number? direction) direction -1)
   0.0
   baseline-skip
   (interpret-markup-list layout props new-args

\markup {
\custom-column { C Db }
\custom-column { Ees Disis }
\custom-column { a Whatsever }
}

HTH,
  Harm
attachment: atest-09.png___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user