Re: Scheme function to return pitchnames as markup/text

2019-11-19 Thread Jacques Menu
Hello Steve,

Maybe starting this way:

\version "2.19.83"

{
  % initial shared music
  c'1 e |

  % the two alternatives
  \override Staff.StaffSymbol.line-count = 0
  \stopStaff \startStaff
  \hide Staff.BarLine
  <<
\new Staff {
  \hide Staff.Clef
  \hide Staff.KeySignature
  \hide Staff.TimeSignature
  d' a' d'' |
}
\new Staff {
  \hide Staff.Clef
  \hide Staff.KeySignature
  \hide Staff.TimeSignature
  g' b' e'' |
}
  >>
  \override Staff.StaffSymbol.line-count = 5
  \stopStaff \startStaff
  \undo\hide Staff.BarLine

  % next shared music
  ais' bes' |
}



and then force a barline at the end of measure 2, move the two alternative 
staves fragments higher, and remove the dangling lines at the left of the two 
alternatives?

JM

> Le 19 nov. 2019 à 02:23, Steve Cummings  a écrit :
> 
> Though I remain baffled by Scheme and its use in LilyPond, my hope is to 
> build one or more functions/procedures that would transpose input music and 
> for each chord display the transposed chord's note names, with control over 
> the way the names are represented (as in Cb or F# instead of ces and fis). 
> 
> Here, I'm just asking for help with one part of the function-to-be: how to 
> turn notes in LilyPond music into note names as text (schematic of the 
> complete imagined function below).
> 
> Here's what I've tried so far, in LilyPond 2.19.8x, based closely on working 
> procedures found on this list. Once this is running right for single notes 
> I'll (hope to) get it to loop through all input music. 
> 
> #(define-scheme-function
> (pitchin)
> (ly:music?)
> (let* (
> (note-datum (car (ly:music-property pitchin 'elements)))
> (pitch-datum (ly:music-property note-datum 'pitch))
> (out-notename (ly:pitch-notename pitch-datum)))  
> #{  \markup 
> \bold 
> $out-notename 
> #}   
> ))
> I get "syntax error, unexpected NUMBER_IDENTIFIER" on the $out-notename line 
> when calling notenamer with a note wrapped in braces, as in:
> 
> \notenamer {a}
> 
> Without the braces around the music,  the error is "In procedure car in 
> expression (car (ly:music-property pitchin #)): Wrong type (expecting pair): 
> () 
> 
> Results are the same if I do "define-music-function" instead of 
> "define-scheme-function." 
> 
> Many thanks for your attention and help,
> Steve
> 
> PS: I have a working NoteNames reformatter but it seems to require listing in 
> a substitution table the specific notes of each and every chord in each 
> transposition. A custom function would allow display of the chord note names 
> in a columnar stack so if these markups were used as text scripts they 
> wouldn't either take too much space or collide with the names of adjacent 
> notes. Alternatively, chord note names could be placed beneath ChordNames.
> 



Re: Scheme function to return pitchnames as markup/text

2019-11-19 Thread Jacques Menu
Oups, answered the wrong post, sorry…

JM

> Le 19 nov. 2019 à 09:43, Jacques Menu  a écrit :
> 
> Hello Steve,
> 
> Maybe starting this way:
> 
> \version "2.19.83"
> 
> {
>   % initial shared music
>   c'1 e |
> 
>   % the two alternatives
>   \override Staff.StaffSymbol.line-count = 0
>   \stopStaff \startStaff
>   \hide Staff.BarLine
>   <<
> \new Staff {
>   \hide Staff.Clef
>   \hide Staff.KeySignature
>   \hide Staff.TimeSignature
>   d' a' d'' |
> }
> \new Staff {
>   \hide Staff.Clef
>   \hide Staff.KeySignature
>   \hide Staff.TimeSignature
>   g' b' e'' |
> }
>   >>
>   \override Staff.StaffSymbol.line-count = 5
>   \stopStaff \startStaff
>   \undo\hide Staff.BarLine
> 
>   % next shared music
>   ais' bes' |
> }
> 
> 
> 
> and then force a barline at the end of measure 2, move the two alternative 
> staves fragments higher, and remove the dangling lines at the left of the two 
> alternatives?
> 
> JM
> 
>> Le 19 nov. 2019 à 02:23, Steve Cummings > > a écrit :
>> 
>> Though I remain baffled by Scheme and its use in LilyPond, my hope is to 
>> build one or more functions/procedures that would transpose input music and 
>> for each chord display the transposed chord's note names, with control over 
>> the way the names are represented (as in Cb or F# instead of ces and fis). 
>> 
>> Here, I'm just asking for help with one part of the function-to-be: how to 
>> turn notes in LilyPond music into note names as text (schematic of the 
>> complete imagined function below).
>> 
>> Here's what I've tried so far, in LilyPond 2.19.8x, based closely on working 
>> procedures found on this list. Once this is running right for single notes 
>> I'll (hope to) get it to loop through all input music. 
>> 
>> #(define-scheme-function
>> (pitchin)
>> (ly:music?)
>> (let* (
>> (note-datum (car (ly:music-property pitchin 'elements)))
>> (pitch-datum (ly:music-property note-datum 'pitch))
>> (out-notename (ly:pitch-notename pitch-datum)))  
>> #{  \markup 
>> \bold 
>> $out-notename 
>> #}   
>> ))
>> I get "syntax error, unexpected NUMBER_IDENTIFIER" on the $out-notename line 
>> when calling notenamer with a note wrapped in braces, as in:
>> 
>> \notenamer {a}
>> 
>> Without the braces around the music,  the error is "In procedure car in 
>> expression (car (ly:music-property pitchin #)): Wrong type (expecting pair): 
>> () 
>> 
>> Results are the same if I do "define-music-function" instead of 
>> "define-scheme-function." 
>> 
>> Many thanks for your attention and help,
>> Steve
>> 
>> PS: I have a working NoteNames reformatter but it seems to require listing 
>> in a substitution table the specific notes of each and every chord in each 
>> transposition. A custom function would allow display of the chord note names 
>> in a columnar stack so if these markups were used as text scripts they 
>> wouldn't either take too much space or collide with the names of adjacent 
>> notes. Alternatively, chord note names could be placed beneath ChordNames.
>> 
> 



Re: Choises

2019-11-19 Thread Jacques Menu
Hello Yoann,

Maybe starting this way:

\version "2.19.83"

{
  % initial shared music
  c'1 e |

  % the two alternatives
  \override Staff.StaffSymbol.line-count = 0
  \stopStaff \startStaff
  \hide Staff.BarLine
  <<
\new Staff {
  \hide Staff.Clef
  \hide Staff.KeySignature
  \hide Staff.TimeSignature
  d' a' d'' |
}
\new Staff {
  \hide Staff.Clef
  \hide Staff.KeySignature
  \hide Staff.TimeSignature
  g' b' e'' |
}
  >>
  \override Staff.StaffSymbol.line-count = 5
  \stopStaff \startStaff
  \undo\hide Staff.BarLine

  % next shared music
  ais' bes' |
}



and then force a barline at the end of measure 2, move the two alternative 
staves fragments higher, and remove the dangling lines at the left of the two 
alternatives?

JM

> Le 19 nov. 2019 à 03:45, Yoann LE BARS  a écrit :
> 
> 
> Hello everybody out there!
> 
>   I must write a score for several instruments. In this score, interprets
> must several times choose between two alternatives. To symbolize these
> choices, the staff is split in two, every staff being linked to the
> other with an opening angle bracket (“<”). At the beginning of a new
> line, staffs are also linked with an angle opening bracket. The end of
> alternative is symbolized with a closing angle bracket (“>”). I have
> created a hand-made example (without notes) you can see here:
> 
> https://cloud.le-bars.net/index.php/s/zIIqGlcSa3XCdi4
> 
>   I am quite certain it can be done with Lilypond, but I do not have a
> clue how to do it. Therefore, I have prepared some code available here:
> 
> http://lilybin.com/tjc9ai/3
> 
>   I have also copied this code at the end of this message.
> 
>   There are two instruments in this example, a flute and a clarinet
> (clarinet is written in French, i.e. “clarinette”, in variable names).
> For this two instruments, there is four section A, B, C and D. In
> section B and C, they have two choices: Ba and Bb as well as Ca and Cb.
> Therefore, fluteBa must be superposed over fluteBb, as well as fluteCa
> over fluteCb, clarinetteBa over clarinetteBb and clarinetteCa over
> clarinetteCb in the way presented in my hand-made example.
> 
>   Well, I hope this is understandable. Does anyone have an idea how to do
> this?
> 
>   Best regards.
> 
> \version "2.18.2"
> 
> #(define (chiffr-triche grob)
>   (grob-interpret-markup grob
>  (markup #:override '(baseline-skip . 0)
>(#:line ((#:center-column (#:number "9" #:number "8")))
> 
> \paper {
>  indent = 3\cm
>  short-indent = 1.5\cm
> }
> 
> \layout {
>  \context {
>\Score
>\remove "Timing_translator"
>\remove "Default_bar_line_engraver"
>  }
>  \context {
>\Staff \RemoveEmptyStaves
>\consists "Timing_translator"
>\consists "Default_bar_line_engraver"
>  }
> }
> 
> fluteA = {
>  \time 4/4
>  \relative c' {
>\repeat unfold 12 {c8 d e f}
>  }
> }
> 
> fluteBa = {
>  \bar "||"
>  \once \override Staff.TimeSignature.stencil = #chiffr-triche
>  \time 3/4
>  \relative c' {
>\repeat unfold 12 {c8*2/3[d e]}
>  }
> }
> 
> fluteBb = {
>  \bar "||"
>  \once \override Staff.TimeSignature.stencil = #chiffr-triche
>  \time 3/4
>  \relative c' {
>\repeat unfold 12 {e8*2/3[d c]}
>  }
> }
> 
> fluteCa = {
>  \bar "||"
>  \time 4/4
>  \relative c' {
>\repeat unfold 12 {c8 d e f}
>  }
> }
> 
> fluteCb = {
>  \bar "||"
>  \time 4/4
>  \relative c' {
>%f8 e d c \bar "" \break
>\repeat unfold 12 {f8 e d c}
>  }
> }
> 
> fluteD = {
>  \relative c' {
>c8 d e f e d c4~ c1 \bar "|."
>  }
> }
> 
> clarinetteA = {
>  \time 4/4
>  \relative c' {
>\repeat unfold 16 {e8 f g a}
>  }
> }
> 
> clarinetteBa = {
>  \bar "||"
>  \once \override Staff.TimeSignature.stencil = #chiffr-triche
>  \time 3/4
>  \relative c' {
>e8*2/3[f g] \bar "" \break
>\repeat unfold 11 {e[f g]}
>  }
> }
> 
> clarinetteBb = {
>  \bar "||"
>  \once \override Staff.TimeSignature.stencil = #chiffr-triche
>  \time 3/4
>  \relative c' {
>g'8*2/3[f e] \bar "" \break
>\repeat unfold 11 {g[f e]}
>  }
> }
> 
> clarinetteCa = {
>  \bar "||"
>  \time 4/4
>  \relative c' {
>\repeat unfold 8 {a'8 g f e}
>  }
> }
> 
> clarinetteCb = {
>  \bar "||"
>  \time 4/4
>  \relative c' {
>\repeat unfold 8 {e8 f g a}
>  }
> }
> 
> clarinetteD = {
>  \relative c' {
>f8 g a b a g f4~ f1 \bar "|."
>  }
> }
> 
> \score {
>  <<
>\accidentalStyle Score.modern-cautionary
>\new Staff \with {
>instrumentName = #"Flûte"
>shortInstrumentName = #"Fl."
>  }
>  {
>\fluteA
>\fluteBa
>\fluteCa
>\fluteD
>  }
> 
>\new Staff \with {
>  instrumentName = \markup {\concat {"Clarinette en Si" \flat}}
>  shortInstrumentName = \markup {\concat {"Clar. Si" \flat}}
>}
>{
>  \clarinetteA
>  \clarinetteBa
>  \clarinetteCa
>  \clarinetteD
>}
>>> 
> }
> 
> -- 
> Yoann LE BARS
> http://le-bars.net/yoann/
> Diaspora* : yleb...@framasphere.o

DynamicText.font-size

2019-11-19 Thread Andrew Bernard
In my scores, when I use make-dynamic script as per the MWE here,
setting DynamicText.font-size in Score context affects normal dynamic
marks but not scripts. Is this a limitation, or my error?

Andrew

%
\version "2.19.83"

fpocoText = \markup {
  \center-align \line {
\hspace #0.1 f \normal-text \italic (poco)
  }
}
fpoco = #(make-dynamic-script fpocoText)

ppecrescText = \markup {
  \normal-text \italic \whiteout "pp e cresc ..."
}
ppecresc = \tweak DynamicText.self-alignment-X #LEFT
\tweak DynamicText.extra-spacing-width #'(+inf.0 . -inf.0)
#(make-dynamic-script ppecrescText)

treble = {
  c''4^\f c''_\p c'' c'' c'' c''^\fpoco c''
  c'' c''^\ppecresc
}

\score {
  \new Staff { \treble }

  \layout {
\context {
  \Score
  \override DynamicText.font-size = #-2
}
  }
}


%



Re: DynamicText.font-size

2019-11-19 Thread Andrew Bernard
Ah, well I guess reading the NR Section New Dynamic Marks explains
this. Perhaps I am hoping for too much from the \override
DynamicText.font-size command.

Andrew



Warning when defining variables on the command line

2019-11-19 Thread Matt Wallis
I want to pass the subtitle into lilypond on the command line because it 
is also required by other programmes (e.g. sox needs the subtitle to 
create a tag for the mp3 it creates).


Looking at 
http://lilypond.org/doc/v2.19/Documentation/usage/command_002dline-usage#basic-command-line-options-for-lilypond, 
I see I can use


lilypond -e '(define-public subtitle "One Two Three")'

and that I need to include in the .ly file:

#(use-modules (guile-user))

This works, with a header block like this:

header { subtitle = \subtitle }

But I now get the warning:

Parsing...WARNING: #f: imported module (guile-user) overrides core 
binding `%module-public-interface'


Should I be concerned? Is it safe to ignore? Can I suppress this warning?

(Question already asked: 
http://lilypond.1069038.n5.nabble.com/use-modules-guile-user-warning-td151534.html, 
but I couldn't find an answer).




Re: DynamicText.font-size

2019-11-19 Thread David Kastrup
Andrew Bernard  writes:

> In my scores, when I use make-dynamic script as per the MWE here,
> setting DynamicText.font-size in Score context affects normal dynamic
> marks but not scripts. Is this a limitation, or my error?

I have no idea what you are talking about.  Set the font-size to #-10 in
your example, and all of your dynamics change obviously size.

> %
> \version "2.19.83"
>
> fpocoText = \markup {
>   \center-align \line {
> \hspace #0.1 f \normal-text \italic (poco)
>   }
> }
> fpoco = #(make-dynamic-script fpocoText)
>
> ppecrescText = \markup {
>   \normal-text \italic \whiteout "pp e cresc ..."
> }
> ppecresc = \tweak DynamicText.self-alignment-X #LEFT
> \tweak DynamicText.extra-spacing-width #'(+inf.0 . -inf.0)
> #(make-dynamic-script ppecrescText)
>
> treble = {
>   c''4^\f c''_\p c'' c'' c'' c''^\fpoco c''
>   c'' c''^\ppecresc
> }
>
> \score {
>   \new Staff { \treble }
>
>   \layout {
> \context {
>   \Score
>   \override DynamicText.font-size = #-2
> }
>   }
> }
>
>
> %
>
>

-- 
David Kastrup



Re: Scheme function to return pitchnames as markup/text

2019-11-19 Thread Stephen Cummings
Am I missing a basic LilyPond command/directive--something built-in that 
takes music as input and returns note names as text? Such a 
functionality would seem to be useful in all kinds of 
annotations/quotations. I know about \displayMusic but its output only 
goes to the console/output stream and can't be routed to markup, correct?


As for my effort to code my own music-to-text/markup function: 
apologies, but I left off the function name when I copied the code over. 
See correction below.


Also, I've since tried closing the " let* ( " block at the very end, 
rather than after the third binding, but that errors out too.


notenamer =
#(define-scheme-function
(pitchin)
(ly:music?)
(let* (
    (note-datum (car (ly:music-property pitchin 'elements)))
    (pitch-datum (ly:music-property note-datum 'pitch))
    (out-notename (ly:pitch-notename pitch-datum)))
#{  \markup
    \bold
    $out-notename
#}
))

Steve Cummings wrote on 11/18/2019 5:23 PM:


Though I remain baffled by Scheme and its use in LilyPond, my hope is 
to build one or more functions/procedures that would transpose input 
music and for each chord display the transposed chord's note names, 
with control over the way the names are represented (as in Cb or F# 
instead of ces and fis).


Here, I'm just asking for help with one part of the function-to-be: 
how to turn notes in LilyPond music into note names as text (schematic 
of the complete imagined function below).


Here's what I've tried so far, in LilyPond 2.19.8x, based closely on 
working procedures found on this list. Once this is running right for 
single notes I'll (hope to) get it to loop through all input music.


#(define-scheme-function
(pitchin)
(ly:music?)
(let* (
    (note-datum (car (ly:music-property pitchin 'elements)))
    (pitch-datum (ly:music-property note-datum 'pitch))
    (out-notename (ly:pitch-notename pitch-datum)))
#{  \markup
    \bold
    $out-notename
#}
))

I get "syntax error, unexpected NUMBER_IDENTIFIER" on the 
$out-notename line when calling notenamer with a note wrapped in 
braces, as in:


\notenamer {a}

Without the braces around the music,  the error is "In procedure car 
in expression (car (ly:music-property pitchin #)):Wrong type 
(expecting pair): ()


Results are the same if I do "define-music-function" instead of 
"define-scheme-function."


Many thanks for your attention and help,
Steve

PS: I have a working NoteNames reformatter but it seems to require 
listing in a substitution table the specific notes of each and every 
chord in each transposition. A custom function would allow display of 
the chord note names in a columnar stack so if these markups were used 
as text scripts they wouldn't either take too much space or collide 
with the names of adjacent notes. Alternatively, chord note names 
could be placed beneath ChordNames.




Re: Warning when defining variables on the command line

2019-11-19 Thread Aaron Hill

On 2019-11-19 3:37 am, Matt Wallis wrote:

I want to pass the subtitle into lilypond on the command line because
it is also required by other programmes (e.g. sox needs the subtitle
to create a tag for the mp3 it creates).
[ . . . ]
But I now get the warning:

Parsing...WARNING: #f: imported module (guile-user) overrides core
binding `%module-public-interface'

Should I be concerned? Is it safe to ignore? Can I suppress this 
warning?


With a little more work, you can peek into the guile-user module and 
grab out what you need without importing the entire module into the 
current environment:



\version "2.19.83"

#(define (guile-user-lookup sym def)
  (let ((mod (resolve-module '(guile-user
(if (module-defined? mod sym) (eval sym mod) def)))

#(format #t "\nHello, ~a!" (guile-user-lookup 'hello "..."))



$ wsl lilypond guile-user.ly
GNU LilyPond 2.19.83
Processing `guile-user.ly'
Parsing...
Hello, ...!
Success: compilation successfully completed

$ wsl lilypond -e '(define hello "World")' guile-user.ly
GNU LilyPond 2.19.83
Processing `guile-user.ly'
Parsing...
Hello, World!
Success: compilation successfully completed



-- Aaron Hill



Re: Scheme function to return pitchnames as markup/text

2019-11-19 Thread Aaron Hill

On 2019-11-19 6:05 am, Stephen Cummings wrote:

Am I missing a basic LilyPond command/directive--something built-in
that takes music as input and returns note names as text?


There is the NoteNames context, but its functionality is wrapped up in 
C++ code and is not easily customizable.



\version "2.19.83"

melody = \fixed c' { e8 fis g4 2 }
<< \new NoteNames \melody \new Staff \melody >>


Next, the logic behind ChordNames has a number of helper functions that 
are used to compose the final markup for a given chord.



\version "2.19.83"

\markup \column \override #'(word-space . 0.1) { #@(map
  (lambda (pitch) (note-name->markup pitch #f))
  (list #{ d, #} #{ ees #} #{ fisis' #})) }


Finally, you can do it manually when you need to fully customize naming:


\version "2.19.83"

#(define (pitch->name pitch)
  (vector-ref '#("Do" "Re" "Mi" "Fa" "So" "La" "Ti")
(ly:pitch-notename pitch)))

#(define (pitch->alteration pitch)
  (assoc-get (ly:pitch-alteration pitch)
   '((-1/2 . "-flat") (1 . "-double-sharp")) ""))

\markup \column { #@(map
  (lambda (pitch) #{ \markup \concat {
$(object->string pitch) ": "
$(pitch->name pitch) $(pitch->alteration pitch) } #})
  (list #{ d, #} #{ ees #} #{ fisis' #})) }


What is important to note is that ly:pitch-notename returns a number, 
not a string.  It is up to the caller to map that number into a suitable 
value within the desired naming system.



-- Aaron Hill



Full measure rests does not display in partial measure

2019-11-19 Thread Павел Буданов
<<
   { \partial 4*3 b b b b b b b }
   \\
   { R1*3/4 R1 }
>>

How to solve subject problem? I did not find the answer in the archive.


Re: Full measure rests does not display in partial measure

2019-11-19 Thread Malte Meyn




Am 19.11.19 um 18:34 schrieb Павел Буданов:

<<
    { \partial 4*3 b b b b b b b }
    \\
    { R1*3/4 R1 }




How to solve subject problem? I did not find the answer in the archive.


A partial measure is partial, not full, so why do you want a full 
measure rest?


In 4/4 time the rest should be written as “r4 r2”.



Re: Warning when defining variables on the command line

2019-11-19 Thread Matt Wallis

On 19/11/2019 15:39, Aaron Hill wrote:

On 2019-11-19 3:37 am, Matt Wallis wrote:

I want to pass the subtitle into lilypond on the command line because
it is also required by other programmes (e.g. sox needs the subtitle
to create a tag for the mp3 it creates).
[ . . . ]
But I now get the warning:

    Parsing...WARNING: #f: imported module (guile-user) overrides core
binding `%module-public-interface'

Should I be concerned? Is it safe to ignore? Can I suppress this warning?


With a little more work, you can peek into the guile-user module and 
grab out what you need without importing the entire module into the 
current environment:



\version "2.19.83"

#(define (guile-user-lookup sym def)
   (let ((mod (resolve-module '(guile-user
     (if (module-defined? mod sym) (eval sym mod) def)))

#(format #t "\nHello, ~a!" (guile-user-lookup 'hello "..."))



Very interesting! Thank Aaron.

So, I have added the line (in place of your call to format):

subtitle = #(guile-user-lookup 'subtitle "...")

in order to get back into the world of lilypond variables, and it all 
works. Without this line I get:


$ lilypond -e '(define subtitle "One Two Three")' SatbScore.ly
GNU LilyPond 2.19.83
Processing `SatbScore.ly'
Parsing...
SatbScore.ly:16:22: error: unknown escaped string: `\subtitle'
\header { subtitle =
 \subtitle }

A possibly related question ... the lilypond docs use `define-public`, 
and you use `define`. What is the difference?




Re: Warning when defining variables on the command line

2019-11-19 Thread Aaron Hill

On 2019-11-19 10:58 am, Matt Wallis wrote:

So, I have added the line (in place of your call to format):

subtitle = #(guile-user-lookup 'subtitle "...")

in order to get back into the world of lilypond variables, and it all
works.


As you discovered, you do need to explicitly define a new variable to 
leverage this approach.



A possibly related question ... the lilypond docs use `define-public`,
and you use `define`. What is the difference?


(define-public foo "bar")
  ...is equivalent to...
(begin (define foo "bar") (export foo))

So, the main difference is the additional call to export, which adds the 
variable to the list of variables exported from the current module.


I probably should be using define-public, as the docs recommend.  But I 
suspect the use of resolve-module as opposed to use-modules lets one see 
non-exported variables.  Either that, or there is some quirk with 
guile-user where all variables are implicitly exported.



-- Aaron Hill



Re: Scheme function to return pitchnames as markup/text

2019-11-19 Thread David Kastrup
Stephen Cummings  writes:

> Am I missing a basic LilyPond command/directive--something built-in
> that takes music as input and returns note names as text? Such a 
> functionality would seem to be useful in all kinds of
> annotations/quotations. I know about \displayMusic but its output only 
> goes to the console/output stream and can't be routed to markup, correct?

Hm?

musmark
= ^\tweak self-alignment-X #CENTER
  -$(define-scheme-function (music) (ly:music?)
 (with-output-to-string (lambda () (displayLilyMusic music \etc

{
  c'\musmark { c' }
}

Though it's probably a bit cheeky to $\etc the scheme function
in anonymously.  But you could give a name to the define-scheme-function
call as usual.



-- 
David Kastrup



Synthesizer-related font

2019-11-19 Thread Urs Liska
This was just shared on Facebook, and I want to forward it here since - while 
not related to music engraving directly - it may be useful to people on this 
list.

https://bit.ly/2qouMtH?fbclid=IwAR2kWD64268-n2cqKagJ5AxVntbxRsPFN48q61aZ8ORwB6s54vGmHeWJNZU

This points to an archive on Dropbox, containing the SIL-licenced font family 
"Glyph3 /Synth. A font designed to notate faders, knobs, wheels, signals and 
other synthesizer related stuff."

I don't know whether I'll have any use for it but it looks cool.

Best
Urs



Re: Scheme function to return pitchnames as markup/text

2019-11-19 Thread Stephen Cummings

Quite comfortable with such cheek. Thank you.

Still, I will try to package up a more formally named version of that 
little function. A translating map or loop will then be needed to 
extract note names and render them in more conventional form, but that 
won't require inscrutable-for-me ly:xxx calls. (Pardon the mistaken 
reference to displayMusic rather than displayLilyMusic.)


I'll pursue getting my original to work for learning purposes, and with 
the thought that discarding non-pitch events early rather than late 
might be better: if pitch -> convert to custom note name -> add to 
output string -> loop; then return the string. Sure helps to know that 
pitch-notename returns a number.


David Kastrup wrote on 11/19/2019 3:43 PM:

Stephen Cummings  writes:


Am I missing a basic LilyPond command/directive--something built-in
that takes music as input and returns note names as text? Such a
functionality would seem to be useful in all kinds of
annotations/quotations. I know about \displayMusic but its output only
goes to the console/output stream and can't be routed to markup, correct?

Hm?

musmark
= ^\tweak self-alignment-X #CENTER
   -$(define-scheme-function (music) (ly:music?)
  (with-output-to-string (lambda () (displayLilyMusic music \etc

{
   c'\musmark { c' }
}

Though it's probably a bit cheeky to $\etc the scheme function
in anonymously.  But you could give a name to the define-scheme-function
call as usual.





Re: Scheme function to return pitchnames as markup/text

2019-11-19 Thread Steve Cummings
First off, further apologies for accidentally posting a follow-up via an 
second email address.


Aaron, thanks for all of this. Helpful to have the demonstration of 
column-formatted note names from pitches, along with evidence of 
something called "note-name->markup"; maybe that's all I need if I stick 
with ordinary letter note names.


And thanks especially for the crucial info that pitch-notename returns a 
number, despite its name. Makes sense from a coding standpoint but the 
name threw me, what with NoteNames seeming string-y. (Is there a list of 
data types for parameters and returned values for the internal functions?)


Anyway with that in mind and with your helper functions added in, I have 
my function working (here, it returns vanilla note name forms for 
LilyPond notename numbers, but custom forms are now easy). Next I'll try 
adding a loop to process the entire input, discarding non-pitch, 
non-chord events and building up a corresponding string of note names. 
Sticking with the way this function has been designed, getting note 
names for transposed music would require first transposing the input 
within the function or via another helper one, I guess, and then 
processing the transposed music. David's displayLilyMusic-based function 
would make unnecessary any code to handle transposition, but weeding out 
all the non-notename characters from the string it produces would take 
some work.


#(define (pitch->name pitch)
  (vector-ref '#("C" "D" "E" "F" "G" "A" "B")
(ly:pitch-notename pitch)))

#(define (pitch->alteration pitch)
  (assoc-get (ly:pitch-alteration pitch)
   '((-1/2 . "b") (1/2 . "#") (-1 . "-double-flat") (1 . "-double-sharp")) ""))
 
notenamer =

  #(define-scheme-function (pitchin)
 (ly:music?)
 (let* (
  (note-datum (car (ly:music-property pitchin 'elements)))
  (pitch-datum (ly:music-property note-datum 'pitch))
  (out-notename (pitch->name pitch-datum))
  (out-acc (pitch->alteration pitch-datum)))
  #{\markup
\bold
\concat {$out-notename $out-acc }
  #}
 )
 )
\notenamer {ees d b c g}



From:   Aaron Hill
Subject:Re: Scheme function to return pitchnames as markup/text
Date:   Tue, 19 Nov 2019 09:19:26 -0800


On 2019-11-19 6:05 am, Stephen Cummings wrote:

Am I missing a basic LilyPond command/directive--something built-in
that takes music as input and returns note names as text?

There is the NoteNames context, but its functionality is wrapped up in C++ code 
and is not easily customizable.


\version "2.19.83"

melody = \fixed c' { e8 fis g4 2 }
<< \new NoteNames \melody \new Staff \melody >>


Next, the logic behind ChordNames has a number of helper functions that are 
used to compose the final markup for a given chord.


\version "2.19.83"

\markup \column \override #'(word-space . 0.1) { #@(map
  (lambda (pitch) (note-name->markup pitch #f))
  (list #{ d, #} #{ ees #} #{ fisis' #})) }


Finally, you can do it manually when you need to fully customize naming:


\version "2.19.83"

#(define (pitch->name pitch)
  (vector-ref '#("Do" "Re" "Mi" "Fa" "So" "La" "Ti")
(ly:pitch-notename pitch)))

#(define (pitch->alteration pitch)
  (assoc-get (ly:pitch-alteration pitch)
   '((-1/2 . "-flat") (1 . "-double-sharp")) ""))

\markup \column { #@(map
  (lambda (pitch) #{ \markup \concat {
$(object->string pitch) ": "
$(pitch->name pitch) $(pitch->alteration pitch) } #})
  (list #{ d, #} #{ ees #} #{ fisis' #})) }


What is important to note is that ly:pitch-notename returns a number, not a 
string. It is up to the caller to map that number into a suitable value within 
the desired naming system.


-- Aaron Hill




Re: Synthesizer-related font

2019-11-19 Thread Johan Vromans
On Wed, 20 Nov 2019 00:26:58 +, "Urs Liska" 
wrote:

> This was just shared on Facebook, and I want to forward it here since -
> while not related to music engraving directly - it may be useful to
> people on this list.
> 
> https://bit.ly/2qouMtH?fbclid=IwAR2kWD64268-n2cqKagJ5AxVntbxRsPFN48q61aZ8ORwB6s54vGmHeWJNZU
> 
> This points to an archive on Dropbox, containing the SIL-licenced font
> family "Glyph3 /Synth. A font designed to notate faders, knobs, wheels,
> signals and other synthesizer related stuff."
> 
> I don't know whether I'll have any use for it but it looks cool.

Cute. Thanks for sharing!