lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about page break time indices


From: Thomas Morley
Subject: Re: Question about page break time indices
Date: Wed, 30 Dec 2015 13:03:27 +0100

Hi Carl,

2015-12-30 8:10 GMT+01:00 Carl Peterson <address@hidden>:
> All,
>
> I am involved in some choral
> recording projects where we are
> having the singers sing from
> projected slides. To aid in timing,
> pitch, etc., we have it set up where
> they have headphones feeding them the
> MIDI of the song being recorded as
> they sing. All of this is synchonored
> through the recording software, with
> the slides being pre-rendered to a
> video file.
>
> Right now, the music slides are being
> created in Finale (cringe), the MIDI
> is being manually input into the
> recording software because we've had
> issues with Finale's MIDI being
> accurate on tempo changes, and I am
> using Apple Keynote to render the
> slides to video using manual timings.
>
> I would like to use Lilypond to
> render the individual slides and the
> MIDI, then use ffmpeg and some other
> things to programmatically render the
> video itself. The issue is that in
> order to do that, I need accurate
> timing information on slide changes.

there were some similiar projects for videos etc, can't remember, though.
Others?
>
> Which gets to my question/request. Is
> there a way, when Lilypond is
> running, for it to output some sort
> of auxiliary file with some kind of
> tick/time code information about each
> page? In other words, what is the
> time index of the first note on a
> given slide/page? With this, I can
> work with scripting tools to work
> backwards from each time code to
> generate the still images for the
> transitions from slide to slide.
>
> Thanks,
> Carl


Not sure I fully understand, but is the following of some help for you?

\version "2.19.32"

#(define* (print-pages-first-bar-numbers layout pages #:optional print-to-file)
;; If `print-to-file is set #t the output is written to a file
;; otherwise usually displayed in Terminal
  (let* ((lines (map (lambda (page) (ly:prob-property page 'lines)) pages))
         ;; list of first systems of each pages
         (sys
           (map
             (lambda (line)
               (append-map
                 (lambda (l)
                   (let ((system-grob (ly:prob-property l 'system-grob)))
                     (if (not (null? system-grob))
                         (list system-grob)
                         system-grob))
                   )
                 line))
             lines))
         ;; list of rhythmic-locations of first sys
         ;; returning a BarNumber and a moment, the moment is usually zero
         (sys-rhythmic-location
           (map
             (lambda (s)
               (if (and (not (null? s)) (ly:grob? (car s)))
                   (grob::rhythmic-location (car s))
                   #f))
             sys))
         (start-bar-numbers
           (map
             (lambda (r-l)
               (if (pair? r-l)
                   (car r-l)
                   #f))
               sys-rhythmic-location))
         (formatted-output
           (map
             (lambda (page b-nr)
               (if b-nr
                   (format #f "page ~a starts with BarNumber ~a\n" page b-nr)
                   (format #f "page ~a contains no music\n" page))
                   )
             (iota (length pages) 1 1)
             start-bar-numbers)))
    (if (not (null? start-bar-numbers))
        (if print-to-file
            (let* ((output-name (ly:parser-output-name))
                   (outfilename (format "~a-page-first-bars.log" output-name))
                   (outfile (open-output-file outfilename)))
              (if (output-port? outfile)
                  (begin
                    (format #t "\n\tprinting to ~a" outfilename)
                    (for-each
                      (lambda (i) (display i outfile))
                      formatted-output))
                  (ly:warning
                    (_ "Unable to open output file ~a to print the information")
                    outfilename))
              (close-output-port outfile))
            (for-each display formatted-output)))))

\paper {
  #(define (page-post-process layout pages)
    (print-pages-first-bar-numbers layout pages #t))
}

\header { title = "TITLE" }

\pageBreak

\score {
    \new Staff {
        \repeat unfold 2 {
          \time 4/4 c''1
          \time 3/4 d''2.
          \time 3/8 e''8 8 8
          \pageBreak
        }
    }
}

\markup "MARKUP"

\pageBreak

\score {
    \new Staff {
        \repeat unfold 2 {
          \time 4/4 c''1
          \time 3/4 d''2.
          \time 3/8 e''8 8 8
          \pageBreak
        }
    }
}


Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]