Am 21.07.2017 um 10:00 schrieb Knut Petersen:
Hi everybody!

To generate score videos like Bach: Invention 1 
<https://www.youtube.com/watch?v=EqWYmrwTcqQ>, Wolf: Resignation 
<https://www.youtube.com/watch?v=IonPmbdY7ME> and Peterson-Berger: I Fyrreskoven 
<https://www.youtube.com/watch?v=hgDWprKiyo0>
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).

Because of recent changes to framework-ps.scm an updated diff is needed. Use 
the attached file instead of mkvideo-lily-diff versions of lilypond containing

   Commit 398c2e17d45bf4d18723e14d52531e4e7d006dea
   Author: Knut Petersen <knut_peter...@t-online.de>
   Date:   Tue Oct 3 15:05:56 2017 +0100

        Adapt lilypond to ghostscript 9.22, change command line options [...]

That means: Use it for e.g. lilypond 2.21.x, current git master.

Knut
diff -U 4 scm/framework-ps.scm scmvid/framework-ps.scm
--- scm/framework-ps.scm        2017-10-23 00:09:21.286200000 +0200
+++ scmvid/framework-ps.scm     2017-11-06 08:14:22.160854215 +0100
@@ -101,9 +101,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)
@@ -112,11 +117,18 @@
         "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"))
   (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 scm/output-lib.scm scmvid/output-lib.scm
--- scm/output-lib.scm  2017-10-23 00:10:15.753555000 +0200
+++ scmvid/output-lib.scm       2017-11-06 07:59:38.826857643 +0100
@@ -706,13 +706,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 scm/output-ps.scm scmvid/output-ps.scm
--- scm/output-ps.scm   2017-10-23 00:09:21.286200000 +0200
+++ scmvid/output-ps.scm        2017-11-06 07:59:38.830857600 +0100
@@ -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 setrgbcolor\n"
              (list r g b)))
 
 ;; restore color from stack
 (define (resetcolor) "grestore\n")
diff -U 4 scm/paper.scm scmvid/paper.scm
--- scm/paper.scm       2017-08-19 07:52:05.563096000 +0200
+++ scmvid/paper.scm    2017-11-06 07:59:38.830857600 +0100
@@ -17,8 +17,10 @@
 
 ;; for define-safe-public when byte-compiling using Guile V2
 (use-modules (scm safe-utility-defs))
 
+(define-public videopagelist '())
+
 (define-public (set-paper-dimension-variables mod)
   (module-define! mod 'dimension-variables
                   '(binding-offset
                     blot-diameter
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to