Re: Video generation on linux systems: Note and rests change color

2017-07-21 Thread Karlin High
On 7/21/2017 3:00 AM, Knut Petersen wrote:
> To generate score videos like Bach: Invention 1 
> , Wolf: Resignation 
>  and Peterson-Berger: I 
> Fyrreskoven 
> that give a different color to notes and rest while they are active 
> you might use the attached files if
> you run a unixoid system like linux.

Thanks for sharing this! I have a Debian VM set up for this now: FreeNAS 
9.10.2 -> bhyve (iohyve v0.7.7) -> Debian 8. I was able to produce the 
Hugo Wolf "Resignation" video.

I got some font errors during the lilypond compile: "warning: no glyph 
for character U+9F in font [...] ./texgyreschola- [*]" (Square brackets 
with placeholders for brevity.) Looks my setup is choking on the German 
ß sharp-S thing.

> mkvideo-lily-diff contains changes to an installed version of lilypond 
> (tested with 2.19.65, but it also
> should work with much older versions). No recompilation is necessary, 
> only scm and ps files are
> changed. The patched version of lilypond will behave exactly like the 
> unpatched version as long as
> videohelper.ily is not used. One exception: If you define illegal rgb 
> colors (R,G,B not in the range
> [0.0 ... 1.0]) this will not be detected.

Hmm... if everything else is the same after patching, any chance this 
could be included in the standard lilypond code? Or maybe that's what 
you have in mind, and just want more people to try it out first? I think 
this would be a great feature to have standard.

> mkvideo requires bash, ls, sort, tail, uniq, grep, sed, usleep, bc, 
> gs, pdftk,
> lilypond, fluidsynth, sox, ffmpeg, wc and a suitable sound font, e.g. 
> FluidR3_GM.sf2

All the dependencies, though... might be a bit much to include in the 
standard lilypond setup? Maybe that would have to be handled like 
Audacity does with some of their features: "If you're on Windows and 
want an MP3 encoder, go get this additional installer for LAME."

And it turns out Debian does not have usleep but rather sleepenh. I 
ended up doing...

ln -s /usr/bin/sleepenh /usr/bin/usleep

...as advised by an old, but apparently still valid Debian bug report. 
https://bugs.debian.org/223455

> 1. Patch some of the scm and ps files of your version of lilypond. 
> Adapt the paths first!
>
> cd /some/path/lilypond/2.19.65
> patch -p 1 < /some/path/mkvideo-lily-diff
>
> 2. Store the other files in a separate directory and feed lilypond:
>
> lilypond Wolf_Resignation
>
> 3. Run the mkvideo script:
>
> ./mkvideo
>
> At the top of mkvideo there are some definitions that might be changed 
> ... be sure to define a
> suitable soundfont.

I missed the soundfont advice on first reading. To statisfy the 
dependency for kptestpiano.sf2, I copied 
/usr/share/sounds/sf2/FluidR3_GM.sf2

Is there a way to set a path for the patched lilypond when running the 
mkvideo script? Or a definition to edit somewhere? I looked around a 
little in the mkvideo code, but my limited bash script skills didn't 
pick anything up.

> If you have problems: DEBUG gives a very verbose output, clean keeps 
> temporary files.
>
> cu,
>  Knut

Next, I'll be trying to make score videos of the "Hallelujah Chorus" 
from Handel's Messiah, or "Prayer of Thankful Praise" by Hal Hopson. 
Among my past projects, I think those are the ones that would most 
benefit from video scores.
--
Karlin High
Missouri, USA
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Sort-of leave notice

2017-07-21 Thread Thomas Morley
2017-07-21 13:02 GMT+02:00 Ralph Palmer :
> On Thu, Jul 20, 2017 at 3:49 PM, Urs Liska  wrote:
>> Hi all,
>>
>> I just wanted to let you know that I will substantially reduce my
>> LilyPond-related activities for some time,
>
> You will be sorely missed, Urs. I hope the reason is one that is
> pleasing and rewarding to you.
>
> Looking forward to seeing your name around again,
>
> Ralph


