Re: Guitar Fret Diagram - scale degree below string

2015-08-18 Thread Thomas Morley
2015-08-18 2:05 GMT+02:00 Klaus Blum benbigno...@gmx.de:
 Hi Harm,

 your code allows using markup where only numbers are allowed - exacly what I
 was looking for.
 Thanks a lot for this great discovery. It allows abusing LilyPond's
 \fret-diagram-verbose for crazy things like this:
 http://lilypond.1069038.n5.nabble.com/file/n179739/Zwischenablage01.png

Well, I worked repeatedly on fret-diagrams.scm in the last months, but
putting in text instead of fingers into fret-diagram-verbose is an
_old_ feature.
One of my patches deleted it, because it was never documented.
Now it is, see:
http://www.lilypond.org/doc/v2.19/Documentation/notation/common-notation-for-fretted-strings#fret-diagram-markups
Although, the image where a markup is inserted is small.
May be better in the regtests:
http://lilypond.org/doc/v2.19/input/regression/4a/lily-c37633ca.png

Btw, your code would have compiled with 2.16.2 (I tested it with this version)
But nowadays the scaling is better.
That's all I could get the credits for ;)

Best,
  Harm

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


Re: Guitar Fret Diagram - scale degree below string

2015-08-16 Thread Klaus Blum
Hi tone, 

welcome to the forum!  :-)

The most elegant solution would be to take fret-diagrams.scm and use it to
build a modified fretboard command that accepts markup for fingerings. But
as I'm not an expert, this is out of reach for me.

Anyway, I've played around with explicit positioning of markups. The code
may be a horrible mess, but at least it is a function that's (more or less)
easy to use. 
I hope this helps.

Cheers, 
Klaus

%

% Chord Chart.
% Want to add scale degree below strings.
% Example:  below the Db7#5#9 diagram there should be:
%   3 b7 #9 #5 (without the quotes).
\version 2.19.15
\pointAndClickOff
%
% the following two functions are borrowed from:
% http://lsr.di.unimi.it/LSR/Item?id=628
#(define-public (stack-stencil-overlay stencils)
   Recursive function to add stencils together
   (if (and (pair? stencils)
(ly:stencil? (car stencils)))
   (if (and (pair? (cdr stencils))
(ly:stencil? (cadr stencils)))
   (let ((tail (stack-stencil-overlay (cdr stencils)))
 (head (car stencils)))
 (ly:stencil-add head tail))
   (car stencils))
   point-stencil))

