Re: String Concatenation, and Use of Unicode characters

2015-03-02 Thread Michael Hendry
Begin forwarded message:From: Michael Hendry hendry.mich...@gmail.comSubject: Re: String Concatenation, and Use of Unicode charactersDate: 2 March 2015 22:16:34 GMTTo: thomasmorle...@gmail.comBrilliant!My only reservation is that I’ll have to treat your code as a black box, as I’m not (likely ever to be) up to speed in Scheme!I use Frescobaldi as a front-end to LilyPond, and find the Music View that presents the PDF files very helpful in picking up errors as I type. For some reason I haven’t been able to work out, this doesn’t happen with your code.I’ve attached the include files I use, in case they’re of interest.Many thanks,Michael

Generic.ly
Description: Binary data


LilyJAZZ.ily
Description: Binary data


AccordsJazzDefs.ly
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: String Concatenation, and Use of Unicode characters

2015-03-02 Thread Thomas Morley
2015-03-02 17:40 GMT+01:00 Michael Hendry hendry.mich...@gmail.com:
 I’m an amateur jazz guitarist, and although I usually play from Realbook 
 leadsheets I occasionally need to produce my own.

 Typically, I want PDF output in three files, (Concert pitch, Bb and Eb), and 
 I would like to modularise this as much as possible.

 The .ly code which follows shows what I’m trying to do, but there are a 
 couple of problems I would like help with.

 1. I’d like to define a variable (\BaseFileName) which is the name of the 
 song, and have this variable picked up for the title in the header, and when 
 I’m creating the three PDF files with the relevant instrument names appended.

 e.g. Generic (guitar).pdf”, “Generic (trumpet).pdf” and “Generic (alto).pdf”.


 2. The LilyJazzText font uses small capitals instead of lower case letters, 
 so using “Eb” produces a capital E followed by a small capital B. On my Mac I 
 know how to produce a flat sign, and LilyPond will use the flat sign from 
 another font, but I’d like to be able to define a flat sign as a variable, 
 and append it to the piece markup when creating the books for trumpet and 
 alto.

 Thanks in advance,

 Michael Hendry


 

 \version 2.18.0

 \include LilyJAZZ.ily
 \include AccordsJazzDefs.ly

 BaseFileName = Generic
 FlatSign = 

 \header {
   title =   \markup {\fontsize #3   \override #'(font-name . 
 LilyJAZZText) Generic }
 }

 TheHead =  \relative c' {
   \set Score.markFormatter = #format-mark-box-letters
   \clef treble \key c \major \numericTimeSignature \time 4/4
  {c d e f}

 }

 TheChords =  \chords {
 c1
 }

 % I’d like the code from here on to be generic, and produce concert, Bb and 
 Eb versions from the variables defined above.

 \book {

   \bookOutputName  Generic (guitar)” % I WANT TO CONSTRUCT THIS STRING BY 
 APPENDING “ (guitar)” to BaseFileName
   \new Score
   
 \transpose c c {\TheChords}
 \new Staff
 \jazzOn \transpose c c {\TheHead}
   
   \header {piece = \markup {\fontsize #-1 \override #'(font-name . 
 LilyJazzText) Guitar}}
 }

 \book {
   \bookOutputName Generic (tpt)” % I WANT TO CONSTRUCT THIS STRING BY 
 APPENDING “ (tpt)” to BaseFileName
   \new Score
   
 \transpose c d' {\TheChords}
 \new Staff
 \jazzOn \transpose c d' {\TheHead}
   
   \header {piece = \markup {\fontsize #-1 \override #'(font-name . 
 LilyJazzText) Trumpet in Bb”}} % I WANT TO USE VARIABLE FOR FLAT SIGN 
 HERE...
 }


 \book {
   \bookOutputName Generic (alto)” % I WANT TO CONSTRUCT THIS STRING BY 
 APPENDING “ (alto)” to BaseFileName
   \new Score
   
 \transpose c a {\TheChords}
 \new Staff \jazzOn \transpose c a {\TheHead}
   
   \header {piece = \markup {\fontsize #-1 \override #'(font-name . 
 LilyJazzText) Alto Sax in Eb”}} % …AND AGAIN HERE