+1

Best,
  Harm

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


Re: Fwd: re: automatic beaming behavior

2017-07-21 Thread David Kastrup
Reilly Farrell  writes:

> Thank you for your responses.  In this case, we're looking to set up
> beaming rules that LilyPond does not follow by default (such as grouping
> consecutive eighth notes in pairs of two when in 4/4 time, rather than
> groups of four).
>
> David, your solution seems just like what we need based on what I've read
> in the documentation.  Right now, though, I'm receiving the following error
> message:
>
> error: wrong type for argument 3.  Expecting list, found 2
>
> 2,
>
>   2,2,2 % beatStructure
>
> ../../../road-map-score-block.ily:20:6: error: syntax error, unexpected ','
>
> 2
>
>  ,2,2,2 % beatStructure
> etc.
>
> Is there something I've overlooked in the formatting?

>> %% Beam crochets separately.
>> %% 2.18.2 can't parse this format for beatStructure

[...]

>> %% Beam compound dotted crochets separately.
>> %% 2.18.2 can't parse this format for beatStructure

You need a newer version of LilyPond, or you need to write

2,2,2,2

as
#'(2 2 2 2)

instead.

-- 
David Kastrup

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


Re: Fwd: re: automatic beaming behavior

2017-07-21 Thread Reilly Farrell
Thank you for your responses.  In this case, we're looking to set up
beaming rules that LilyPond does not follow by default (such as grouping
consecutive eighth notes in pairs of two when in 4/4 time, rather than
groups of four).

David, your solution seems just like what we need based on what I've read
in the documentation.  Right now, though, I'm receiving the following error
message:

error: wrong type for argument 3.  Expecting list, found 2

2,

  2,2,2 % beatStructure

../../../road-map-score-block.ily:20:6: error: syntax error, unexpected ','

2

 ,2,2,2 % beatStructure
etc.

Is there something I've overlooked in the formatting?

On Thu, Jul 20, 2017 at 11:48 AM, David Wright 
wrote:

> On Thu 20 Jul 2017 at 11:24:25 (-0700), Reilly Farrell wrote:
> > We are compiling several hundred melody and rhythm examples. Each example
> > references the same .ily file where global settings and formatting are
> > handled. Is there code for setting automatic behavior of beams that we
> can
> > put in the .ily file (not within a \relative { } block) to resolve the
> > issue?
> >
> > (The desire is for beamed notes to reflect the beat - pairs of eighths in
> > 4/4, 3/4, 2/4 and groups of three eighths in 6/8, 9/8,or 12/8.)
>
> %% Beam crochets separately.
> %% 2.18.2 can't parse this format for beatStructure
>
> \layout {
>   \context {
> \Score
> \overrideTimeSignatureSettings
> 2/2 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 2,2,2,2 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 3/4 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 2,2,2 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 4/4 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 2,2,2,2 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 5/4 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 2,2,2,2,2 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 6/4 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 2,2,2,2,2,2 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 7/4 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 2,2,2,2,2,2,2 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 8/4 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 2,2,2,2,2,2,2,2 % beatStructure
> #'() % beamExceptions
>   }
> }
>
> %% Beam compound dotted crochets separately.
> %% 2.18.2 can't parse this format for beatStructure
>
> \layout {
>   \context {
> \Score
> \overrideTimeSignatureSettings
> 6/8 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 3,3 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 9/8 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 3,3,3 % beatStructure
> #'() % beamExceptions
> \overrideTimeSignatureSettings
> 12/8 % timeSignatureFraction
> 1/8 % baseMomentFraction
> 3,3,3,3 % beatStructure
> #'() % beamExceptions
>   }
> }
>
> Cheers,
> David.
>



-- 
Reilly Farrell
reillycfarr...@gmail.com
(650) 787-2751
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: elementary macro problem

2017-07-21 Thread David Griffel
Thank you, David and Simon,

I see there's no straightforward solution, so I'll stick with the standard
syntax.

best wishes,
David G

