Re: Including only definitions from a Lilypond file

2020-08-14 Thread David Kastrup
Jérôme Plût  writes:

> Hello everybody,
>
> I have some lilypond files that contain both music variables and
> typesetting instructions, like this:
>
> soprano = \relative {
>   % music here...
> }
>
> \bookpart {
>   % typesetting here...
> }
>
> I would like to include this file while importing the definitions and
> ignoring the typesetting. (The long-term goal is to display some
> statistics (range, etc.) about the various voices in the piece. So the
> including file will want to know what \soprano contains, but to
> replace all typesetting instructions by its own).
>
> I *could* do this by writing a separate (e.g. Perl) parser that looks
> only for music definitions, but it would be cleaner (and also more
> robust) if there existed a way to do this from inside Lilypond or
> Scheme. Ideally I would need the parser to obtain both the list of
> variables defined in the file and the contents of those variables.
>
> Before I start hacking something: does there already exist a simpler
> way to do this?

All of the elements in a score are routed through hooks you can
redefine.  So you can just redefine your various hooks to do nothing and
then include the file.

The hooks all end in "-handler".  I see

dak@lola:/usr/local/tmp/lilypond$ git grep -e -handler lily/parser.yy
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-book-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-bookpart-handler");
lily/parser.yy:  ? "toplevel-book-handler"
lily/parser.yy:  : "toplevel-bookpart-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-score-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-music-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("toplevel-score-handler");
lily/parser.yy: SCM proc = 
parser->lexer_->lookup_identifier ("context-mod-music-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("book-bookpart-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("book-score-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("book-music-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("book-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("book-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("book-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("book-score-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("bookpart-score-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("bookpart-music-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("bookpart-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("bookpart-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("bookpart-text-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("bookpart-score-handler");
lily/parser.yy: ("output-def-music-handler");
lily/parser.yy:  ("output-def-music-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("context-mod-music-handler");
lily/parser.yy: SCM proc = parser->lexer_->lookup_identifier 
("context-mod-music-handler");


-- 
David Kastrup



Guitar barré without text spanner

2020-08-14 Thread Cantus Ornatus
Hi everyone,

I apologize for the banal request, but I did not find any suggestion.

I use \startBarre and \startHalfBarre, as shown here:
http://lsr.di.unimi.it/LSR/Item?id=952

How is possible using the same notation (of both kinds of barré,
normal and half) without a text spanner, in order to mark barré just
in one point?
Thanks in advance,
Francesco



Is there a way to patch the lyrics tie character?

2020-08-14 Thread Fernando Gil
Hello to everyone, I'm struggled with the lyrics tie character when using
an alternate font from Music Type Foundry.

Since lilypond uses character from the music font, when using an alternate
font with the character missing, it doesn't show.

I have a workaround that goes like this:

Cuer -- \markup {po\hspace #-0.3  \override #'(font-name . "emmentaler-20")
\char ##xe196 \hspace #-0.3 y}

But when transcribing 8 stanzas there's certainly much better to use the
simplicity of "~" (i.e. Cuer -- po~y) rather than my workaround.

I imagine there's a chance to achieve what I'm looking with a cleaner way
but have no clue where to start. Hope you can help me. Thanks in advance.


Re: Including only definitions from a Lilypond file

2020-08-14 Thread Aaron Hill

On 2020-08-14 4:48 am, David Kastrup wrote:

All of the elements in a score are routed through hooks you can
redefine.  So you can just redefine your various hooks to do nothing 
and

then include the file.


Would something like this work?


\version "2.20.0"

#(begin
  (use-modules (ice-9 regex))
  (let* ((symbols
   (map (lambda (m) (string->symbol (match:substring m 1)))
(list-matches "define ([a-z-]+-handler)"
  (ly:gulp-file "declarations-init.ly"
 (procs (map primitive-eval symbols))
 (null-proc (lambda args #f)))
(ly:parser-define! 'disableHandlers
  (define-void-function () ()
(for-each
  (lambda (sym) (primitive-eval `(set! ,sym ,null-proc)))
  symbols)))
(ly:parser-define! 'restoreHandlers
  (define-void-function () ()
(for-each
  (lambda (sym proc) (primitive-eval `(set! ,sym ,proc)))
  symbols procs)

assert =
#(define-void-function
  (expr)
  (scheme?)
  (or (primitive-eval expr)
  (ly:error "Assertion failed: ~s" expr)))

\disableHandlers

foo = { f'4 4 2 }
\assert #'(defined? 'foo)

\markup "Hidden"
{ \foo }
\assert #'(eq? 0 (length toplevel-scores))

\restoreHandlers

\markup "Visible"
{ \foo }
\assert #'(eq? 2 (length toplevel-scores))



-- Aaron Hill



Is there a way to patch the lyrics tie character?

2020-08-14 Thread Fernando Gil
Hello to everyone, I'm struggled with the lyrics tie character when using
an alternate font from Music Type Foundry.

Since lilypond uses character from the music font, when using an alternate
font with the character missing, it doesn't show.

I have a workaround that goes like this:

Cuer -- \markup {po\hspace #-0.3  \override #'(font-name . "emmentaler-20")
\char ##xe196 \hspace #-0.3 y}

But when transcribing 8 stanzas there's certainly much better to use the
simplicity of "~" (i.e. Cuer -- po~y) rather than my workaround.

I imagine there's a chance to achieve what I'm looking with a cleaner way
but have no clue where to start. Hope you can help me. Thanks in advance.


Help with Midi

2020-08-14 Thread David Sumbler
When working on a project in Lilypond I usually set things up to
generate midi files as well as printable output, mainly for note-
checking.  But it is interesting to generate an ensemble midi file too.
I play these files with TiMidity, using the fluidr3_gm soundfont.

I know the (very) basics about midi instruments (although I'm a bit
vague about midi channels), and I know how to improve things by using
timidity to generate wav files which I can import into qtractor or
similar and then edit the combined result.

What I am about to ask is not really a Lilypond question at all (at
least, I don't think it is), but I am hoping that somebody on this list
can point me in the right direction.  Clearly I am not making the right
searches on line, because I have never managed to find the information
I want.

What I should like to know is
1) how can I use drum and other untuned percussion sounds?
2) I notice that fluidr3_gm has dozens - probably hundreds - of extra
sounds and instruments beyond the standard 128.  How can I access
these?
3) how can I use other soundfonts?  There seem to be a lot of free
soundfonts available on line, but I have no idea how I would use them. 
It would be nice to have a decent trumpet sound (the fluidr3-gm one is
very poor), the sound of violin section as will as solo violin, string
harmonics, timpani roll and so on.

Can anyone point me to a useful online source of such information?

David





Re: Guitar barré without text spanner

2020-08-14 Thread Pierre Perol-Schneider
Hi Francesco,
How about a simple markup? E.g.:

\version "2.20.0"

half = \markup\concat\fontsize #-5 { \raise #.6 "1"\raise #.2 "/"  "2"
\hspace #.2 }

{
  \clef "G_8"
  
  -\tweak X-offset #-2.5
  ^\markup\concat\tiny {
\half "C" \hspace #.2 "II"
\magnify #0.5 { \lower #.1 " ┐" }
  }
}

HTH, cheers,
Pierre

Le ven. 14 août 2020 à 15:15, Cantus Ornatus  a
écrit :

> Hi everyone,
>
> I apologize for the banal request, but I did not find any suggestion.
>
> I use \startBarre and \startHalfBarre, as shown here:
> http://lsr.di.unimi.it/LSR/Item?id=952
>
> How is possible using the same notation (of both kinds of barré,
> normal and half) without a text spanner, in order to mark barré just
> in one point?
> Thanks in advance,
> Francesco
>
>


Re: Guitar barré without text spanner

2020-08-14 Thread Cantus Ornatus
Perfect!
Thanks a lot!

Il giorno ven 14 ago 2020 alle ore 19:04 Pierre Perol-Schneider
 ha scritto:
>
> Hi Francesco,
> How about a simple markup? E.g.:
>
> \version "2.20.0"
>
> half = \markup\concat\fontsize #-5 { \raise #.6 "1"\raise #.2 "/"  "2" 
> \hspace #.2 }
>
> {
>   \clef "G_8"
>   
>   -\tweak X-offset #-2.5
>   ^\markup\concat\tiny {
> \half "C" \hspace #.2 "II"
> \magnify #0.5 { \lower #.1 " ┐" }
>   }
> }
>
> HTH, cheers,
> Pierre
>
> Le ven. 14 août 2020 à 15:15, Cantus Ornatus  a 
> écrit :
>>
>> Hi everyone,
>>
>> I apologize for the banal request, but I did not find any suggestion.
>>
>> I use \startBarre and \startHalfBarre, as shown here:
>> http://lsr.di.unimi.it/LSR/Item?id=952
>>
>> How is possible using the same notation (of both kinds of barré,
>> normal and half) without a text spanner, in order to mark barré just
>> in one point?
>> Thanks in advance,
>> Francesco
>>



kind of OT: bach inventions

2020-08-14 Thread Flaming Hakama by Elaine
I was working with one of the Bach inventions and was trying to find
public domain lilypond source, of either just the notes or an actual
edition.

All of mutopia's links seem to be down atm, was wondering if anyone
happened to know of such a resource that is available.

https://www.mutopiaproject.org/cgibin/make-table.cgi?collection=bachis&preview=1
Sorry, no matches were found for your search criteria.


Thanks,

Elaine Alt
415 . 341 .4954   "*Confusion is
highly underrated*"
ela...@flaminghakama.com
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


On Tue, Aug 11, 2020 at 7:29 AM Flaming Hakama by Elaine <
ela...@flaminghakama.com> wrote:

> -- Forwarded message --
>> From: Michael Gerdau 
>> To: Lilypond User 
>> Date: Sat, 18 Jul 2020 07:57:23 +0200 (CEST)
>> Subject: Q: Irregular alternate repeats and MIDI
>> Hi List,
>>
>> I have a score with repeats and irregular alternate endings. I can neatly
>> engrave that but I don't seem to be able to produce correct MIDI w/o
>> manually arranging all segments.
>>
>> Does someone has a trick up his sleeve?
>> I found mails regarding this problem in the archive dating back to
>> 2008...
>>
>> Here is my "kind of" MWE:
>> %---
>> \version "2.21.2"
>>
>> body = { c'4 c' c' c' }
>> voltaI = { d'4 d' d' d' }
>> voltaII = { e'4 e' e' e' }
>> voltaIII = { g'4 g' g' g' }
>>
>> musicI = {
>>   \repeat volta 5 \body
>>   \alternative {
>> \voltaI
>> \voltaII
>> \voltaIII
>>   }
>>   \bar "|."
>> }
>>
>> musicII = {
>>   \repeat volta 5 \body
>>   \set Score.repeatCommands = #'((volta "1."))
>>   \voltaI
>>   \set Score.repeatCommands = #'((volta #f) (volta "2. 3. 4.") end-repeat)
>>   \voltaII
>>   \set Score.repeatCommands = #'((volta #f) (volta "5.") end-repeat)
>>   \voltaIII
>>   \set Score.repeatCommands = #'((volta #f))
>>   \bar "|."
>> }
>>
>> \markup "Default w/o \unfoldRepeats"
>> \score {
>>   \musicI
>>   \layout { }
>>   \midi { }
>> }
>>
>> \markup "Default unfold is 1.-3. -> Volta 1, 4. -> Volta 2 and 5. ->
>> Volta 3"
>> \score {
>>   \unfoldRepeats \musicI
>>   \layout { }
>>   \midi { }
>> }
>>
>>
>> \markup "This is what I want..."
>> \score {
>>   \musicII
>>   \layout { }
>>   \midi { }
>> }
>>
>> \markup "...but \unfoldRepeats does not deal with it"
>> \score {
>>   \unfoldRepeats \musicII
>>   \layout { }
>>   \midi { }
>> }
>>
>> \markup "Of course I could enforce it manually"
>> \score {
>>   { \body \voltaI \repeat unfold 3 { \body \voltaII } \body \voltaIII
>> \bar "|." }
>>   \layout { }
>>   \midi { }
>> }
>>
>> \markup "How should I change \musicII to enable \unfoldRepeats to work
>> the way I want it?"
>> \markup "Is there a way to tell \alternative which repeats in which volta
>> (and the volta texts)?"
>> %---
>>
>> Kind regards,
>> Michael
>> --
>> Michael Gerdau email: m...@qata.de
>>
>
>
> Not exactly what you asked for, but one possible approach is to use tags.
>
> Tags allow for conditional use of material.
>
> In this case, you would add a tag that is specific to MIDI
> and put the repetitions in a similar way you did in the "manual" version.
>
> Then, have two different scores, one for PDF and one for MIDI,
> which use different tags.
>
> Even in the printed score, you need to use the \keepWithTag command,
> even though there is no PDF-specific content here,
> in order to keep the MIDI-tagged content out.
>
> Note that the tag names "MIDI" and "PDF" are just arbitrary words,
> there is no intrinsic significance to them.
>
> This approach becomes handy when coding other differences for MIDI,
> such as fermatas, breaths, rit/accel, trills.
>
> \version "2.19.81"
>
> body = { c'4 c' c' c' }
> voltaI = { d'4 d' d' d' }
> voltaII = { e'4 e' e' e' }
> voltaIII = { g'4 g' g' g' }
>
> music = {
>   \repeat volta 5 \body
>   \set Score.repeatCommands = #'((volta "1."))
>   \voltaI
>   \tag #'MIDI { \body }
>
>   \set Score.repeatCommands = #'((volta #f) (volta "2. 3. 4.") end-repeat)
>   \voltaII
>   \tag #'MIDI {
>   \body \voltaII
>   \body \voltaII
>   \body }
>
>   \set Score.repeatCommands = #'((volta #f) (volta "5.") end-repeat)
>   \voltaIII
>   \set Score.repeatCommands = #'((volta #f))
>   \bar "|."
> }
>
> \score {
>   \keepWithTag #'PDF \music
>   \layout { }
> }
>
> \score {
>   \keepWithTag #'MIDI \music
>   \midi { }
> }
>
>
> HTH,
>
> Elaine Alt
> 415 . 341 .4954   "*Confusion is
> highly underrated*"
> ela...@flaminghakama.com
> Producer ~ Composer ~ Instrumentalist ~ Educator
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>


Re: kind of OT: bach inventions

2020-08-14 Thread H. S. Teoh
On Fri, Aug 14, 2020 at 12:00:10PM -0700, Flaming Hakama by Elaine wrote:
>I was working with one of the Bach inventions and was trying to
>find public domain lilypond source, of either just the notes or an
>actual edition.
>All of mutopia's links seem to be down atm, was wondering if anyone
>happened to know of such a resource that is available.
[...]

Which invention are you interested in? I have lilypond source for
invention no.8, which I transcribed from a score I found on IMSLP.


T

-- 
An elephant: A mouse built to government specifications. -- Robert Heinlein



Re: kind of OT: bach inventions

2020-08-14 Thread Lukas-Fabian Moser

Hi Elaine,

Am 14.08.20 um 21:00 schrieb Flaming Hakama by Elaine:
I was working with one of the Bach inventions and was trying to find 
public domain lilypond source, of either just the notes or an actual 
edition.


All of mutopia's links seem to be down atm, was wondering if anyone 
happened to know of such a resource that is available.


https://www.mutopiaproject.org/cgibin/make-table.cgi?collection=bachis&preview=1
Sorry, no matches were found for your search criteria.


Last time I tried, the Portuguese mirror of Mutopia was still working:

http://eremita.di.uminho.pt/mutopia/cgibin/make-table.cgi?searchingfor=bach+invention

But it would be interesting to know what's happened to Mutopia.

Best
Lukas



RE: kind of OT: bach inventions

2020-08-14 Thread Mark Stephen Mrotek
Elaine,

 

I have my codes for 6, 12, and 13.

 

Mark

 

From: lilypond-user [mailto:lilypond-user-bounces+carsonmark=ca.rr@gnu.org] 
On Behalf Of Flaming Hakama by Elaine
Sent: Friday, August 14, 2020 12:00 PM
To: Lilypond-User Mailing List 
Subject: kind of OT: bach inventions

 

 

I was working with one of the Bach inventions and was trying to find public 
domain lilypond source, of either just the notes or an actual edition.

 

All of mutopia's links seem to be down atm, was wondering if anyone happened to 
know of such a resource that is available.

 

https://www.mutopiaproject.org/cgibin/make-table.cgi?collection=bachis 

 &preview=1

Sorry, no matches were found for your search criteria.

 

 

Thanks, 


Elaine Alt

415 . 341 .4954   "Confusion is highly 
underrated"

ela...@flaminghakama.com  

Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 

 

On Tue, Aug 11, 2020 at 7:29 AM Flaming Hakama by Elaine 
mailto:ela...@flaminghakama.com> > wrote:

-- Forwarded message --
From: Michael Gerdau mailto:m...@qata.de> >
To: Lilypond User mailto:lilypond-user@gnu.org> >
Date: Sat, 18 Jul 2020 07:57:23 +0200 (CEST)
Subject: Q: Irregular alternate repeats and MIDI
Hi List,

I have a score with repeats and irregular alternate endings. I can neatly 
engrave that but I don't seem to be able to produce correct MIDI w/o manually 
arranging all segments.

Does someone has a trick up his sleeve?
I found mails regarding this problem in the archive dating back to 2008... 

Here is my "kind of" MWE:
%---
\version "2.21.2"

body = { c'4 c' c' c' }
voltaI = { d'4 d' d' d' }
voltaII = { e'4 e' e' e' }
voltaIII = { g'4 g' g' g' }

musicI = {
  \repeat volta 5 \body
  \alternative {
\voltaI
\voltaII
\voltaIII
  }
  \bar "|."
}

musicII = {
  \repeat volta 5 \body
  \set Score.repeatCommands = #'((volta "1."))
  \voltaI
  \set Score.repeatCommands = #'((volta #f) (volta "2. 3. 4.") end-repeat)
  \voltaII
  \set Score.repeatCommands = #'((volta #f) (volta "5.") end-repeat)
  \voltaIII
  \set Score.repeatCommands = #'((volta #f))
  \bar "|."
}

\markup "Default w/o \unfoldRepeats"
\score {
  \musicI
  \layout { }
  \midi { }
}

\markup "Default unfold is 1.-3. -> Volta 1, 4. -> Volta 2 and 5. -> Volta 3"
\score {
  \unfoldRepeats \musicI
  \layout { }
  \midi { }
}


\markup "This is what I want..."
\score {
  \musicII
  \layout { }
  \midi { }
}

\markup "...but \unfoldRepeats does not deal with it"
\score {
  \unfoldRepeats \musicII
  \layout { }
  \midi { }
}

\markup "Of course I could enforce it manually"
\score {
  { \body \voltaI \repeat unfold 3 { \body \voltaII } \body \voltaIII \bar "|." 
}
  \layout { }
  \midi { }
}

\markup "How should I change \musicII to enable \unfoldRepeats to work the way 
I want it?"
\markup "Is there a way to tell \alternative which repeats in which volta (and 
the volta texts)?"
%---

Kind regards,
Michael
-- 
Michael Gerdau email: m...@qata.de  

 


Not exactly what you asked for, but one possible approach is to use tags.

Tags allow for conditional use of material.

In this case, you would add a tag that is specific to MIDI 
and put the repetitions in a similar way you did in the "manual" version.

Then, have two different scores, one for PDF and one for MIDI, 
which use different tags.

Even in the printed score, you need to use the \keepWithTag command, 
even though there is no PDF-specific content here, 
in order to keep the MIDI-tagged content out.

Note that the tag names "MIDI" and "PDF" are just arbitrary words, 
there is no intrinsic significance to them.

This approach becomes handy when coding other differences for MIDI, 

such as fermatas, breaths, rit/accel, trills.

 

\version "2.19.81"


body = { c'4 c' c' c' }
voltaI = { d'4 d' d' d' }
voltaII = { e'4 e' e' e' }
voltaIII = { g'4 g' g' g' }

music = {
  \repeat volta 5 \body
  \set Score.repeatCommands = #'((volta "1."))
  \voltaI 
  \tag #'MIDI { \body }
  
  \set Score.repeatCommands = #'((volta #f) (volta "2. 3. 4.") end-repeat)
  \voltaII
  \tag #'MIDI { 
  \body \voltaII
  \body \voltaII
  \body }

  \set Score.repeatCommands = #'((volta #f) (volta "5.") end-repeat)
  \voltaIII
  \set Score.repeatCommands = #'((volta #f))
  \bar "|."
}

\score {
  \keepWithTag #'PDF \music
  \layout { }
}

\score {
  \keepWithTag #'MIDI \music
  \midi { }
}



HTH, 


Elaine Alt

415 . 341 .4954   "Confusion is highly 
underrated"

ela...@flaminghakama.com  

Producer ~ Composer ~ Instrumentalist ~ Educator

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-