How about the quite generic code below?
nb %%uncomment


\version 2.18.0

%% uncomment
%
%\include LilyJAZZ.ily
%\include AccordsJazzDefs.ly
%
BaseFileName = Generic

FlatSign =
  \markup {
\hspace #0.1
\raise #0.4
\fontsize #-3
\flat
  }

\header {
  title =
\markup {
  \fontsize #3
  \override #'(font-name . LilyJAZZText)
  \BaseFileName
}
}

TheHead =  \relative c' {
  \set Score.markFormatter = #format-mark-box-letters
  \clef treble \key c \major \numericTimeSignature \time 4/4
  c d e f

}

TheChords = \chords {
  c1
}

#(define (scores instruments pitches)
   (map
 (lambda (p n)
 #{
   \score {
  
\new ChordNames
\transpose c $p \TheChords
\new Staff
%% uncomment:
%\jazzOn
\transpose c $p \TheHead
  
  \header {
piece =
  \markup {
\fontsize #-1 \override #'(font-name . LilyJazzText) $n
  }
  }
  %% for testing:
  %\layout { \override ChordNames.ChordName.color = #red }
   }
 #})
 (event-chord-pitches pitches)
 (map
   (lambda (i)
 (let ((instr (string-split i #\tab)))
 (if (string-null? (last instr))
 #{ \markup $(car instr) #}
 #{ \markup \concat { $(car instr) \FlatSign } #})))
   instruments)))

writebooks =
#(define-void-function (parser location instr-nms pitches) (list? ly:music?)
 (let* ((instrument-names
  (map
(lambda (i)
  (car (string-split i #\tab)))
instr-nms))
(file-names
  (map
(lambda (i)
  (let ((instr (string-split i #\Space)))
  (format #f ~a (~a) BaseFileName (string-downcase (car instr)
instrument-names)))
 (for-each
   (lambda (score name)
 (let* ((my-new-book
  (ly:make-book
$defaultpaper
$defaultheader
score)))
   (ly:score-set-header! score (ly:score-header score))
   

Re: String Concatenation, and Use of Unicode characters

2015-03-02 Thread Klaus Blum
Hi Michael, 

for your second issue, this might be helpful:
\concat { Alto Sax in E \fontsize #-5 \raise #0.9 \musicglyph
#accidentals.flat }

Could you provide your source file and also the include files as a download
or attachment? I tried to copy-paste from your post, but some signs got
messed up...

Cheers, 
Klaus



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/String-Concatenation-and-Use-of-Unicode-characters-tp172504p172505.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: String Concatenation, and Use of Unicode characters

2015-03-02 Thread H. S. Teoh
On Mon, Mar 02, 2015 at 04:40:27PM +, Michael Hendry wrote:
[...]
 2. The LilyJazzText font uses small capitals instead of lower case
 letters, so using “Eb” produces a capital E followed by a small
 capital B. On my Mac I know how to produce a flat sign, and LilyPond
 will use the flat sign from another font, but I’d like to be able to
 define a flat sign as a variable, and append it to the piece markup
 when creating the books for trumpet and alto.
[...]

Couldn't you just use \flat to get the flat sign from the Feta font? Or
do you want to substitute that with a lowercase 'b' in some cases?


T

-- 
Кто везде - тот нигде.

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


Re: String Concatenation, and Use of Unicode characters

2015-03-02 Thread Klaus Blum
Hi again, 

for your first issue, try:

\bookOutputName  #(string-append BaseFileName  (alto))


hope this helps, 
Klaus




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/String-Concatenation-and-Use-of-Unicode-characters-tp172504p172508.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