On Fri, Jul 21, 2017 at 6:54 PM, Simon Albrecht 
wrote:

> On 21.07.2017 16:22, David Griffel wrote:
>
>> I just want a short abbreviation of \repeat unfold
>>
>
> I can understand that wish, but if I may give some advice from experience:
> even if it’s partially possible, it’s generally better to not abbreviate
> and stay with standard syntax.
> It’s easier to maintain, easier to share and easier for editors to
> highlight, and those advantages eventually outweigh the few more keystrokes
> you have to make.
>
> Best, Simon
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: elementary macro problem

2017-07-21 Thread David Kastrup
caag...@gmail.com writes:

>> On 07/21/2017 04:36 PM, David Kastrup wrote:
>>> Basically, to give \repeat the kind of pliability that music functions
>>> enjoy, one would need to come up with different syntax/semantics for
>>> alternatives.
>
> How about \repeat volta 2 { c1 d1 e1 \alternative {{d1} {f1}} }?

> IMO, that makes more sense both syntactically and semantically - the
> way I see it, that example is four measures repeated, with the last
> measure being different. With the current syntax, it's three measures
> repeated, and... wtf is going on there at the end? It doesn't make
> sense.

That would be sort of my favorite as well.  It would allow putting
\alternatives in music variables/expressions syntactically independent
of \repeat and would solve a few lookahead problems we have currently.

> That would also allow support for volta brackets in the middle of a
> repeat without fiddling with repeat-commands, and would allow it to
> work with \unfoldRepeats as well.

Not sure about that, though.

> The only problem I see with that syntax would be placing the repeat
> barline correctly between the last volta brackets, but there are far
> more complicated pieces of magic already. There's also the problem of
> backwards compatibility to consider. I don't know what Lilypond's
> stance is on that.

convert-ly should be able to deal with most of that.

-- 
David Kastrup

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


Another request : Please add OpenMusic to "Programs that export to Lilypond"

2017-07-21 Thread Karim Haddad

 Hi ,

  Another missing "programs that can export LilyPond code"
