Am 06.11.2017 um 10:02 schrieb Knut Petersen:
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 <[email protected]>
    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.


One file was missing in the diff, corrected version attached.

Knut

diff -rU 4 2.21.0/ps/music-drawing-routines.ps 
2.21.0.vid/ps/music-drawing-routines.ps
--- 2.21.0/ps/music-drawing-routines.ps 2017-07-24 08:33:37.003754000 +0200
+++ 2.21.0.vid/ps/music-drawing-routines.ps     2017-11-06 10:47:41.153810422 
+0100
@@ -307,5 +307,33 @@
                moveto %w
                0 rmoveto
        }repeat
 }bind def
+
+/MKVIDcolor { 0.7 0.0 1.0 } def             % color to use
+                                            %
+/MKVIDmagic { 2.0 } def                     % magic value for our own coloring 
requests
+                                            %
+/MKVIDsetrgbcolor {                         % the extended setrgbcolor
+  3 dict begin                              % start local name space
+  /Stop exch def                            % local "blue": stop
+  /Start exch def                           % local "green": start
+  /Red exch def                             % local "red": magic
+  Red MKVIDmagic eq                         % if (Red = MKVIDmagic) (
+     { Start MkVidTime eq                   %   if (start = current time)
+        { MKVIDcolor ORIGsetrgbcolor}       %     change color to red
+        { Start MkVidTime gt                %   else if ((start > current time)
+          { Stop MkVidTime lt               %      and (stop < current time))
+            { MKVIDcolor ORIGsetrgbcolor }  %        change color to red
+          if }                              %   else
+        if }                                %      do not change color
+     ifelse }                               %
+     { Red Start Stop ORIGsetrgbcolor }     % ) else change color as requested
+     ifelse                                 %
+  end                                       % stop local namespace
+} def                                       %
+                                            %
+/ORIGsetrgbcolor /setrgbcolor load def      % make original setrgbcolor 
available as /ORIGsetrgbcolor
+                                            %
+/setrgbcolor { MKVIDsetrgbcolor } bind def  % redefine setrgbcolor
+
 %end music-drawing-routines.ps
diff -rU 4 2.21.0/scm/framework-ps.scm 2.21.0.vid/scm/framework-ps.scm
--- 2.21.0/scm/framework-ps.scm 2017-10-23 00:09:21.286200000 +0200
+++ 2.21.0.vid/scm/framework-ps.scm     2017-11-06 10:50:01.368233724 +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 -rU 4 2.21.0/scm/output-lib.scm 2.21.0.vid/scm/output-lib.scm
--- 2.21.0/scm/output-lib.scm   2017-10-23 00:10:15.753555000 +0200
+++ 2.21.0.vid/scm/output-lib.scm       2017-11-06 10:47:41.153810422 +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 -rU 4 2.21.0/scm/output-ps.scm 2.21.0.vid/scm/output-ps.scm
--- 2.21.0/scm/output-ps.scm    2017-10-23 00:09:21.286200000 +0200
+++ 2.21.0.vid/scm/output-ps.scm        2017-11-06 10:47:41.153810422 +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 -rU 4 2.21.0/scm/paper.scm 2.21.0.vid/scm/paper.scm
--- 2.21.0/scm/paper.scm        2017-08-19 07:52:05.563096000 +0200
+++ 2.21.0.vid/scm/paper.scm    2017-11-06 10:47:41.153810422 +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
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to