#(define-markup-command (overlay layout props args)
   (markup-list?)
   Overlay arguments one on top of the next
   (let ((stencils (interpret-markup-list layout props args)))
 (stack-stencil-overlay
  (remove ly:stencil-empty? stencils

#(define-markup-command (custom-fret layout props control six five four
three two one)
   (string? markup? markup? markup? markup? markup? markup?)
   (interpret-markup layout props
 #{
   \markup {
 \override #'(size . 1.5)
 \left-column {
   \fret-diagram-terse $control
   \fontsize #-8
   \sans
   \overlay {
 % find the following values by trial-and-error:
 \translate #'(-0.1 . 0) \center-align \transparent .
 \translate #'(0.2 . 0) \center-align $six
 \translate #'(1.7 . 0) \center-align $five
 \translate #'(3.2 . 0) \center-align $four
 \translate #'(4.7 . 0) \center-align $three
 \translate #'(6.2 . 0) \center-align $two
 \translate #'(7.7 . 0) \center-align $one
   }
 }
   }
 #}))

#(define-markup-command (with-flat layout props text)
   (markup?)
   (interpret-markup layout props
 #{
   \markup \concat {\raise #0.2 \flat $text }
 #}))

#(define-markup-command (with-sharp layout props text)
   (markup?)
   (interpret-markup layout props
 #{
   \markup \concat {\raise #0.4 \sharp $text }
 #}))

\score {
  
\chords {
  %{ B13sus4 %} b:13sus4
  %{ Db7#5#9 %} des:7.5+.9+
}
%
\new Lyrics \lyricmode{
  %{ B13sus4 %} \markup { \override #'(size . 1.5) \fret-diagram-terse
#7;x;7;9;9;x;}
  %{ Db7#5#9 %} \markup { \custom-fret #x;8;9;9;10;x;   3
\with-flat 7 \with-sharp 9 \with-sharp 5  }
}
%
\chordmode {
  \clef treble_8
  \override Staff.TimeSignature #'stencil = ##f
  %{ B13sus4 %} b, a e' aes'
  %{ Db7#5#9 %} f b e' a'
}
%
  
  \layout {
\context {
  \Lyrics
  \override LyricSpace #'minimum-distance = #1.5
  \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
  \override LyricText #'self-alignment-X = #CENTER
}
%
\context {
  \ChordNames
  \override ChordName #'font-size = #1
  \override ChordName #'self-alignment-X = #CENTER
  \override ChordName #'X-offset =
#ly:self-alignment-interface::aligned-on-x-parent
}
  }
}
%




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-tp179664p179693.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Guitar Fret Diagram - scale degree below string

2015-08-16 Thread tone
Thanks!  That does exactly what I want.  I will paste this into my existing
chord charts.

Anybody have a simpler solution?



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-tp179664p179696.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Guitar Fret Diagram - scale degree below string

2015-08-16 Thread Thomas Morley
2015-08-16 16:34 GMT+02:00 Klaus Blum benbigno...@gmx.de:
 Hi tone,

 welcome to the forum!  :-)

 The most elegant solution would be to take fret-diagrams.scm and use it to
 build a modified fretboard command that accepts markup for fingerings. But
 as I'm not an expert, this is out of reach for me.

 Anyway, I've played around with explicit positioning of markups. The code
 may be a horrible mess, but at least it is a function that's (more or less)
 easy to use.
 I hope this helps.

 Cheers,
 Klaus

 %
 
 % Chord Chart.
 % Want to add scale degree below strings.
 % Example:  below the Db7#5#9 diagram there should be:
 %   3 b7 #9 #5 (without the quotes).
[...]

 #(define-markup-command (with-flat layout props text)
(markup?)
(interpret-markup layout props
  #{
\markup \concat {\raise #0.2 \flat $text }
  #}))

 #(define-markup-command (with-sharp layout props text)
(markup?)
(interpret-markup layout props
  #{
\markup \concat {\raise #0.4 \sharp $text }
  #}))


How about the code below, using fret-diagram-verbose and slightly
modifying \with-flat and \with-sharp already offered by Klaus.
It's not fully automated but will scale better fo different sizes.
I'm not sure, if a fully automated way is possible...

\version 2.19.25

#(define-markup-command (with-flat layout props text)
   (markup?)
   (interpret-markup layout props
 #{
   \markup \concat { \raise #0.1 \fontsize #-3 \flat $text }
 #}))

#(define-markup-command (with-sharp layout props text)
   (markup?)
   (interpret-markup layout props
 #{
   \markup \concat { \raise #0.3 \fontsize #-5 \sharp $text }
 #}))

%% note the ` (don't use ') and the ,
b:13sus4 =
\markup {
  \fret-diagram-verbose #`(
(place-fret 6 7 ,#{ \markup \fontsize #-4 1 #})
(mute 5)
(place-fret 4 7 ,#{ \markup \fontsize #-4 \with-flat 7 #} )
(place-fret 3 9 ,#{ \markup \fontsize #-4 4 #})
(place-fret 2 9 ,#{ \markup \fontsize #-4 13 #})
(mute 1)
  )
}

des:7.5+.9+ =
\markup {
  \fret-diagram-verbose #`(
(mute 6)
(place-fret 5 7 ,#{ \markup \fontsize #-4 3 #})
(place-fret 4 8 ,#{ \markup \fontsize #-4 \with-flat 7 #})
(place-fret 3 8 ,#{ \markup \fontsize #-4 \with-sharp 9 #})
(place-fret 2 9 ,#{ \markup \fontsize #-4 \with-sharp 5 #})
(mute 1)
  )
}

chrds =
\chordmode {
  b:13sus4
  des:7.5+.9+
}

m =
\chordmode {
  \clef treble_8
  b, a e' aes'4
  f b e' a' }

fd = {
  s4^\b:13sus4
  s^\des:7.5+.9+
}

\layout {
  \context {
\ChordNames
\override ChordName #'font-size = #-2
\override ChordName #'self-alignment-X = #CENTER
\override ChordName #'X-offset =
  #ly:self-alignment-interface::aligned-on-x-parent
  }
  \context {
\Staff
\override TimeSignature #'stencil = ##f
%% 'in-dot is possible as well:
\override TextScript.fret-diagram-details.finger-code = #'below-string
\override TextScript.padding = #4
  }
}


  \new ChordNames \chrds
  \new Staff
 \fd \m 



HTH,
  Harm

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


Re: Guitar Fret Diagram - scale degree below string

2015-08-16 Thread Klaus Blum
Hi Tone, 


tone wrote
 How can I add more space between the bottom of the strings (fret diagram)
 and the scale degrees? 

the function produces a column: fret-diagram and the overlay stuff are
stacked on top of each other. 
Between them, you can insert empty vertical space by \vspace:

%

#(define-markup-command (custom-fret layout props control six five four
three two one)
   (string? markup? markup? markup? markup? markup? markup?)
   (interpret-markup layout props
 #{
   \markup {
   \override #'(size . 1.5) {
   \override #'(fret-diagram-details . (
(number-type . arabic)
(fret-label-vertical-offset . -0.2)
(fret-label-horizontal-offset . -0.3)
(top-fret-thickness . 4)))
   \left-column {
   \fret-diagram-terse $control
   \vspace #0.1  % experiment with that value
   \fontsize #-7
   \sans
   \overlay {
 % find the following values by trial-and-error:
 \translate #'(-0.1 . 0) \center-align \transparent .
 \translate #'(0.2 . 0) \center-align $six
 \translate #'(1.7 . 0) \center-align $five
 \translate #'(3.2 . 0) \center-align $four
 \translate #'(4.7 . 0) \center-align $three
 \translate #'(6.2 . 0) \center-align $two
 \translate #'(7.7 . 0) \center-align $one
   }
 }
   }}
 #}))
%


Cheers, 
Klaus




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-tp179664p179707.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Guitar Fret Diagram - scale degree below string

2015-08-16 Thread tone
How can I add more space between the bottom of the strings (fret diagram) and
the scale degrees?  When there are not any /accidentals/, the numbers are
too close to the strings.



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-tp179664p179703.html
Sent from the User mailing list archive at Nabble.com.

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


Guitar Fret Diagram - scale degree below string

2015-08-15 Thread tone
I would like to include the scale degree below each string in a fret diagram. 
For example, below the strings on the fret diagram for B13sus4 (at the 7th
fret) I would like to print 1 b7 4 13 (without the quotes).  (Would also
be nice to use the custom symbol for flat, rather than lowercase b.)

Lilypond only allows one to specify a simple finger-code under
fret-diagram-details.

I am looking for the simplest solution, not necessarily the most efficient. 
I have scoured the web, and have not found a satisfying method to achieve
this.  Any help is appreciated.  Below is a minimal working example.

--
% Chord Chart.
% Want to add scale degree below strings.
% Example:  below the Db7#5#9 diagram there should be:  3 b7 #9 #5
(without the quotes).
%
\version 2.19.15
\pointAndClickOff
%
\score { 
\chords {
%{ B13sus4 %}   b:13sus4
%{ Db7#5#9 %}   des:7.5+.9+
}
%
\new Lyrics \lyricmode{
%{ B13sus4 %}   \markup{ \override #'(size . 1.5) \fret-diagram-terse
#7;x;7;9;9;x;}
%{ Db7#5#9 %}   \markup{ \override #'(size . 1.5) \fret-diagram-terse
#x;8;9;9;10;x;}
}
%
\chordmode {\clef treble_8 \override Staff.TimeSignature #'stencil = ##f
%{ B13sus4 %}b, a e' aes'
%{ Db7#5#9 %}f b e' a' }
%
 
\layout {
 \context { \Lyrics
 \override LyricSpace #'minimum-distance = #1.5
 \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
 \override LyricText #'self-alignment-X = #CENTER }
%
 \context { \ChordNames
 \override ChordName #'font-size = #1
 \override ChordName #'self-alignment-X = #CENTER
 \override ChordName #'X-offset =
#ly:self-alignment-interface::aligned-on-x-parent } }
}

ly:   ScaleDegree.ly
http://lilypond.1069038.n5.nabble.com/file/n179664/ScaleDegree.ly  
pdf:   ScaleDegree.pdf
http://lilypond.1069038.n5.nabble.com/file/n179664/ScaleDegree.pdf  



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-tp179664.html
Sent from the User mailing list archive at Nabble.com.

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