is OpenMusic ( http://repmus.ircam.fr/openmusic/home ).
Is it a is a visual programming language based on Lisp.
I have written a library that can export OM score editors to Lilypond, with 
polytempi support, and more.
It has also an import beta feature that allows to re-import exported scores to 
OpenMusic.
Personally i compose using OpenMusic environment and typeset my scores 
exclusively in The fantastatic Lilypond.

OM is free, the library also (all GNU GPL).

The library can be found here :
http://karim.haddad.free.fr/pages/downloads.html


You have also a paper here about all that :
https://hal.archives-ouvertes.fr/hal-01456511/document

Best regards.

-- 
Karim Haddad



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


Re: elementary macro problem

2017-07-21 Thread Simon Albrecht

On 21.07.2017 16:22, David Griffel wrote:

I just want a short abbreviation of \repeat unfold


I can understand that wish, but if I may give some advice from 
experience: even if it’s partially possible, it’s generally better to 
not abbreviate and stay with standard syntax.
It’s easier to maintain, easier to share and easier for editors to 
highlight, and those advantages eventually outweigh the few more 
keystrokes you have to make.


Best, Simon

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


Re: elementary macro problem

2017-07-21 Thread caagr98
How about \repeat volta 2 { c1 d1 e1 \alternative {{d1} {f1}} }? IMO, 
that makes more sense both syntactically and semantically - the way I 
see it, that example is four measures repeated, with the last measure 
being different. With the current syntax, it's three measures repeated, 
and... wtf is going on there at the end? It doesn't make sense.


That would also allow support for volta brackets in the middle of a 
repeat without fiddling with repeat-commands, and would allow it to work 
with \unfoldRepeats as well. I can't say I've ever seen that notation in 
the wild, but its meaning is rather obvious IMO, and either way, 
flexibility is usually a good thing.


The only problem I see with that syntax would be placing the repeat 
barline correctly between the last volta brackets, but there are far 
more complicated pieces of magic already. There's also the problem of 
backwards compatibility to consider. I don't know what Lilypond's stance 
is on that.


On 07/21/2017 04:36 PM, David Kastrup wrote:

Basically, to give \repeat the kind of pliability that music functions
enjoy, one would need to come up with different syntax/semantics for
alternatives.


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


Re: Please add MusicBlocks to "Programs that export to Lilypond"

2017-07-21 Thread Walter Bender
On Fri, Jul 21, 2017 at 10:57 AM, Devin Ulibarri 
wrote:

> Hello,
>
> Music Blocks is a visual programming language for music developed by
> Walter Bender (SugarLabs), myself, and many kids around the globe.
>
> It exports to Lilypond, and Lilypond export has been a priority for us.
>
> We noticed this page for "Other programs that can export LilyPond code":
> http://lilypond.org/easier-editing.html
>
> Would someone mind to add Music Blocks to this page, please?
>
> Our website/blog is at musicblocks.net
> Software is at https://walterbender.github.io/musicblocks/ and code is
> publicly available at https://github.com/walterbender/musicblocks


Licensed under AGPL

>
>
> Thanks,
> Devin
>



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org

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


Please add MusicBlocks to "Programs that export to Lilypond"

2017-07-21 Thread Devin Ulibarri
Hello,

Music Blocks is a visual programming language for music developed by
Walter Bender (SugarLabs), myself, and many kids around the globe.

It exports to Lilypond, and Lilypond export has been a priority for us.

We noticed this page for "Other programs that can export LilyPond code":
http://lilypond.org/easier-editing.html

Would someone mind to add Music Blocks to this page, please?

Our website/blog is at musicblocks.net
Software is at https://walterbender.github.io/musicblocks/ and code is
publicly available at https://github.com/walterbender/musicblocks

Thanks,
Devin

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


Re: elementary macro problem

2017-07-21 Thread David Kastrup
David Griffel  writes:

> I'm a fairly inexpert lilypond user. I've used simple macros before, but
> this one fails:
>
> thrice = \repeat unfold 3

Because there isn't a complete music expression following.

> it produces an error message:  error: unknown escaped string: `\thrice'
>
> Minimal example:
>   thrice = \repeat unfold 3
>   {\thrice {a b } }

Well, now there is a complete music expression following but it contains
"\thrice" which isn't defined yet: a hen and egg problem.

> The same thing happens if I drop the 3 and try to define rept = \repeat
> unfold.
>
> The Notation Manual 3.4.4 says "... So far we’ve seen static substitution –
> when LilyPond sees \padText, it replaces it with the stuff that we’ve
> defined it to be (ie the stuff to the right of padtext=)."
>
> It then goes on to
>
> padText =
> #(define-music-function
>  (parser location padding)
>  (number?)
>#{
>  \once \override TextScript.padding = #padding
>#})
>
>
> which looks more sophisticated than I need.  I just want a short
> abbreviation of \repeat unfold
> Maybe that's not possible without learning a good deal more?

It would be in the spirit of the \etc expression if you could write

thrice = \repeat unfold 3 \etc

but so far it only works on incomplete music function calls, and \repeat
isn't a music function call.  It would make perfect sense to turn it
into one, but the \alternatives syntax going with it can only be
implemented in the parser itself.

But you couldn't expect

\thrice { ... } \alternatives { ... }

to work with it then.  So with current (namely 2.19 versions), the best
you can hope to do is

thrice =
#(define-music-function (music) (ly:music?)
   #{ \repeat unfold 3 #music #})

and it still would not work in connection with \alternatives .
Basically, to give \repeat the kind of pliability that music functions
enjoy, one would need to come up with different syntax/semantics for
alternatives.

-- 
David Kastrup

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


Re: elementary macro problem

2017-07-21 Thread caagr98
If you're using 2.19, you might be able to use `thrice = \repeat unfold 
3 \etc`. Otherwise, you'll have to use the explicit version.


On 07/21/2017 04:22 PM, David Griffel wrote:
I'm a fairly inexpert lilypond user. I've used simple macros before, but 
this one fails:


thrice = \repeat unfold 3

it produces an error message:  error: unknown escaped string: `\thrice'

Minimal example:
   thrice = \repeat unfold 3
   {\thrice {a b } }

The same thing happens if I drop the 3 and try to define rept = \repeat 
unfold.


The Notation Manual 3.4.4 says "... So far we’ve seen static 
substitution – when LilyPond sees \padText, it replaces it with the 
stuff that we’ve defined it to be (ie the stuff to the right of padtext=)."


It then goes on to

padText =
#(define-music-function
  (parser location padding)
  (number?)
#{
  \once \override TextScript.padding = #padding
#})


which looks more sophisticated than I need.  I just want a short 
abbreviation of \repeat unfold

Maybe that's not possible without learning a good deal more?

David


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



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


elementary macro problem

2017-07-21 Thread David Griffel
I'm a fairly inexpert lilypond user. I've used simple macros before, but
this one fails:

thrice = \repeat unfold 3

it produces an error message:  error: unknown escaped string: `\thrice'

Minimal example:
  thrice = \repeat unfold 3
  {\thrice {a b } }

The same thing happens if I drop the 3 and try to define rept = \repeat
unfold.

The Notation Manual 3.4.4 says "... So far we’ve seen static substitution –
when LilyPond sees \padText, it replaces it with the stuff that we’ve
defined it to be (ie the stuff to the right of padtext=)."

It then goes on to

padText =
#(define-music-function
 (parser location padding)
 (number?)
   #{
 \once \override TextScript.padding = #padding
   #})


which looks more sophisticated than I need.  I just want a short
abbreviation of \repeat unfold
Maybe that's not possible without learning a good deal more?

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


Re: Sort-of leave notice

2017-07-21 Thread Ralph Palmer
On Thu, Jul 20, 2017 at 3:49 PM, Urs Liska  wrote:
> Hi all,
>
> I just wanted to let you know that I will substantially reduce my
> LilyPond-related activities for some time,

You will be sorely missed, Urs. I hope the reason is one that is
pleasing and rewarding to you.

Looking forward to seeing your name around again,

Ralph

-- 
Ralph Palmer
Brattleboro, VT
USA
palmer.r.vio...@gmail.com

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


Re: Output to single PDF and multiple MIDI files

2017-07-21 Thread Thomas Morley
2017-07-20 23:40 GMT+02:00 Jérôme Plût :
> I am typesetting a multi-movement work. I want the paper output to be
> in a single file (say work.pdf) and the MIDI output to be in separate
> files (work-1.pdf, work-2.pdf). Is there a simple and local way to do
> this?


Hi Jérôme,

you've got some nice code already.
Here my own approach, trying to automate it even more:

\version "2.19.64"

#(define (string-list? x)
  (and (list? x) (every string? x)))

putOut =
#(define-void-function (restrict-ls suffixes scores)
  ((number-list? '()) (string-list? '()) list?)
"Puts out a book with all scores from @var{scores} and seperate midis for each
score of @var{scores}.

@var{restrict-ls} and @var{suffixes} are optional arguments.
If @var{restrict-ls} is set, a subset of @var{scores} is processed, the naming
of the midis will be consistent, i.e. if first and third score are processed,
midis are named filename-1.midi and filename-3.midi
If @var{suffixes} is set, use it for midi-naming, otherwise midis are named:
filename-1.midi, filename-2.midi, etc.
Note, if @var{suffixes} is set, @var{restrict-ls} needs to be set as well.
"
  (let* ((file-name (ly:parser-output-name))
 ;; Provides defaults if 'suffixes'-variable is not set.
 (suffixes
   (if (null? suffixes)
   (map number->string (iota (length scores) -1 -1))
   suffixes))
 ;; cherry-pick the desired scores or choose all if
 ;; 'restrict-ls'-variable is not set.
 (restrist-list-proc
   (lambda (lst)
 (if (null? restrict-ls)
 lst
 (map
   (lambda (arg)
 (if (> (1+ arg) (length lst))
 (ly:error
   "You tried to get a not existing score or suffix.")
 (list-ref lst arg)))
   restrict-ls)
;; put out a book (usually a pdf) with all scores returned by
;; 'restrist-list-proc'
(ly:book-process
   (apply
 ly:make-book
 $defaultpaper
 $defaultheader
 (restrist-list-proc (reverse scores)))
   $defaultpaper
   $defaultlayout
   file-name)
;; put out midis in separate files.
(for-each
  (lambda (bk bookSuffix)
(ly:book-process bk $defaultpaper $defaultmidi
  (format #f "~a~a" (ly:parser-output-name) bookSuffix)))
(map
  (lambda (score)
(ly:make-book
  $defaultpaper
  $defaultheader
  score))
  (restrist-list-proc scores))
   (restrist-list-proc suffixes

%%
%% EXAMPLES
%%

%% Define variables
one = \relative { c'4 c c c }
two = \relative { c'4 d e f }
three = \relative { d'4 d' d' d' }

%% Define of scores
scoreI = \score { \one \header { opus = "opus 1" } }
scoreII = \score { \two \header { piece = "2. piece" } }
scoreIII = \score { \three \header { piece = "3. piece" } }

%% Put them in a list
scoreList =
#(list
  scoreI
  scoreII
  scoreIII
  )


%% Create the output
%% Examples

%% book-header, example
\header { title = "TITLE" }

%% book-layout, example
\layout {
  \context {
\Voice
\override NoteHead.color = #grey
  }
}

%% book-paper, example
\paper { indent = 0 }

%% book-midi, example
\midi {
  \tempo 4=200
}

%% Ofcourse different settings for layout/midi could be done while defining
%% scores above

%% 1
%{
%% Put out all, midis are named starting with filename-1.midi
\putOut \scoreList
%}

%% 2
%%{
%% Put out first and third score and the relevant midis
%% NB list-ref needs number 0 to catch the first argument of a list, etc
%% midis are named: filename-1.midi, filename-3.midi
\putOut #'(0 2) \scoreList
%}

%% 3
%{
%% Put out second and third score and the relevant midis
%% midis are named: filename-bar.midi, filename-buzz.midi
\putOut
  #'(1 2)
  #'("-foo" "-bar" "-buzz")
  \scoreList
%}


Cheers,
  Harm

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


Video generation on linux systems: Note and rests change color

2017-07-21 Thread Knut Petersen

Hi everybody!

To generate score videos like Bach: Invention 1 
, Wolf: Resignation 
 and Peterson-Berger: I Fyrreskoven 

that give a different color to notes and rest while they are active you might 
use the attached files if
you run a unixoid system like linux.

mkvideo-lily-diff contains changes to an installed version of lilypond (tested 
with 2.19.65, but it also
should work with much older versions). No recompilation is necessary, only scm 
and ps files are
changed. The patched version of lilypond will behave exactly like the unpatched 
version as long as
videohelper.ily is not used. One exception: If you define illegal rgb colors 
(R,G,B not in the range
[0.0 ... 1.0]) this will not be detected.

Wolf_Resignation.ly is a lilypond score that demonstrates the intended use. Be 
sure to have a close
look at the comments!

videohelper.ily includes some definitions needed for video generation.

mkvideo requires bash, ls, sort, tail, uniq, grep, sed, usleep, bc, gs, pdftk,
lilypond, fluidsynth, sox, ffmpeg, wc and a suitable sound font, e.g. 
FluidR3_GM.sf2

1. Patch some of the scm and ps files of your version of lilypond. Adapt the 
paths first!

   cd /some/path/lilypond/2.19.65
   patch -p 1 < /some/path/mkvideo-lily-diff

2. Store the other files in a separate directory and feed lilypond:

   lilypond Wolf_Resignation

3. Run the mkvideo script:

   ./mkvideo

At the top of mkvideo there are some definitions that might be changed ... be 
sure to define a
suitable soundfont.

If you have problems: DEBUG gives a very verbose output, clean keeps temporary 
files.

cu,
 Knut
diff -U 4 ./origscm/framework-ps.scm ./scm/framework-ps.scm
--- ./origscm/framework-ps.scm  2016-11-21 05:26:10.890701666 +0100
+++ ./scm/framework-ps.scm  2017-07-20 06:43:33.177169912 +0200
@@ -108,9 +108,14 @@
(output-entry "page-width" 'paper-width)
(if (ly:get-option 'strokeadjust) "true setstrokeadjust\n" "")
))
 
+;; [mkvideo] This version of dump-page is extended for mkvideo.
+;; As long as null? videopagelist is true nothing changes.
 (define (dump-page outputter page page-number page-count landscape?)
+  (let* (
+(ml (assoc page-number videopagelist))
+(rep? (and (not (null? videopagelist)) (if (pair? ml) (not (null? (cdr 
ml))) #f
   (ly:outputter-dump-string
outputter
(string-append
 (format #f "%%Page: ~a ~a\n" page-number page-number)
@@ -119,8 +124,9 @@
 "page-width output-scale lily-output-units mul mul 0 translate 90 
rotate\n"
 "")
 "%%EndPageSetup\n"
 "\n"
+(format #f (if rep? "/lilypage {\n" ""))
 "gsave 0 paper-height translate set-ps-scale-to-lily-scale\n"
 "/helpEmmentaler-Brace where {pop helpEmmentaler-Brace} if\n"
 "/helpEmmentaler-11 where {pop helpEmmentaler-11} if\n"
 "/helpEmmentaler-13 where {pop helpEmmentaler-13} if\n"
@@ -130,9 +136,15 @@
 "/helpEmmentaler-20 where {pop helpEmmentaler-20} if\n"
 "/helpEmmentaler-23 where {pop helpEmmentaler-23} if\n"
 "/helpEmmentaler-26 where {pop helpEmmentaler-26} if\n"))
   (ly:outputter-dump-stencil outputter page)
-  (ly:outputter-dump-string outputter "stroke grestore\nshowpage\n"))
+  (ly:outputter-dump-string outputter "stroke grestore\nshowpage\n")
+  (if rep? (list
+(ly:outputter-dump-string outputter (format #f "} def 1 "))
+(do ((i 0 (1+ i)))
+  ((>= i (length (cdr ml
+  (ly:outputter-dump-string outputter (format #f "~a " (list-ref (cdr ml) 
i
+(ly:outputter-dump-string outputter (format #f " { /MkVidTime exch def 
MkVidTime 1 eq { exit } if lilypage } loop\n" ))
 
 (define (supplies-or-needs paper load-fonts?)
   (define (extract-names font)
 (if (ly:pango-font? font)
diff -U 4 ./origscm/output-lib.scm ./scm/output-lib.scm
--- ./origscm/output-lib.scm2017-02-03 06:54:22.841211149 +0100
+++ ./scm/output-lib.scm2017-07-20 06:34:08.286750353 +0200
@@ -703,13 +703,14 @@
 
 ;;
 ;; Color
 
+;; [mkvideo] This version of color? does _not_ check that
+;; r, g and b are in the range [0.0 .. 1.0]!
 (define-public (color? x)
   (and (list? x)
(= 3 (length x))
-   (every number? x)
-   (every (lambda (y) (<= 0 y 1)) x)))
+   (every number? x)))
 
 (define-public (rgb-color r g b) (list r g b))
 
 ;; predefined colors
diff -U 4 ./origscm/output-ps.scm ./scm/output-ps.scm
--- ./origscm/output-ps.scm 2016-11-21 05:26:10.894702197 +0100
+++ ./scm/output-ps.scm 2017-07-20 06:35:48.233783884 +0200
@@ -204,10 +204,11 @@
 (ly:format  "~4l draw_round_box"
 (list width height x y blotdiam
 
 ;; save current color on stack and set new color
+;; [mkvideo] This version of setcolor extends the precision
 (define (setcolor r g b)
-  (ly:format "gsave ~4l setrgbcolor\n"
+  (ly:format "gsave ~9l